hiperwalk.WeightedGraph#

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

Construct an arbitrary weighted graph.

This class enables the creation of a weighted graph, defined by a Hermitian adjacency matrix that represents the connections between nodes and edge weights.

Parameters:
adj_matrixvarious types accepted

The adjacency matrix of the graph, which must be a Hermitian matrix. Two types of input are accepted:

copybool, default=False

Determines how the adjacency matrix is stored:

  • If True, a deep copy of adj_matrix is created and stored.

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

Raises:
TypeError

If adj_matrix is not a square matrix, indicating it cannot represent a valid adjacency matrix.

Notes

When defining an instance of the Coined class on a weighted graph, the edge weights do not affect the simulation.

When defining an instance of the ContinuousTime class on a weighted graph, the edge weights do affect the simulation.

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

Methods

adjacency_matrix([copy])

Return the adjacency matrix representation of the graph.

adjacent(u, v)

Return True if vertex u is adjacent to v.

degree(vertex)

Return the degree of the given vertex.

is_simple()

Return True if the graph has no multiedges or weights.

laplacian_matrix()

Return the graph's Laplacian matrix.

neighbors(vertex)

Return all neighbors of the given vertex.

number_of_edges()

Return the total number of edges in the graph.

number_of_loops()

Return the number of loops in the graph.

number_of_vertices()

Return the total number of vertices in the graph.

vertex_number(vertex)

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