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.adjacency

Best,
Tiago

-- 
Tiago de Paula Peixoto <[email protected]>

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
graph-tool mailing list
[email protected]
http://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to