14, Selventa. All Rights Reserved. Scalable Networks with Graph-tool April 2014
© 2014, Selventa. All Rights Reserved. 4
What is graph-tool?
• A Python library– E.g.:
>>> g = Graph(directed=False)
• Innards written in C/C++– Efficient use of memory– Excellent speed on consumer-grade hardware– Leverages multi-core capabilities through OpenMP
• Features– Lots of built-in algorithms (50+)– Does input/output in GraphML, Graphviz DOT, and GML– Allow “on-the-fly” filtering of graph components
© 2014, Selventa. All Rights Reserved. 6
How does it compare?
• Using the BEL large corpus for reference– 100k vertices– 160k edges
• In Java…– Using the popular TinkerPop graph stack– 360 MB is used
• In Python…– Using graph-tool– 55 MB is used
© 2014, Selventa. All Rights Reserved. 7
Filtering Example
• “On-the-fly” filtering of graphs is easy!– E.g.:
>>> vfilter = g.new_vertex_filter(’bool’)>>> for v in g.vertices():... # include vertex ‘v’... vfilter[v] = True... # alternatively, exclude with False...>>> g.set_vertex_filter(vfilter)>>> # clear previous filter>>> g.set_vertex_filter(None)