Merging blocks in BlockState

I want to implement a new community detection algorithm, like
multilevel_minimize this is an agglomerative algorithm that will merge
blocks. I now wonder whats a good way to merge whole blocks, I can move
vertices between blocks with move_vertex to do this but is there a better

Maybe a merge_blocks(blocks...) function could be useful.

attachment.html (387 Bytes)

A very simple way to merge blocks is to construct the block graph, where
the nodes are the weighted groups, and then you can move these nodes,
which would be the equivalent of a merge. I.e.:

      state = BlockState(g, b=b)
      bstate = BlockState(,"int"),
      bstate.move_vertex(r, s) # equivalent of merging r with s


Hi all,

I am trying to perform a renormalization on on my graph to test its
self-similarity, as described in the paper by Song et al. Nature 334,
392 (2005).

I have a code which assigns all vertices into different boxes, as next,
I would like to merge all vertices in each box into a single, new vertex
in order to get the re-normalized graph.

My question: Is there better way to do it than manually re-define the
whole graph? i.e. remove all vertices in a box and then re-introduce a
new vertex? Is there a merge function for that maybe?



I don't think there is a better way, and there is no such function
implemented in graph-tool (but it should be straightforward for you to
write one).