You start with a pajek file, called something_pajek.net
, then you run this code.
#!/usr/bin/python # draw qick graph # input: *_pajek.net # output: *_graph.svg # imports from igraph import * from os import listdir from re import sub # reads file name def getThreadID(): dirList=listdir(".") for dirFile in dirList: if dirFile.endswith("_pajek.net"): threadID=sub("_pajek.net","",dirFile) return threadID threadID=str(getThreadID()) # read graph g=read(threadID+"_pajek.net",format="pajek") # graph settings g.vs["color"]="white" g.vs["label"]="" g.es["color"]="gray" graphStyle={} graphStyle["layout"]=g.layout("fr") graphStyle["vertex_size"]=2 graphStyle["margin"]=0 g.write_svg(threadID+"_graph.svg",**graphStyle)
You should end up with something like this.