On 05/17/2014 04:04 PM, Joel Moberg wrote:
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 way?
Maybe a merge_blocks(blocks...) function could be useful.
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(state.bg, b=state.bg.vertex_index.copy("int"), vweight=state.wr) bstate.move_vertex(r, s) # equivalent of merging r with s Best, tiago -- Tiago de Paula Peixoto <tiago@skewed.de>