Statistics
| Branch: | Revision:

nepatest_popbabel / scripts / convertToEdgelist.py @ 60ba786f

History | View | Annotate | Download (452 Bytes)

1 60ba786f LoreBz
import os
2
import glob
3
import sys
4
import networkx as nx
5
import shutil
6
7
folder=sys.argv[1]
8
if os.path.exists(folder+"temp"):
9
    shutil.rmtree(folder+"temp")
10
os.makedirs(folder+"temp")
11
out=folder+"temp/"
12
13
for gr in glob.glob(folder+"*.graphml"):
14
    name=gr.split("/")[-1].replace(".graphml","")
15
    print name,"..."
16
    g = nx.Graph(nx.read_graphml(gr))
17
    G = nx.convert_node_labels_to_integers(g)  
18
    nx.write_weighted_edgelist(G,out+name+".edges")