Reference
- [1]
- W.-M. Song, T. D. Matteo and T. Aste. Nested hierarchies in planar graphs. Discrete Applied Mathematics 159, 2135–2146 (2011).
- [2]
- W.-M. Song, T. Di Matteo and T. Aste. Hierarchical information clustering by means of topologically embedded graphs. PloS one 7, e31929 (2012).
- [3]
- W. Barfuss, G. P. Massara, T. Di Matteo and T. Aste. Parsimonious modeling with information filtering networks. Phys. Rev. E 94, 062306 (2016).
- [4]
- G. P. Massara, T. Di Matteo and T. Aste. Network Filtering for Big Data: Triangulated Maximally Filtered Graph. Journal of Complex Networks 5, 161–178 (2016), arXiv:https://academic.oup.com/comnet/article-pdf/5/2/161/13794756/cnw015.pdf.
Contributors
Contents
Index
PortfolioOptimisers.PortfolioOptimisers
PortfolioOptimisers.DBHTRootMethod
PortfolioOptimisers.EqualRoot
PortfolioOptimisers.UniqueRoot
PortfolioOptimisers.AdjCliq
PortfolioOptimisers.BubbleCluster8s
PortfolioOptimisers.BubbleHierarchy
PortfolioOptimisers.BubbleMember
PortfolioOptimisers.BuildHierarchy
PortfolioOptimisers.CliqHierarchyTree2s
PortfolioOptimisers.CliqueRoot
PortfolioOptimisers.DBHTs
PortfolioOptimisers.DendroConstruct
PortfolioOptimisers.DirectHb
PortfolioOptimisers.FindDisjoint
PortfolioOptimisers.HierarchyConstruct4s
PortfolioOptimisers.J_LoGo
PortfolioOptimisers.LinkageFunction
PortfolioOptimisers.PMFG_T2s
PortfolioOptimisers.breadth
PortfolioOptimisers.build_link_and_dendro
PortfolioOptimisers.clique3
PortfolioOptimisers.distance_wei
PortfolioOptimisers.turn_into_Hclust_merges
PortfolioOptimisers.PortfolioOptimisers
— ModulePortfolioOptimisers.DBHTRootMethod
— Typeabstract type DBHTRootMethod end
PortfolioOptimisers.EqualRoot
— Typestruct EqualRoot <: DBHTRootMethod end
PortfolioOptimisers.UniqueRoot
— Typestruct UniqueRoot <: DBHTRootMethod end
PortfolioOptimisers.AdjCliq
— MethodAdjCliq(A::AbstractMatrix{<:Real}, CliqList::AbstractMatrix{<:Real},
CliqRoot::AbstractVector{<:Real})
Find adjacent clique to the root candidates.
Inputs
A
:N×N
adjacency matrix.CliqList
:Nc×3
matrix. Each row vector lists the three vertices consisting of a 3-clique in the MPG.CliqRoot
:Nc×1
vector of root cliques.
Outputs
Adj
:Nc×Nc
adjacency matrix of the cliques with the root cliques.
PortfolioOptimisers.BubbleCluster8s
— MethodBubbleCluster8s(Rpm::AbstractMatrix{<:Real}, Dpm::AbstractMatrix{<:Real},
Hb::AbstractMatrix{<:Real}, Mb::AbstractMatrix{<:Real},
Mv::AbstractMatrix{<:Real}, CliqList::AbstractMatrix{<:Real})
Obtains non-discrete and discrete clusterings from the bubble topology of the Planar Maximally Filtered Graph (PMFG).
Inputs
Rpm
:N×N
sparse weighted adjacency matrix of the PMFG.Dpm
:N×N
shortest path lengths matrix of the PMFG.Hb
: undirected bubble tree of the PMFG.Mb
:Nc×Nb
bubble membership matrix for 3-cliques.Mb[n, bi] = 1
indicated that 3-cliquen
belongs to bubblebi
.Mv
:N×Nb
bubble membership matrix for vertices.CliqList
:Nc×3
matrix. Each row vector lists the three vertices consisting of a 3-clique in the MPG.
Outputs
Adjv
:N×Nk
cluster membership matrix for vertices for non-discrete clustering via the bubble topology.Adjv[n, k] = 1
indicates cluster membership of vertexn
to thek
'th non-discrete cluster.Tc
:N×1
cluster membership vector.Tc[n] = k
indicates cluster membership of vertexn
to thek
'th discrete cluster.
PortfolioOptimisers.BubbleHierarchy
— MethodBubbleHierarchy(Pred::AbstractVector{<:Real}, Sb::AbstractVector{<:Real})
Build the bubble hierarchy.
Inputs
Pred
:Nc×1
vector of predicted hierarchies.Sb
:Nc×1
vector.Sb[n] = 1
indicates 3-cliquen
is separating.
Outputs
Mb
:Nc×Nb
bubble membership matrix for 3-cliques.Mb[n, bi] = 1
indicated that 3-cliquen
belongs to bubblebi
.H2
:Nb×Nb
adjacency matrix for the bubble hierarchical tree whereNb
is the number of bubbles.
PortfolioOptimisers.BubbleMember
— MethodBubbleMember(Rpm::AbstractMatrix{<:Real}, Mv::AbstractMatrix{<:Real},
Mc::AbstractMatrix{<:Real})
Assigns each vertex in the to a specific bubble.
Inputs
Rpm
:N×N
sparse weighted adjacency matrix of the PMFG.Mv
:N×Nb
bubble membership matrix.Mv[n, bi] = 1
means vertexn
is a vertex of bubblebi
.Mc
: Matrix of the bubbles which coincide with the cluster.
Outputs
Mvv
: Matrix of the vertices belonging to the bubble.
PortfolioOptimisers.BuildHierarchy
— MethodBuildHierarchy(M::AbstractMatrix{<:Real})
Builds the predicted hierarchy.
Inputs
M
:N×Nc
matrix of nodes and 3-cliques.
Outputs
Pred
:Nc×1
vector of predicted hierarchies.
PortfolioOptimisers.CliqHierarchyTree2s
— FunctionCliqHierarchyTree2s(Apm::AbstractMatrix{<:Real}, type::Symbol = :Unique)
Looks for 3-cliques of a Maximal Planar Graph (MPG), then construct a hierarchy of the cliques with the definition of "inside" a clique being a subgraph of smaller size when the entire graph is made disjoint by removing the clique [1].
Inputs
Apm
:N×N
adjacency matrix of an MPG.type
: type for finding the root of the graphDBHTRootMethod
. Uses Voronoi tesselation between tiling triangles.UniqueRoot
: create a unique root.EqualRoot
: the root is created from the candidate's adjacency tree.
Outputs
H1
:Nc×Nc
adjacency matrix for 3-clique hierarchical tree whereNc
is the number of 3-cliques.H2
:Nb×Nb
adjacency matrix for the bubble hierarchical tree whereNb
is the number of bubbles.Mb
:Nc×Nb
bubble membership matrix for 3-cliques.Mb[n, bi] = 1
indicated that 3-cliquen
belongs to bubblebi
.CliqList
:Nc×3
matrix. Each row vector lists the three vertices consisting of a 3-clique in the MPG.Sb
:Nc×1
vector.Sb[n] = 1
indicates 3-cliquen
is separating.
PortfolioOptimisers.CliqueRoot
— MethodCliqueRoot(::UniqueRoot, Root, Pred, Nc, args...)
PortfolioOptimisers.DBHTs
— MethodDBHTs(D::AbstractMatrix{<:Real}, S::AbstractMatrix{<:Real}; branchorder::Symbol = :optimal,
type::Symbol = :Unique)
Perform Direct Bubble Hierarchical Tree clustering, a deterministic clustering algorithm [2]. This version uses a graph-theoretic filtering technique called Triangulated Maximally Filtered Graph (TMFG).
Arguments
D
:N×N
dissimilarity matrix, e.g. a distance matrix.S
:N×N
non-negative sim matrix, examples include:- $\mathbf{S} = \mathbf{C} + \lvert \min \mathbf{C} \rvert$.
- $\mathbf{S} = \lceil\max \left(\mathbf{D}^{\odot 2}\right)\rceil - \mathbf{D}^{\odot 2}$.
- $\mathbf{S} = \exp \odot (-\mathbf{D})$.
Where $\mathbf{C}$ is the correlation matrix, $\mathbf{D}$ the dissimilarity matrix
D
, and $\odot$ the Hadamard (elementwise) operator.branchorder
: parameter for ordering the final dendrogram's branches accepted byClustering.jl
.type
: type for finding the root of a Direct Bubble Hierarchical Clustering Tree in case there is more than one candidateDBHTRootMethod
.:Unique
: create a unique root.:Equal
: the root is created from the candidate's adjacency tree.
Outputs
T8
:N×1
cluster membership vector.Rpm
:N×N
adjacency matrix of the Planar Maximally Filtered Graph (PMFG).Adjv
: Bubble cluster membership matrix fromBubbleCluster8s
.Dpm
:N×N
shortest path length matrix of the PMFG.Mv
:N×Nb
bubble membership matrix.Mv[n, bi] = 1
means vertexn
is a vertex of bubblebi
.Z
:(N-1)×3
linkage matrix in the same format as the output from Matlab.Z_hclust
: Z matrix in Clustering.Hclust format.
PortfolioOptimisers.DendroConstruct
— MethodDendroConstruct(Zi::AbstractMatrix{<:Real}, LabelVec1::AbstractVector{<:Real},
LabelVec2::AbstractVector{<:Real},
LinkageDist::Union{<:Real, <:AbstractVector{<:Real}})
Construct the linkage matrix by continuially adding rows to the matrix.
Inputs
Zi
: Linkage matrix at iterationi
in the same format as the output from Matlab.LabelVec1
: label vector for the vertices in the bubble for the previous valid iteration.LabelVec2
: label vector for the vertices in the bubble for the trial iteration.
Outputs
Z
: Linkage matrix at iterationi + 1
in the same format as the output from Matlab.
PortfolioOptimisers.DirectHb
— MethodDirectHb(Rpm::AbstractMatrix{<:Real}, Hb::AbstractMatrix{<:Real},
Mb::AbstractMatrix{<:Real}, Mv::AbstractMatrix{<:Real},
CliqList::AbstractMatrix{<:Real})
Computes the directions on each separating 3-clique of a Maximal Planar Graph (MPH), hence computes the Directed Bubble Hierarchy Tree (DBHT).
Inputs
Rpm
:N×N
sparse weighted adjacency matrix of the Planar Maximally Filtered Graph (MPFG).Hb
: Undirected bubble tree of the PMFG.Mb
:Nc×Nb
bubble membership matrix for 3-cliques.Mb[n, bi] = 1
indicated that 3-cliquen
belongs to bubblebi
.Mv
:N×Nb
bubble membership matrix for vertices.CliqList
:Nc×3
matrix. Each row vector lists the three vertices consisting of a 3-clique in the MPG.
Outputs
Hc
:Nb×Nb
unweighted directed adjacency matrix of the DBHT.Hc[i, j]=1
indicates a directed edge from bubblei
to bubblej
.
PortfolioOptimisers.FindDisjoint
— MethodFindDisjoint(Adj::AbstractMatrix{<:Real}, Cliq::AbstractVector{<:Real})
Finds disjointed cliques in adjacency matrix.
Inputs
Adj
:N×N
adjacency matrix.Cliq
:3×1
vector of 3-cliques.
Outputs
T
:N×1
vector containing the adjacency number of each node.IndxNot
:N×1
vector of nodes with no adjacencies.
PortfolioOptimisers.HierarchyConstruct4s
— MethodHierarchyConstruct4s(Rpm::AbstractMatrix{<:Real}, Dpm::AbstractMatrix{<:Real},
Tc::AbstractVector{<:Real}, Mv::AbstractMatrix{<:Real})
Constructs the intra- and inter-cluster hierarchy by utilizing Bubble Hierarchy structure of a Maximal Planar graph, in this a Planar Maximally Filtered Graph (PMFG).
Inputs
Rpm
:N×N
sparse weighted adjacency matrix of the PMFG.Dpm
:N×N
shortest path lengths matrix of the PMFG.Tc
:N×1
cluster membership vector.Tc[n] = k
indicates cluster membership of vertexn
to thek
'th discrete cluster.Mv
:N×Nb
bubble membership matrix.Mv[n, bi] = 1
means vertexn
is a vertex of bubblebi
.
Outputs
Z
:(N-1)×3
linkage matrix in the same format as the output from Matlab.
PortfolioOptimisers.J_LoGo
— MethodJ_LoGo(sigma, separators, cliques)
Compute the sparse inverse covariance from a clique tree and separators [3].
Inputs
sigma
:N×N
covariance matrix.separators
: list of 3-cliques that are not triangular faces.cliques
: list of all 4-cliques.
Outputs
jlogo
: J_LoGo covariance matrix.
PortfolioOptimisers.LinkageFunction
— MethodLinkageFunction(d::AbstractMatrix{<:Real}, labelvec::AbstractVector{<:Real})
Looks for the pair of clusters with the best linkage.
Inputs
d
:Nv×Nv
distance matrix for a list of vertices assigned to a bubble.labelvec
: label vector for the vertices in the bubble.
Outputs
PairLink
: pair of links with the best linkage.dvu
: value of the best linkage.
PortfolioOptimisers.PMFG_T2s
— FunctionPMFG_T2s(W::AbstractMatrix{<:Real}, nargout::Integer = 3)
Constructs a Triangulated Maximally Filtered Graph (TMFG) starting from a tetrahedron and recursively inserting vertices inside existing triangles (T2 move) in order to approximate a Maximal Planar Graph with the largest total weight, aka Planar Maximally Filtered Graph (PMFG). All weights are non-negative [4].
Arguments
W
:N×N
matrix of non-negative weights.nargout
: number of output arguments, the same arguments are always returne, this only controls whether some arguments are empty or not.
Outputs
A
: adjacency matrix of the PMFG with weights.tri
: list of triangles (triangular faces).clique3
: list of 3-cliques taht are not triangular faces, all 3-cliques are given by[tri; clique3]
.cliques
: list of all 4-cliques, ifnargout <= 3
, this will be returned as an empty array.cliqueTree
: 4-cliques tree structure (adjacency matrix), ifnargout <= 4
, it is returned as an empty array.
PortfolioOptimisers.breadth
— Methodbreadth(CIJ::AbstractMatrix{<:Real}, source::Integer)
Breadth-first search.
Inputs
CIJ
: binary (directed/undirected) connection matrix.source
: source vertex.
Outputs
distance
: distance betweensource
and i'th vertex (0 for source vertex).branch
: vertex that precedes i in the breadth-first search tree (-1 for source vertex).
PortfolioOptimisers.build_link_and_dendro
— Methodbuild_link_and_dendro(rg::AbstractRange, dpm::AbstractMatrix{<:Real},
LabelVec::AbstractVector{<:Real}, LabelVec1::AbstractVector{<:Real},
LabelVec2::AbstractVector{<:Real}, V::AbstractVector{<:Real},
nc::Real, Z::AbstractMatrix{<:Real})
Computes iterates over the vertices to construct the linkage matrix iteration by iteration.
Inputs
rg
: range of indices of the vertices in a bubble.dpm
:Nv×Nv
distance matrix for a list of vertices assigned to a bubble.LabelVec
: vector labels of all vertices.LabelVec1
: label vector for the vertices in the bubble for the previous valid iteration.LabelVec2
: label vector for the vertices in the bubble for the trial iteration.
Outputs
Z
: updated linkage matrix in the same format as the output from Matlab.nc
: updated inverse of the linkage distance.LabelVec1
: updatedLabelVec1
for the next iteration.
PortfolioOptimisers.clique3
— Methodclique3(A::AbstractMatrix{<:Real})
Computes the list of 3-cliques.
Inputs
A
:N×N
adjacency matrix of a Maximal Planar Graph (MPG).
Outputs
K3
: vector of vectors with the corresponding indices of candidate cliques.E
: matrix with non-zero indices and entries of candidate cliques.CliqList
:Nc×3
matrix. Each row vector lists the three vertices consisting of a 3-clique in the MPG.
PortfolioOptimisers.distance_wei
— Methoddistance_wei(L::AbstractMatrix{<:Real})
The distance matrix contains lengths of shortest paths between all node pairs. An entry [u, v]
represents the length of the shortest path from node u
to node v
. The average shortest path length is the characteristic path length of the network. The function uses Dijkstra's algorithm.
Inputs
L
: Directed/undirected connection-length matrix.- Lengths between disconnected nodes are set to
Inf
. - Lengths on the main diagonal are set to
0
.
- Lengths between disconnected nodes are set to
The input matrix must be a connection-length matrix typically obtained via a mapping from weight to length. For instance, in a weighted correlation network, higher correlations are more naturally interpreted as shorter distances, and the input matrix should therefore be some inverse of the connectivity matrix, i.e. a distance matrix.
The number of edges in the shortest weighted path may in general exceed the number of edges in the shortest binary paths (i.e. the shortest weighted paths computed on the binarised connectivity matrix), because the shortest weighted paths have the minimal weighted distance, not necessarily the minimal number of edges.
Outputs
D
: distance (shortest weighted path) matrix.B
: number of edged in the shortest weigthed path matrix.
PortfolioOptimisers.turn_into_Hclust_merges
— Methodturn_into_Hclust_merges(Z::AbstractMatrix{<:Real})
Turns a Matlab-style linkage matrix to a useable format for Hclust
.
Inputs
Z
: Matlab-style linkage matrix.
Outputs
Z
: Hclust-style linkage matrix.