Reference

[1]
[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]
[4]

Contributors

Contents

Index

PortfolioOptimisers.AdjCliqMethod
AdjCliq(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.
source
PortfolioOptimisers.BubbleCluster8sMethod
BubbleCluster8s(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-clique n belongs to bubble bi.
  • 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 vertex n to the k'th non-discrete cluster.
  • Tc: N×1 cluster membership vector. Tc[n] = k indicates cluster membership of vertex n to the k'th discrete cluster.
source
PortfolioOptimisers.BubbleHierarchyMethod
BubbleHierarchy(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-clique n is separating.

Outputs

  • Mb: Nc×Nb bubble membership matrix for 3-cliques. Mb[n, bi] = 1 indicated that 3-clique n belongs to bubble bi.
  • H2: Nb×Nb adjacency matrix for the bubble hierarchical tree where Nb is the number of bubbles.
source
PortfolioOptimisers.BubbleMemberMethod
BubbleMember(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 vertex n is a vertex of bubble bi.
  • Mc: Matrix of the bubbles which coincide with the cluster.

Outputs

  • Mvv: Matrix of the vertices belonging to the bubble.
source
PortfolioOptimisers.BuildHierarchyMethod
BuildHierarchy(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.
source
PortfolioOptimisers.CliqHierarchyTree2sFunction
CliqHierarchyTree2s(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 graph DBHTRootMethod. 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 where Nc is the number of 3-cliques.
  • H2: Nb×Nb adjacency matrix for the bubble hierarchical tree where Nb is the number of bubbles.
  • Mb: Nc×Nb bubble membership matrix for 3-cliques. Mb[n, bi] = 1 indicated that 3-clique n belongs to bubble bi.
  • 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-clique n is separating.
source
PortfolioOptimisers.DBHTsMethod
DBHTs(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 by Clustering.jl.

  • type: type for finding the root of a Direct Bubble Hierarchical Clustering Tree in case there is more than one candidate DBHTRootMethod.

    • :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 from BubbleCluster8s.
  • Dpm: N×N shortest path length matrix of the PMFG.
  • Mv: N×Nb bubble membership matrix. Mv[n, bi] = 1 means vertex n is a vertex of bubble bi.
  • Z: (N-1)×3 linkage matrix in the same format as the output from Matlab.
  • Z_hclust: Z matrix in Clustering.Hclust format.
source
PortfolioOptimisers.DendroConstructMethod
DendroConstruct(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 iteration i 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 iteration i + 1 in the same format as the output from Matlab.
source
PortfolioOptimisers.DirectHbMethod
DirectHb(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-clique n belongs to bubble bi.
  • 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 bubble i to bubble j.
source
PortfolioOptimisers.FindDisjointMethod
FindDisjoint(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.
source
PortfolioOptimisers.HierarchyConstruct4sMethod
HierarchyConstruct4s(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 vertex n to the k'th discrete cluster.
  • Mv: N×Nb bubble membership matrix. Mv[n, bi] = 1 means vertex n is a vertex of bubble bi.

Outputs

  • Z: (N-1)×3 linkage matrix in the same format as the output from Matlab.
source
PortfolioOptimisers.J_LoGoMethod
J_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.
source
PortfolioOptimisers.LinkageFunctionMethod
LinkageFunction(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.
source
PortfolioOptimisers.PMFG_T2sFunction
PMFG_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, if nargout <= 3, this will be returned as an empty array.
  • cliqueTree: 4-cliques tree structure (adjacency matrix), if nargout <= 4, it is returned as an empty array.
source
PortfolioOptimisers.breadthMethod
breadth(CIJ::AbstractMatrix{<:Real}, source::Integer)

Breadth-first search.

Inputs

  • CIJ: binary (directed/undirected) connection matrix.
  • source: source vertex.

Outputs

  • distance: distance between source and i'th vertex (0 for source vertex).
  • branch: vertex that precedes i in the breadth-first search tree (-1 for source vertex).
Note

Breadth-first search tree does not contain all paths (or all shortest paths), but allows the determination of at least one path with minimum distace. The entire graph is explored, starting from source vertex source. # Colours

Original written by: Olaf Sporns, Indiana University, 2002/2007/2008

source
PortfolioOptimisers.build_link_and_dendroMethod
build_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: updated LabelVec1 for the next iteration.
source
PortfolioOptimisers.clique3Method
clique3(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.
source
PortfolioOptimisers.distance_weiMethod
distance_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.
Note

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.
Note

Based on a Matlab implementation by:

  • Mika Rubinov, UNSW/U Cambridge, 2007-2012.
  • Rick Betzel and Andrea Avena, IU, 2012
source