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 way? Maybe a merge_blocks(blocks...) function could be useful.
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>
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? Best, Hu
On 05/20/2014 12:19 AM, Xiaohu Hu wrote:
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). Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
participants (3)
-
Joel Moberg -
Tiago de Paula Peixoto -
Xiaohu Hu