I was wondering what the best way to compute the transitive closure of an undirected graph in the python library graph_tool is.
My solution so far is to create a directed graph from the original one and use the transitive_closure method on that:
import graph_tool as gt, graph_tool.topology as gtt
symm = gt.Graph(g)
symm.set_directed(True)
symm.add_edge_list([(b, a) for (a, b) in g.edges()])
tc = gtt.transitive_closure(symm)
tc.set_directed(False)
Surely there must be a better and more efficient way to do this?