pyflagser
.flagser_count_weighted¶

pyflagser.
flagser_count_weighted
(adjacency_matrix, max_edge_weight=None, directed=True)¶ Compute the cell count per dimension of a directed/undirected filtered flag complex.
From an adjacency matrix construct a filtered flag complex as a sequence of its cells associated to their filtration values and compute the number of cells per dimension at the end of the filtration.
 Parameters
 adjacency_matrix2d ndarray or scipy.sparse matrix, required
Matrix representation of a directed/undirected weighted graph. Diagonal elements are vertex weights. The way zero values are handled depends on the format of the matrix. If the matrix is a dense
numpy.ndarray
, zero values denote zeroweighted edges. If the matrix is a sparsescipy.sparse
matrix, explicitly stored offdiagonal zeros and all diagonal zeros denote zeroweighted edges. Offdiagonal values that have not been explicitely stored are treated byscipy.sparse
as zeros but will be understood as infinitelyvalued edges, i.e., edges absent from the filtration. max_edge_weightint or float or
None
, optional, default:None
Maximum edge weight to be considered in the filtration. All edge weights greater than that value will be considered as infinitelyvalued, i.e., absent from the filtration. If
None
, all finite edge weights are considered. directedbool, optional, default:
True
If
True
, computes persistent homology for the directed filtered flag complex determined by adjacency_matrix. IfFalse
, computes persistent homology for the undirected filtered flag complex obtained by considering all weighted edges as undirected, and if two directed edges corresponding to the same undirected edge are explicitly assigned different weights and neither exceeds max_edge_weight, only the one in the upper triangular part of the adjacency matrix is considered. Therefore:if max_edge_weight is
numpy.inf
, it is sufficient to pass a (dense or sparse) uppertriangular matrix;if max_edge_weight is finite, it is recommended to pass either a symmetric dense matrix, or a sparse uppertriangular matrix.
 Returns
 outlist of int
Cell counts (number of simplices) at filtration value max_edge_weight, per dimension.
Notes
The input graphs cannot contain selfloops, i.e. edges that start and end in the same vertex, therefore diagonal elements of the input adjacency matrix store vertex weights.
References
 1
D. Luetgehetmann, “Documentation of the C++ flagser library”; GitHub: luetge/flagser.