pyflagser.flagser_count_unweighted(adjacency_matrix, min_dimension=0, max_dimension=inf, directed=True)

Compute the cell count per dimension of a directed/undirected unweighted flag complex.

From an adjacency matrix construct all cells forming its associated flag complex and compute their number per dimension.

adjacency_matrix2d ndarray or scipy.sparse matrix of shape (n_vertices, n_vertices), required

Adjacency matrix of a directed/undirected unweighted graph. It is understood as a boolean matrix. Off-diagonal, 0 or False values denote abstent edges while non-0 or True values denote edges which are present. Diagonal values are ignored.

directedbool, optional, default: True

If True, computes homology for the directed flad complex determined by adjacency_matrix. If False, computes homology for the undirected flag complex obtained by considering all edges as undirected, and it is therefore sufficient (but not necessary) to pass an upper-triangular matrix.

outlist of int

Cell counts (number of simplices), per dimension greater than or equal to min_dimension and less than max_dimension.


The input graphs cannot contain self-loops, i.e. edges that start and end in the same vertex, therefore diagonal elements of the input adjacency matrix will be ignored.



D. Luetgehetmann, “Documentation of the C++ flagser library”; GitHub: luetge/flagser.