The function graph_tool.spectral.adjacency<http://graph-tool.skewed.de/static/doc/spectral.html?highlight=adjacency#graph_tool.spectral.adjacency> returns transpose of the adjacency matrix of a directed graph that is commonly used. Is this intentional? A misinterpretation of column-major versus row-major on my part?
Compare a few standard examples:
with the output of gt.adjacency():
import graph_tool.all as gt
g = gt.Graph()
v0 = g.add_vertex()
v1 = g.add_vertex()
e01 = g.add_edge(v0,v1)
A = gt.adjacency(g)
[e for e in g.edges()]
## -- End pasted text --
Out: [<Edge object with source '0' and target '1' at 0x11fb10d60>]
matrix([[ 0., 0.],
[ 1., 0.]])
A in this case is most commonly defined as [[0, 1], [0, 0]]
attachment.html (1.91 KB)
It is true that most software and some websites use the more intuitive
definition that you were expecting. However a large part of the
theoretical literature uses the transposed definition, since it can be
more convenient mathematically. See for instance Mark Newman's book.
In any case, this an unimportant issue. A matrix transpose can be
obtained trivially in numpy.
It is true that most software and some websites use the more intuitive definition that you were expecting. However a large part of the theoretical literature uses the transposed definition, since it can be more convenient mathematically. See for instance Mark Newman's book.
I know — I use Godsil and Royle, who use the “correct” untransposed version in Algebraic Graph Theory ;o)
Because you cite the Wikipedia definition in your excellent documentation, I’d suggest documenting the convention you use explicitly, which is the transpose of Wiki’s (current) definition.
attachment.html (1001 Bytes)
That makes sense. I also noticed that the documentation of the other
spectral functions were inconsistent with this definition. I have fixed