Phylogeny
PortfolioOptimisers.PhylogenyResult Type
struct PhylogenyResult{T} <: AbstractPhylogenyResult
X::T
endContainer type for phylogeny matrix or vector results in PortfolioOptimisers.jl.
PhylogenyResult stores the output of phylogeny-based estimation routines, such as network or clustering-based phylogeny matrices, or centrality vectors. It is used throughout the package to represent validated phylogeny structures for constraint generation, centrality analysis, and related workflows.
Fields
X: The phylogeny matrix or centrality vector.
Constructor
PhylogenyResult(; X::Union{<:AbstractMatrix, <:AbstractVector})Keyword arguments correspond to the fields above.
Validation
!isempty(X).If
Xis aAbstractMatrix:Must be symmetric,
issymmetric(X) == true.Must have zero diagonal,
all(iszero, diag(X)) == true.
Examples
julia> PhylogenyResult(; X = [0 1 0; 1 0 1; 0 1 0])
PhylogenyResult
X ┴ 3×3 Matrix{Int64}
julia> PhylogenyResult(; X = [0.2, 0.5, 0.3])
PhylogenyResult
X ┴ Vector{Float64}: [0.2, 0.5, 0.3]Related
sourcePortfolioOptimisers.BetweennessCentrality Type
struct BetweennessCentrality{T1, T2} <: AbstractCentralityAlgorithm
args::T1
kwargs::T2
endCentrality algorithm type for betweenness centrality in PortfolioOptimisers.jl.
BetweennessCentrality computes the betweenness centrality of nodes in a graph, measuring the extent to which a node lies on shortest paths between other nodes.
Fields
args: Positional arguments for the centrality computation.kwargs: Keyword arguments for the centrality computation.
Constructor
BetweennessCentrality(; args::Tuple = (), kwargs::NamedTuple = (;))Keyword arguments correspond to the fields above.
Examples
julia> BetweennessCentrality()
BetweennessCentrality
args ┼ Tuple{}: ()
kwargs ┴ @NamedTuple{}: NamedTuple()Related
sourcePortfolioOptimisers.ClosenessCentrality Type
struct ClosenessCentrality{T1, T2} <: AbstractCentralityAlgorithm
args::T1
kwargs::T2
endCentrality algorithm type for closeness centrality in PortfolioOptimisers.jl.
ClosenessCentrality computes the closeness centrality of nodes in a graph, measuring how close a node is to all other nodes.
Fields
args: Positional arguments for the centrality computation.kwargs: Keyword arguments for the centrality computation.
Constructor
ClosenessCentrality(; args::Tuple = (), kwargs::NamedTuple = (;))Keyword arguments correspond to the fields above.
Examples
julia> ClosenessCentrality()
ClosenessCentrality
args ┼ Tuple{}: ()
kwargs ┴ @NamedTuple{}: NamedTuple()Related
sourcePortfolioOptimisers.DegreeCentrality Type
struct DegreeCentrality{T1, T2} <: AbstractCentralityAlgorithm
kind::T1
kwargs::T2
endCentrality algorithm type for degree centrality in PortfolioOptimisers.jl.
DegreeCentrality computes the degree centrality of nodes in a graph, measuring the number of edges connected to each node. The kind parameter specifies the type of degree (0: total, 1: in-degree, 2: out-degree).
Fields
kind: Degree type (0: total, 1: in-degree, 2: out-degree).kwargs: Keyword arguments for the centrality computation.
Constructor
DegreeCentrality(; kind::Integer = 0, kwargs::NamedTuple = (;))Keyword arguments correspond to the fields above.
Validation
0 <= kind <= 2.
Examples
julia> DegreeCentrality(; kind = 1)
DegreeCentrality
kind ┼ Int64: 1
kwargs ┴ @NamedTuple{}: NamedTuple()Related
sourcePortfolioOptimisers.EigenvectorCentrality Type
struct EigenvectorCentrality <: AbstractCentralityAlgorithm endCentrality algorithm type for eigenvector centrality in PortfolioOptimisers.jl.
EigenvectorCentrality computes the eigenvector centrality of nodes in a graph, measuring the influence of a node based on the centrality of its neighbors.
Related
sourcePortfolioOptimisers.KatzCentrality Type
struct KatzCentrality{T1} <: AbstractCentralityAlgorithm
alpha::T1
endCentrality algorithm type for Katz centrality in PortfolioOptimisers.jl.
KatzCentrality computes the Katz centrality of nodes in a graph, measuring the influence of a node based on the number and length of walks between nodes, controlled by the attenuation factor alpha.
Fields
alpha: Attenuation factor for Katz centrality.
Constructor
KatzCentrality(; alpha::Real = 0.3)Keyword arguments correspond to the fields above.
Examples
julia> KatzCentrality(; alpha = 0.5)
KatzCentrality
alpha ┴ Float64: 0.5Related
sourcePortfolioOptimisers.Pagerank Type
struct Pagerank{T1, T2, T3} <: AbstractCentralityAlgorithm
n::T1
alpha::T2
epsilon::T3
endCentrality algorithm type for PageRank in PortfolioOptimisers.jl.
Pagerank computes the PageRank of nodes in a graph, measuring the importance of nodes based on the structure of incoming links. The algorithm is controlled by the damping factor alpha, number of iterations n, and convergence tolerance epsilon.
Fields
n: Number of iterations (must be > 0).alpha: Damping factor (must be in (0, 1)).epsilon: Convergence tolerance (must be > 0).
Constructor
Pagerank(; alpha::Real = 0.85, n::Integer = 100, epsilon::Real = 1e-6)Keyword arguments correspond to the fields above.
Validation
n > 0.0 < alpha < 1.epsilon > 0.
Examples
julia> Pagerank(; alpha = 0.9, n = 200, epsilon = 1e-8)
Pagerank
n ┼ Int64: 200
alpha ┼ Float64: 0.9
epsilon ┴ Float64: 1.0e-8Related
sourcePortfolioOptimisers.RadialityCentrality Type
struct RadialityCentrality <: AbstractCentralityAlgorithm endCentrality algorithm type for radiality centrality in PortfolioOptimisers.jl.
RadialityCentrality computes the radiality centrality of nodes in a graph, measuring how close a node is to all other nodes, adjusted for the maximum possible distance.
Related
sourcePortfolioOptimisers.StressCentrality Type
struct StressCentrality{T1, T2} <: AbstractCentralityAlgorithm
args::T1
kwargs::T2
endCentrality algorithm type for stress centrality in PortfolioOptimisers.jl.
StressCentrality computes the stress centrality of nodes in a graph, measuring the number of shortest paths passing through each node.
Fields
args: Positional arguments for the centrality computation.kwargs: Keyword arguments for the centrality computation.
Constructor
StressCentrality(; args::Tuple = (), kwargs::NamedTuple = (;))Keyword arguments correspond to the fields above.
Examples
julia> StressCentrality()
StressCentrality
args ┼ Tuple{}: ()
kwargs ┴ @NamedTuple{}: NamedTuple()Related
sourcePortfolioOptimisers.KruskalTree Type
struct KruskalTree{T1, T2} <: AbstractTreeType
args::T1
kwargs::T2
endAlgorithm type for Kruskal's minimum spanning tree (MST) in PortfolioOptimisers.jl.
KruskalTree specifies the use of Kruskal's algorithm for constructing a minimum spanning tree from a graph.
Fields
args: Positional arguments for the MST computation.kwargs: Keyword arguments for the MST computation.
Constructor
KruskalTree(; args::Tuple = (), kwargs::NamedTuple = (;))Keyword arguments correspond to the fields above.
Examples
julia> KruskalTree()
KruskalTree
args ┼ Tuple{}: ()
kwargs ┴ @NamedTuple{}: NamedTuple()Related
sourcePortfolioOptimisers.BoruvkaTree Type
struct BoruvkaTree{T1, T2} <: AbstractTreeType
args::T1
kwargs::T2
endAlgorithm type for Boruvka's minimum spanning tree (MST) in PortfolioOptimisers.jl.
BoruvkaTree specifies the use of Boruvka's algorithm for constructing a minimum spanning tree from a graph.
Fields
args: Positional arguments for the MST computation.kwargs: Keyword arguments for the MST computation.
Constructor
BoruvkaTree(; args::Tuple = (), kwargs::NamedTuple = (;))Keyword arguments correspond to the fields above.
Examples
julia> BoruvkaTree()
BoruvkaTree
args ┼ Tuple{}: ()
kwargs ┴ @NamedTuple{}: NamedTuple()Related
sourcePortfolioOptimisers.PrimTree Type
struct PrimTree{T1, T2} <: AbstractTreeType
args::T1
kwargs::T2
endAlgorithm type for Prim's minimum spanning tree (MST) in PortfolioOptimisers.jl.
PrimTree specifies the use of Prim's algorithm for constructing a minimum spanning tree from a graph.
Fields
args: Positional arguments for the MST computation.kwargs: Keyword arguments for the MST computation.
Constructor
PrimTree(; args::Tuple = (), kwargs::NamedTuple = (;))Keyword arguments correspond to the fields above.
Examples
julia> PrimTree()
PrimTree
args ┼ Tuple{}: ()
kwargs ┴ @NamedTuple{}: NamedTuple()Related
sourcePortfolioOptimisers.NetworkEstimator Type
struct NetworkEstimator{T1, T2, T3, T4} <: AbstractNetworkEstimator
ce::T1
de::T2
alg::T3
n::T4
endEstimator type for network-based phylogeny analysis in PortfolioOptimisers.jl.
NetworkEstimator encapsulates the configuration for constructing a network from asset data, including the covariance estimator, distance estimator, tree or similarity algorithm, and the network depth parameter.
Fields
ce: Covariance estimator.de: Distance estimator.alg: Tree or similarity matrix algorithm.n: NetworkEstimator depth parameter.
Constructor
NetworkEstimator(; ce::StatsBase.CovarianceEstimator = PortfolioOptimisersCovariance(),
de::AbstractDistanceEstimator = Distance(; alg = CanonicalDistance()),
alg::Union{<:AbstractSimilarityMatrixAlgorithm, <:AbstractTreeType} = KruskalTree(),
n::Integer = 1)Keyword arguments correspond to the fields above.
Examples
julia> NetworkEstimator()
NetworkEstimator
ce ┼ PortfolioOptimisersCovariance
│ ce ┼ Covariance
│ │ me ┼ SimpleExpectedReturns
│ │ │ w ┴ nothing
│ │ ce ┼ GeneralCovariance
│ │ │ ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)
│ │ │ w ┴ nothing
│ │ alg ┴ Full()
│ mp ┼ DefaultMatrixProcessing
│ │ pdm ┼ Posdef
│ │ │ alg ┴ UnionAll: NearestCorrelationMatrix.Newton
│ │ denoise ┼ nothing
│ │ detone ┼ nothing
│ │ alg ┴ nothing
de ┼ Distance
│ power ┼ nothing
│ alg ┴ CanonicalDistance()
alg ┼ KruskalTree
│ args ┼ Tuple{}: ()
│ kwargs ┴ @NamedTuple{}: NamedTuple()
n ┴ Int64: 1Related
sourcePortfolioOptimisers.CentralityEstimator Type
struct CentralityEstimator{T1, T2} <: AbstractCentralityEstimator
ne::T1
cent::T2
endEstimator type for centrality-based analysis in PortfolioOptimisers.jl.
CentralityEstimator encapsulates the configuration for computing centrality measures on a network, including the network estimator and the centrality algorithm.
Fields
ne: NetworkEstimator estimator.cent: Centrality algorithm.
Constructor
CentralityEstimator(;
ne::Union{<:AbstractPhylogenyEstimator, <:AbstractPhylogenyResult} = NetworkEstimator(),
cent::AbstractCentralityAlgorithm = DegreeCentrality())Keyword arguments correspond to the fields above.
Examples
julia> CentralityEstimator()
CentralityEstimator
ne ┼ NetworkEstimator
│ ce ┼ PortfolioOptimisersCovariance
│ │ ce ┼ Covariance
│ │ │ me ┼ SimpleExpectedReturns
│ │ │ │ w ┴ nothing
│ │ │ ce ┼ GeneralCovariance
│ │ │ │ ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)
│ │ │ │ w ┴ nothing
│ │ │ alg ┴ Full()
│ │ mp ┼ DefaultMatrixProcessing
│ │ │ pdm ┼ Posdef
│ │ │ │ alg ┴ UnionAll: NearestCorrelationMatrix.Newton
│ │ │ denoise ┼ nothing
│ │ │ detone ┼ nothing
│ │ │ alg ┴ nothing
│ de ┼ Distance
│ │ power ┼ nothing
│ │ alg ┴ CanonicalDistance()
│ alg ┼ KruskalTree
│ │ args ┼ Tuple{}: ()
│ │ kwargs ┴ @NamedTuple{}: NamedTuple()
│ n ┴ Int64: 1
cent ┼ DegreeCentrality
│ kind ┼ Int64: 0
│ kwargs ┴ @NamedTuple{}: NamedTuple()Related
sourcePortfolioOptimisers.phylogeny_matrix Function
phylogeny_matrix(ph::PhylogenyResult{<:AbstractMatrix}, args...; kwargs...)Fallback no-op for returning a validated phylogeny matrix result as-is.
This method provides a generic interface for handling precomputed phylogeny matrices wrapped in a PhylogenyResult. It simply returns the input object unchanged, enabling consistent downstream workflows for constraint generation and analysis.
Arguments
ph::PhylogenyResult{<:AbstractMatrix}: Phylogeny matrix result object.args...: Additional positional arguments (ignored).kwargs...: Additional keyword arguments (ignored).
Returns
- The input
phobject.
Examples
julia> ph = PhylogenyResult(; X = [0 1 0; 1 0 1; 0 1 0]);
julia> phylogeny_matrix(ph)
PhylogenyResult
X ┴ 3×3 Matrix{Int64}Related
sourcephylogeny_matrix(ne::AbstractNetworkEstimator, X::AbstractMatrix; dims::Int = 1, kwargs...)Compute the phylogeny matrix for a network estimator.
This function constructs the adjacency matrix for the network, then computes the phylogeny matrix by summing powers of the adjacency matrix up to the network depth parameter n, clamping values to 0 or 1, and removing self-loops.
Arguments
ne: NetworkEstimator estimator.X: Data matrix (observations × assets).dims: Dimension along which to compute.kwargs...: Additional keyword arguments.
Returns
P::Matrix{Int}: Phylogeny matrix representing asset relationships.
Related
sourcephylogeny_matrix(cle::Union{<:AbstractClusteringEstimator, <:AbstractClusteringResult},
X::AbstractMatrix; branchorder::Symbol = :optimal, dims::Int = 1,
kwargs...)Compute the phylogeny matrix for a clustering estimator or result.
This function clusterises the data, cuts the tree into the optimal number of clusters, and constructs a binary phylogeny matrix indicating shared cluster membership, with self-loops removed.
Arguments
cle: Clustering estimator or result.X: Data matrix (observations × assets).branchorder: Branch ordering strategy for hierarchical clustering.dims: Dimension along which to compute.kwargs...: Additional keyword arguments.
Returns
P::Matrix{Int}: Phylogeny matrix representing cluster relationships.
Related
sourcephylogeny_matrix(necle::Union{<:AbstractNetworkEstimator, <:AbstractClusteringEstimator,
<:AbstractClusteringResult}, pr::AbstractPriorResult;
kwargs...)Compute the phylogeny matrix from asset returns in a prior result using a network or clustering estimator.
phylogeny_matrix applies the specified network or clustering estimator to the asset returns matrix contained in the prior result object, producing a phylogeny matrix for use in constraint generation, centrality analysis, or portfolio construction.
Arguments
necle: Network estimator, clustering estimator, or clustering result.pr: Prior result object.kwargs...: Additional keyword arguments passed to the estimator.
Returns
plr::PhylogenyResult: Result object containing the phylogeny matrix.
Related
sourcePortfolioOptimisers.centrality_vector Function
centrality_vector(ph::PhylogenyResult{<:AbstractVector}, args...; kwargs...)Fallback no-op for returning a validated centrality vector result as-is.
This method provides a generic interface for handling precomputed centrality vectors wrapped in a PhylogenyResult. It simply returns the input object unchanged, enabling consistent downstream workflows for centrality-based analysis and constraint generation.
Arguments
ph::PhylogenyResult{<:AbstractVector}: Centrality vector result object.args...: Additional positional arguments (ignored).kwargs...: Additional keyword arguments (ignored).
Returns
- The input
phobject.
Examples
julia> ph = PhylogenyResult(; X = [0.2, 0.5, 0.3]);
julia> centrality_vector(ph)
PhylogenyResult
X ┴ Vector{Float64}: [0.2, 0.5, 0.3]Related
sourcecentrality_vector(ne::Union{<:AbstractNetworkEstimator, <:AbstractClusteringEstimator,
<:AbstractClusteringResult}, cent::AbstractCentralityAlgorithm,
X::AbstractMatrix; dims::Int = 1, kwargs...)Compute the centrality vector for a network and centrality algorithm.
This function constructs the phylogeny matrix for the network, builds a graph, and computes node centrality scores using the specified centrality algorithm.
Arguments
ne: Phylogeny estimator.cent: Centrality algorithm.X: Data matrix (observations × assets).dims: Dimension along which to compute.kwargs...: Additional keyword arguments.
Returns
cv::Vector{<:Real}: Centrality scores for each asset.
Related
sourcecentrality_vector(cte::CentralityEstimator, X::AbstractMatrix; dims::Int = 1, kwargs...)Compute the centrality vector for a centrality estimator.
This function applies the centrality algorithm in the estimator to the network constructed from the data.
Arguments
cte: Centrality estimator.X: Data matrix (observations × assets).dims: Dimension along which to compute.kwargs...: Additional keyword arguments.
Returns
cv::Vector{<:Real}: Centrality scores for each asset.
Related
sourcecentrality_vector(cte::CentralityEstimator, pr::AbstractPriorResult; kwargs...)Compute the centrality vector for a centrality estimator and prior result.
centrality_vector applies the centrality algorithm in the estimator to the network constructed from the asset returns in the prior result, returning centrality scores for each asset.
Arguments
cte: Centrality estimator.pr: Prior result object.kwargs...: Additional keyword arguments.
Returns
plr::PhylogenyResult: Result object containing the centrality vector.
Related
sourcecentrality_vector(ne::Union{<:AbstractNetworkEstimator, <:AbstractClusteringEstimator,
<:AbstractClusteringResult}, cent::AbstractCentralityAlgorithm,
pr::AbstractPriorResult; kwargs...)Compute the centrality vector for a network or clustering estimator and centrality algorithm.
centrality_vector constructs the phylogeny matrix from the asset returns in the prior result, builds a graph, and computes node centrality scores using the specified centrality algorithm.
Arguments
ne: Network estimator, clustering estimator, or clustering result.cent: Centrality algorithm.pr: Prior result object.kwargs...: Additional keyword arguments.
Returns
plr::PhylogenyResult: Result object containing the centrality vector.
Related
sourcePortfolioOptimisers.average_centrality Function
average_centrality(ne::Union{<:AbstractPhylogenyEstimator, <:AbstractPhylogenyResult},
cent::AbstractCentralityAlgorithm, w::AbstractVector, X::AbstractMatrix;
dims::Int = 1, kwargs...)Compute the weighted average centrality for a network and centrality algorithm.
This function computes the centrality vector and returns the weighted average using the provided weights.
Arguments
ne: NetworkEstimator estimator.cent: Centrality algorithm.w: Weights vector.X: Data matrix (observations × assets).dims: Dimension along which to compute.kwargs...: Additional keyword arguments.
Returns
ac::Real: Average centrality.
Related
sourceaverage_centrality(cte::CentralityEstimator, w::AbstractVector, X::AbstractMatrix;
dims::Int = 1, kwargs...)Compute the weighted average centrality for a centrality estimator.
This function applies the centrality algorithm in the estimator to the network and returns the weighted average using the provided weights.
Arguments
cte: Centrality estimator.w: Weights vector.X: Data matrix (observations × assets).dims: Dimension along which to compute.kwargs...: Additional keyword arguments.
Returns
ac::Real: Average centrality.
Related
sourceaverage_centrality(ne::Union{<:AbstractPhylogenyEstimator, <:AbstractPhylogenyResult},
cent::AbstractCentralityAlgorithm, w::AbstractVector,
pr::AbstractPriorResult; kwargs...)Compute the weighted average centrality for a network or phylogeny result.
average_centrality computes the centrality vector using the specified network or phylogeny estimator and centrality algorithm, then returns the weighted average using the provided portfolio weights.
Arguments
ne: Network estimator or phylogeny result.cent: Centrality algorithm.w: Portfolio weights vector.pr: Prior result object.kwargs...: Additional keyword arguments.
Returns
ac::Real: Weighted average centrality.
Related
sourceaverage_centrality(cte::CentralityEstimator, w::AbstractVector, pr::AbstractPriorResult;
kwargs...)Compute the weighted average centrality for a centrality estimator.
average_centrality applies the centrality algorithm in the estimator to the network constructed from the asset returns in the prior result, then returns the weighted average using the provided portfolio weights.
Arguments
cte: Centrality estimator.w: Portfolio weights vector.pr: Prior result object.kwargs...: Additional keyword arguments.
Returns
ac::Real: Weighted average centrality.
Related
sourcePortfolioOptimisers.asset_phylogeny Function
asset_phylogeny(w::AbstractVector, X::AbstractMatrix)Compute the asset phylogeny score for a set of weights and a phylogeny matrix.
This function computes the weighted sum of the phylogeny matrix, normalised by the sum of absolute weights. The asset phylogeny score quantifies the degree of phylogenetic (network or cluster-based) structure present in the portfolio allocation.
Arguments
w: Weights vector.X: Phylogeny matrix.
Returns
p::Real: Asset phylogeny score.
Related
sourceasset_phylogeny(ph::PhylogenyResult{<:AbstractMatrix}, w::AbstractVector, args...;
kwargs...)Compute the asset phylogeny score for a set of portfolio weights and a phylogeny matrix result, forwarding additional arguments.
This method provides compatibility with workflows that pass extra positional or keyword arguments. It extracts the phylogeny matrix from the PhylogenyResult and delegates to asset_phylogeny(w, ph), ignoring any additional arguments.
Arguments
ph::PhylogenyResult{<:AbstractMatrix}: Phylogeny matrix result object.w::AbstractVector: Portfolio weights vector.args...: Additional positional arguments (ignored).kwargs...: Additional keyword arguments (ignored).
Returns
score::Real: Asset phylogeny score.
Related
sourceasset_phylogeny(cle::Union{<:NetworkEstimator, <:ClusteringEstimator}, w::AbstractVector,
X::AbstractMatrix; dims::Int = 1, kwargs...)Compute the asset phylogeny score for a set of weights and a network or clustering estimator.
This function computes the phylogeny matrix using the estimator and data, then computes the asset phylogeny score using the weights.
Arguments
cle: NetworkEstimator or clustering estimator.w: Weights vector.X: Data matrix (observations × assets).dims: Dimension along which to compute.kwargs...: Additional keyword arguments.
Returns
p::Real: Asset phylogeny score.
Related
sourceasset_phylogeny(cle::Union{<:AbstractPhylogenyEstimator, <:AbstractClusteringResult},
w::AbstractVector, pr::AbstractPriorResult; dims::Int = 1, kwargs...)Compute the asset phylogeny score for a portfolio allocation using a phylogeny estimator or clustering result and a prior result.
This function computes the phylogeny matrix from the asset returns in the prior result using the specified phylogeny estimator or clustering result, then evaluates the asset phylogeny score for the given portfolio weights. The asset phylogeny score quantifies the degree of phylogenetic (network or cluster-based) structure present in the portfolio allocation.
Arguments
cle: Phylogeny estimator or clustering result used to compute the phylogeny matrix.w: Portfolio weights vector.pr: Prior result object containing asset returns.dims: Dimension along which to compute the phylogeny matrix.kwargs...: Additional keyword arguments passed to the phylogeny matrix computation.
Returns
score::Real: Asset phylogeny score.
Details
Computes the phylogeny matrix from the asset returns in
prusingcle.Evaluates the weighted sum of the phylogeny matrix using the weights
w.Normalises the score by the sum of absolute weights.
Returns a real-valued score quantifying the phylogenetic structure of the allocation.
Related
PortfolioOptimisers.AbstractCentralityAlgorithm Type
abstract type AbstractCentralityAlgorithm <: AbstractPhylogenyAlgorithm endAbstract supertype for all centrality algorithm types in PortfolioOptimisers.jl from Graphs.jl.
All concrete types implementing specific centrality algorithms (e.g., betweenness, closeness, degree, eigenvector, Katz, pagerank, radiality, stress) should subtype AbstractCentralityAlgorithm. This enables flexible extension and dispatch of centrality routines for network and phylogeny analysis.
Related
PortfolioOptimisers.AbstractTreeType Type
abstract type AbstractTreeType <: AbstractPhylogenyAlgorithm endAbstract supertype for all minimum spanning tree (MST) algorithm types in PortfolioOptimisers.jl.
All concrete types implementing specific MST algorithms (e.g., Kruskal, Boruvka, Prim) should subtype AbstractTreeType. This enables flexible extension and dispatch of tree-based routines for network and phylogeny analysis.
Related
sourcePortfolioOptimisers.calc_mst Function
calc_mst(alg::AbstractTreeType, g::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.
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::AbstractGraph: Graph to compute the MST on.
Returns
tree::Vector: Vector of edges representing the MST.
Related
sourcePortfolioOptimisers.AbstractNetworkEstimator Type
abstract type AbstractNetworkEstimator <: AbstractPhylogenyEstimator endAbstract supertype for all network estimator types in PortfolioOptimisers.jl.
All concrete types implementing network-based estimation algorithms should subtype AbstractNetworkEstimator. This enables a consistent interface for network estimators throughout the package.
Related
sourcePortfolioOptimisers.AbstractCentralityEstimator Type
abstract type AbstractCentralityEstimator <: AbstractPhylogenyEstimator endAbstract supertype for all centrality estimator types in PortfolioOptimisers.jl.
All concrete types implementing centrality-based estimation algorithms should subtype AbstractCentralityEstimator. This enables a consistent interface for centrality estimators throughout the package.
Related
sourcePortfolioOptimisers.calc_adjacency Function
calc_adjacency(ne::NetworkEstimator, X::AbstractMatrix; dims::Int = 1, kwargs...)Compute the adjacency matrix for a network estimator.
Arguments
ne: NetworkEstimator estimator.ne::NetworkEstimator{<:Any, <:Any, <:AbstractTreeType, <:Any}: Constructs a weighted graph from the distance matrix and computes the minimum spanning tree, returning the adjacency matrix of the resulting graph.ne::NetworkEstimator{<:Any, <:Any, <:AbstractSimilarityMatrixAlgorithm, <:Any}: Computes the similarity and distance matrices, applies thePMFG_T2salgorithm, and returns the adjacency matrix of the resulting graph..
X: Data matrix (observations × assets).dims: Dimension along which to compute.kwargs...: Additional keyword arguments.
Returns
adj::Matrix{Int}: Adjacency matrix representing the network.
Related
sourcePortfolioOptimisers.calc_centrality Function
calc_centrality(cent::AbstractCentralityAlgorithm, g::AbstractGraph)Compute node centrality scores for a graph using the specified centrality algorithm.
This function dispatches to the appropriate centrality computation from Graphs.jl based on the type of cent. Supported algorithms include betweenness, closeness, degree, eigenvector, Katz, pagerank, radiality, and stress centrality.
Arguments
cent: Centrality algorithm to use.cent::BetweennessCentrality: Computes betweenness centrality.cent::ClosenessCentrality: Computes closeness centrality.cent::DegreeCentrality: Computes degree centrality.cent::EigenvectorCentrality: Computes eigenvector centrality.cent::KatzCentrality: Computes Katz centrality.cent::Pagerank: Computes PageRank.cent::RadialityCentrality: Computes radiality centrality.cent::StressCentrality: Computes stress centrality.
g: Graph to compute centrality on.
Returns
Vector{<:Real}: Centrality scores for each node in the graph.
Related