class hiperwalk.Multigraph(adj_matrix, copy=False)[source]#

Construct an arbitrary multigraph.

This class facilitates the creation of a multigraph, in which multiple edges between the same pair of vertices are allowed. The graph’s structure is determined by a Hermitian adjacency matrix, the entries of which are non-negative integers that represent the number of multiple edges between vertices. The multigraph also supports loops, which are considered arcs.

adj_matrixvarious types accepted

The adjacency matrix of the graph, which must be a Hermitian matrix with non-negative integer entries. Acceptable input types include:

copybool, default=False

Specifies whether to store a hard copy of adj_matrix:

  • If True, a deep copy of the adjacency matrix is created and stored.

  • If False, a reference to the original adj_matrix is stored.


If adj_matrix is not a square matrix.


The adj_matrix.data attribute may be modified for more efficient manipulation. If the original matrix data is required, it is recommended to initialize the constructor with copy=True. Alternatively, the original matrix can be retrieved anytime by calling adjacency_matrix() after the multigraph has been created.

When defining an instance of the Coined class on a multigraph, the number of multiple edges impacts the dimension of the coin.

When defining an instance of the ContinuousTime class on a multigraph, the number of multiple edges is treated as an edge weight.

__init__(adj_matrix, copy=False)[source]#



Return the adjacency matrix representation of the graph.

adjacent(u, v)

Return True if vertex u is adjacent to v.


Return the degree of the given vertex.


Return False.


Return the graph's Laplacian matrix.


Return all neighbors of the given vertex.

number_of_edges([u, v])

Return number of edges.


Return the number of loops in the graph.


Return the total number of vertices in the graph.


Return the numerical label of a vertex based on its representation.