aryagraph.algorithms.matrix.adjacency_matrix#

aryagraph.algorithms.matrix.adjacency_matrix(g: ~typing.Any, weight: str | ~typing.Callable[[~typing.Hashable, ~typing.Hashable, dict], float] | None = 'weight', *, nodes: list[~typing.Hashable] | None = None, dtype: ~typing.Any = <class 'float'>) → ndarray[source]#

Dense adjacency matrix A[i, j] = weight of edge nodes[i] → nodes[j].

Undirected graphs give a symmetric matrix. Edges without the weight attribute count as 1; weight=None gives a 0/1 matrix.