pyflagser.load_unweighted_flag(fname, fmt='csr', dtype=<class 'bool'>)

Load a .flag file and return the adjacency matrix of the directed/undirected unweighted graph it describes.

fnamefile, str, or pathlib.Path, required

Filename of extension .flag containing the information of a flag matrix.

fmt{‘dense’, ‘dia’, ‘csr’, ‘csc’, ‘lil’, …}, optional, default: 'csr'

Matrix format of the result. By default, a CSR sparse matrix is returned. Keep in mind that some matrix formats do not track zero values.

dtypedata-type, optional, default: np.bool

Data-type of the resulting array.

adjacency_matrixmatrix of shape (n_vertices, n_vertices) and format fmt

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.


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.