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:
- Matrix formats such as:
List of lists.
networkx.Graph
:The adjacency matrix is derived from the provided NetworkX graph.
- copybool, default=False
Determines how the adjacency matrix is stored:
If
True
, a deep copy ofadj_matrix
is created and stored.If
False
, a reference to the originaladj_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.
Methods
adjacency_matrix
([copy])Return the adjacency matrix representation of the graph.
adjacent
(u, v)Return True if vertex
u
is adjacent tov
.degree
(vertex)Return the degree of the given vertex.
Return True if the graph has no multiedges or weights.
Return the graph's Laplacian matrix.
neighbors
(vertex)Return all neighbors of the given vertex.
Return the total number of edges in the graph.
Return the number of loops in the graph.
Return the total number of vertices in the graph.
vertex_number
(vertex)Return the numerical label of a vertex based on its representation.