Skip to content

Instantly share code, notes, and snippets.

@Fkawala
Created June 7, 2016 09:19
Show Gist options
  • Save Fkawala/f7a3366a0d702163d7499ce29efec78e to your computer and use it in GitHub Desktop.
Save Fkawala/f7a3366a0d702163d7499ce29efec78e to your computer and use it in GitHub Desktop.
import graph_tool as gt
import graph_tool.topology as topology
import cProfile, pstats, StringIO
pr = cProfile.Profile()
g = gt.load_graph('graph.gt.gz')
source = 1569333
pr.enable()
topology.shortest_distance(g, source=source, weights=g.ep["length"], max_dist=2000, pred_map=True)
pr.disable()
s = StringIO.StringIO()
sortby = 'cumulative'
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.print_stats()
print s.getvalue()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment