Thanks for this awesome package! I was just hoping to clarify fairly minor observation regarding the documentation of gt.Graph
: Under option 5 it states that gt.Graph
can be instantiated with
A sparse adjacency matrix of type
scipy.sparse.sparray
orscipy.sparse.spmatrix
For a given graph g
The adjacency matrix of a graph can be obtained via graph_tool.spectral.adjacency
where the notion a adjacency matrix is also nicely and clearly defined.
To me surprisingly it seems that although both sections in the documentation use the term “adjacency matrix” the former is actually the transpose of the latter:
import graph_tool.all as gt
import scipy.sparse
import numpy as np
a = np.array([[0, 2, 1], [3, 1, 2], [0, 1, 0]])
g = gt.Graph(scipy.sparse.coo_array(a), directed=True)
adj = gt.adjacency(g, weight=g.ep.weight).toarray()
np.allclose(a, adj.T) # this is true
I have naively expected that gt.Graph
uses the same definition of adjacency matrix as graph_tool.spectral.adjacency
. Would it be possible to include a definition of “adjacency matrix” under option 5 of the documentation gt.Graph
to make clear that it is the transpose of the definition given in graph_tool.spectral.adjacency
?