Transform#

Methods to lift a graph to a cell complex.

toponetx.transform.graph_to_cell_complex.homology_cycle_cell_complex(G) CellComplex[source]#

Get the cell complex obtained by adding homology cycles of a graph.

Parameters:
Gnetworkx graph

Input graph.

Returns:
CellComplex

The cell complex obtained by adding the homology cycles of the graph.

Methods to lift a graph to a simplicial complex.

toponetx.transform.graph_to_simplicial_complex.graph_to_clique_complex(G: Graph, max_rank: int | None = None) SimplicialComplex[source]#

Get the clique complex of a graph.

Parameters:
Gnetworks.Graph

Input graph.

max_rankint, optional

The maximum rank of the simplices in the output clique complex.

Returns:
SimplicialComplex

The clique simplicial complex of rank max_rank of the graph G.

toponetx.transform.graph_to_simplicial_complex.graph_to_neighbor_complex(G: Graph) SimplicialComplex[source]#

Get the neighbor complex of a graph.

Parameters:
Gnetworkx.Graph

Input graph.

Returns:
toponetx.classes.SimplicialComplex

The neighbor complex of the graph.

Notes

This type of simplicial complexes can have very large dimension (max degree of the graph) and it is a function of the distribution of the valency of the graph.

toponetx.transform.graph_to_simplicial_complex.weighted_graph_to_vietoris_rips_complex(G: Graph, r: float, max_dim: int | None = None)[source]#

Get the Vietoris-Rips complex of radius r of a weighted undirected graph.

The Vietoris-Rips complex of radius r is the clique complex given by the cliques of G whose nodes have pairwise distances less or equal than r. All vertices are added to the Vietoris-Rips complex regardless of the radius introduced.

If G is a clique weighted by a dissimilarity function d that satisfies max_v d(v, v) <= min d(u,v) for u != v, and r >= d(v, v) for all nodes v, then the Vietoris-Rips complex of radius r is the usual Vietoris-Rips abstract simplicial complex of radius r for point clouds with dissimilarities.

Parameters:
Gnetworkx.Graph

Weighted undirected input graph. The weights of the edges must be in the attribute ‘weight’.

rfloat

The radius for the Vietoris-Rips simplicial complex computation.

max_dimint, optional

The max dimension of the cliques in the output clique complex.

Returns:
SimplicialComplex

The Vietoris-Rips simplicial complex of dimension max_dim of the graph G.