Minimum Spanning Tree: private API
PortfolioOptimisers.AbstractTreeType — Type
abstract type AbstractTreeType <: AbstractPhylogenyAlgorithmAbstract supertype for all minimum spanning tree (MST) algorithm types.
All concrete and/or abstract types implementing specific MST algorithms (e.g., Kruskal, Boruvka, Prim) should be subtypes of AbstractTreeType.
Related
References
PortfolioOptimisers.Tree_SimMat — Type
const Tree_SimMat = Union{<:AbstractNonNegativeSimilarityMatrixAlgorithm,
<:AbstractTreeType}Alias for a tree or similarity matrix algorithm.
Matches either an AbstractNonNegativeSimilarityMatrixAlgorithm or an AbstractTreeType. Used for dispatch in phylogeny estimation where either a spanning tree or a similarity matrix approach may be used.
The similarity half is the narrow family, not AbstractSimilarityMatrixAlgorithm: the similarity branch builds a PMFG, whose consumers cannot take a negative weight. So MaximumDistanceSimilarity, ExponentialSimilarity, GeneralExponentialSimilarity and ComplementSimilarity match, and AngularSimilarity does not.
Related
PortfolioOptimisers.calc_mst — Function
calc_mst(alg::AbstractTreeType, g::Graphs.AbstractGraph)Compute the minimum spanning tree (MST) of a graph using the specified algorithm.
This function dispatches to the appropriate MST computation from Graphs.jl based on the type of alg. Supported algorithms include Kruskal, Boruvka, and Prim.
Algorithm
- Select the
Graphs.jlspanning-tree routine that the type ofalgnames. - Splat
alg.argsandalg.kwargsinto that call.assert_tree_argsrefused every entry that could re-weight or re-orient the search, so the tree is minimised over the weightsgalready carries. - Read the edge vector out of the answer.
Graphs.boruvka_mstanswers with a named tuple whose first field holds it, and the other two routines answer with the vector itself.
Arguments
alg: MST algorithm to use.alg::KruskalTree: Computes the MST using Kruskal's algorithm.alg::BoruvkaTree: Computes the MST using Boruvka's algorithm.alg::PrimTree: Computes the MST using Prim's algorithm.
g::Graphs.AbstractGraph: Graph to compute the MST on.
Returns
tree::Vector: Vector of edges representing the MST.
Related
References
- [5]
- D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025).
- [58]
- R. N. Mantegna. Hierarchical structure in financial markets. The European Physical Journal B 11, 193–197 (1999).