hiperwalk.WeightedGraph.adjacency_matrix#

WeightedGraph.adjacency_matrix()[source]#

Return the graph’s adjacency matrix.

Returns:
scipy.sparse.csr_array.

Notes

In a weightless graph \(G(V, E)\) with \(n\) vertices \(v_0, \ldots, v_{n-1}\), the adjacency matrix of \(G(V, E)\) is an \(n\)-dimensional matrix \(A\), defined as follows:

\[\begin{split}A_{i,j} = \begin{cases} 1, & \text{if } v_i \text{ is adjacent to } v_j,\\ 0, & \text{otherwise.} \end{cases}\end{split}\]

In weighted graphs, the entries of \(A\) represent the weights of the edges. The weight is a non-zero real number.

Todo

Add other return types depending on the stored matrix type.