Thanks for the answer. I tried to include the code of the adjacency method into my program but it doens’t find libgraph_tool_spectral I don’t understand the __future__, .., etc. imports, how can I simply add libgraph_tool_spectral to my code so that I can calculate the adjacency matrix? Thanks in advance
Le 16 nov. 2015 à 00:09, Tiago de Paula Peixoto <tiago@skewed.de> a écrit :
On 15.11.2015 23:43, Yannis Haralambous wrote:
I noticed that the adjacency matrix is used in several centrality measures implemented in graph-tool. Is there some way to access this adjacency matrix directly or do I have to write a loop over the edges to fill an 0 initialized matrix with 1s?
As is stated in the documentation, the internal representation used in graph-tool is an adjacency list, not an adjacency matrix. An adjacency matrix would require O(N^2) space, and hence it would be very wasteful (and slow) for large sparse graphs. The adjacency matrix is referenced in the centrality documentation purely for convenience of notation.
You can get a copy of the graph as a sparse adjacency matrix via the function:
https://graph-tool.skewed.de/static/doc/spectral.html#graph_tool.spectral.ad...
Best, Tiago
-- Tiago de Paula Peixoto <tiago@skewed.de>
_______________________________________________ graph-tool mailing list graph-tool@skewed.de http://lists.skewed.de/mailman/listinfo/graph-tool
-- ------------------------------------------------------- Yannis Haralambous Professor Institut Mines-Télécom, Télécom Bretagne Computer Science Department UMR CNRS 6285 Lab-STICC Technopôle Brest Iroise CS 83818, 29238 Brest Cedex 3, France Email: yannis.haralambous@telecom-bretagne.eu Internet: http://perso.telecom-bretagne.eu/yannisharalambous/ ICBM address: 48°21'31.57"N 4°34'16.76"W Twitter: y_haralambous ------------------------------------------------------- ...the ball I threw while playing in the park has not yet reached the ground (Dylan Thomas) Es gab eine Zeit, wo ich nur ungern über Schubert sprechen, nur Nächtens den Bäumen und Sternen von ihm vorerzählen mögen. (Robert Schumann)