Graph Routines#

sigmaepsilon.math.graph.utils.pseudo_peripheral_nodes(adj: csr_matrix) ndarray[source]#

Returns the indices of nodes that are possible candidates for being peripheral nodes of a graph.

Parameters:

adj (csr_matrix) – Adjacency matrix in CSR format.

Returns:

Integer array of nodal indices.

Return type:

numpy.ndarray

sigmaepsilon.math.graph.utils.rooted_level_structure(adj: csr_matrix, root: int = 0) Dict[source]#

Turns a sparse adjacency matrix into a rooted level structure.

Parameters:
  • adj (csr_matrix) – Adjacency matrix in CSR format.

  • root (int, Optional) – Index of the root node. Default is 0.

Returns:

A numba dictionary <int[:] : int[:, :]>, where the keys refer to different levels, and the values are the indices of nodes on that level.

Return type:

dict