[Networkit] Read simple edgelist

Jérôme Deschênes jeromedesch at gmail.com
Wed Nov 25 22:34:38 CET 2015


Thank you very much to all of you.

I thought as well that this module should be in distance (in my message).

Anyway, I am able to do what I want with NetworkX. I was just expecting
NetworKit to have a simpler (at least more efficient) way to do it.

Just for your information, it looks like this :

import networkx as nx
from multiprocessing.dummy import Pool as TPool
import numpy as np
import csv

with open('list_of_many_desired_distances.txt') as f:
    reader = csv.reader(f, delimiter=' ')
    your_list = list(reader)

g=nx.read_edgelist("mygraph.txt")

def test(x):
    j=your_list[x][0]
    k=your_list[x][1]
    return nx.shortest_path_length(g,j,k)

l= list(range(len(your_list)))

pool = TPool(processes=32)
results = pool.map(test, l)
pool.close()
pool.join()

b5=np.insert(np.asarray(your_list),2,np.asarray(results),axis=1)
np.savetxt("myresults.txt", b5, delimiter=",")




2015-11-25 16:20 GMT-05:00 Christian Staudt <christian.staudt at kit.edu>:

>
>
> > On 25 Nov 2015, at 15:13, Maximilian Vogel <
> maximilian.vogel at student.kit.edu> wrote:
> >
> > I was about to mention APSP as well. Under Python it can be found under
> dynamic.APSP (for whatever reason it is placed there...).
>
> It really doesn't belong there, and neither in 'graph'. I suggest to put
> it into the 'distance' module.
> _______________________________________________
> NetworKit mailing list
> NetworKit at ira.uni-karlsruhe.de
> https://lists.ira.uni-karlsruhe.de/mailman/listinfo/networkit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20151125/f08c2dfd/attachment-0001.html>


More information about the NetworKit mailing list