Relative Content

Tag Archive for pythonalgorithmgraphgraph-tool

How to reorder the vertices of a graph in graph-tool – efficiently?

I use graph-tool (I love it for its sheer speed) with python as a basis for developing and running own graph algorithms. Sometimes I want to reorder the vertices of the graph, i.e. the indices of the vertices, like swapping vertex indices, without changing the topology of the graph. This doesn’t seem to be a standard operation in graph-tool and I’m wondering if I’m using it the wrong way or simply overlooked a fast way to do reorderings. So far, I found two ways to reorder graphs in graph-tool: