I have downloaded a bunch of graphs from http://users.cecs.anu.edu.au/~bdm/data/graphs.html and I want to do some analysis. I want to use the graph-tool
Python module for this but I cant find a convenient way to convert from graph6
format to a format compatible with graph-tools
. There must be an easy way to do this... any help would be appreciated.
-- EDIT: A possible solution is convert from g6 to gt format... but I haven't found any tools that do this.
The
graph6
format looks annoying to work with, but fortunately the documentation mentions a tool namedshowg
for pretty-printing graphs. It's easy to simply parse the output of that program.First, build the
showg
tool. (Useclang
orgcc
as appropriate for your system. Or just download the binary they provide on their website.)Download some example data and look at it. I think the
-e
option produces the easiest output to work with.Here's a simple script that reads the edge list from
./showg -p<N> -e
and creates agraph_tool.Graph
object:Let's give it a try: