I am new to graphtool but super excited by what I have implemented so far. I have a question however about the speed of the all_neighbors method.
From trying it on various machines, it seems that it takes around 0.01s for v.all_neighbors() where v is an arbitrary vertex. I have tried this on a 4 node graph and a 2M node graph getting the same result. Has anyone else found the same thing? It seems to me to be particularly slow. Storing a graph as an adjacency list in a hashtable should have microsecond look up time, I assumed graph-tool stored the graph in such a way but I haven't yet come across the place where the architecture it is described.
At any rate, am I doing something wrong or is 0.01s the expected look up time? I am trying to build a list of "friends of friends" on a graph of around 2M nodes 200M edges, so if all_neighbors takes 0.01s, then to get "friends of friends" takes about 1s for each node....which prohibits traversing the graph in this way in a reasonable time Nk -- Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/
On 11.02.2018 18:41, Howmahgee wrote:
From trying it on various machines, it seems that it takes around 0.01s for v.all_neighbors() where v is an arbitrary vertex.
In [2]: %timeit v.all_neighbors() 263 ns ± 1.4 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each) So, not quite. As usual, without a minimal self-contained example of what you are doing, it is impossible to give any concrete help. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
yes, sorry for the lack of detail. Indeed, the issue was my method of timing start=time.time() v.all_neighbors() print(time.time()-start) there is overhead with the print statement, I suspect it is in converting the decimal. thanks for your help! -- Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/
participants (2)
-
Howmahgee -
Tiago de Paula Peixoto