Re: [graph-tool] Problem extracting hierarchical blocks
Just to iterate: If I have a graph edge_list=[[0,1,1],[0,2,1],[0,3,1],[1,2,1],[1,3,1],[2,3,1],[0,4,2],[0,5,2],[0,6,2],[1,7,2],[1,8,2],[1,9,2],[2,10,2],[2,11,2],[2,12,2],[3,13,2],[3,14,2],[3,15,2],[4,5,2],[4,6,2],[5,6,2],[7,8,2],[7,9,2],[8,9,2],[10,11,2],[10,12,2],[11,12,2],[13,14,2],[13,15,2],[14,15,2]] g = Graph(directed=False) weight = g.new_edge_property('int') g.add_edge_list(edge_list, eprops=[weight]) and a nested blockmodel state = minimize_nested_blockmodel_dl(g, state_args=dict(eweight=weight)) then I can either draw the graph directly with a partition from a given level l state.project_level(l=0).draw() or store the partition in a property map group = state.project_partition(l=0, j=0) and then use this map in conventional drawing graph_draw(g, vertex_fill_color=group) Best Haiko
Thank you! On 30 Aug 2019, at 13:21, Lietz, Haiko <Haiko.Lietz@gesis.org<mailto:Haiko.Lietz@gesis.org>> wrote: Just to iterate: If I have a graph edge_list=[[0,1,1],[0,2,1],[0,3,1],[1,2,1],[1,3,1],[2,3,1],[0,4,2],[0,5,2],[0,6,2],[1,7,2],[1,8,2],[1,9,2],[2,10,2],[2,11,2],[2,12,2],[3,13,2],[3,14,2],[3,15,2],[4,5,2],[4,6,2],[5,6,2],[7,8,2],[7,9,2],[8,9,2],[10,11,2],[10,12,2],[11,12,2],[13,14,2],[13,15,2],[14,15,2]] g = Graph(directed=False) weight = g.new_edge_property('int') g.add_edge_list(edge_list, eprops=[weight]) and a nested blockmodel state = minimize_nested_blockmodel_dl(g, state_args=dict(eweight=weight)) then I can either draw the graph directly with a partition from a given level l state.project_level(l=0).draw() or store the partition in a property map group = state.project_partition(l=0, j=0) and then use this map in conventional drawing graph_draw(g, vertex_fill_color=group) Best Haiko _______________________________________________ graph-tool mailing list graph-tool@skewed.de<mailto:graph-tool@skewed.de> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.skewed.de%2Fmailman%2Flistinfo%2Fgraph-tool&data=02%7C01%7Cj.ruffle%40qmul.ac.uk%7Cf071cb89d0504bb8730508d72d449f35%7C569df091b01340e386eebd9cb9e25814%7C0%7C0%7C637027645074909230&sdata=t%2B6DUKT3bACGFZZzumqcL3XXCjzz6G9qBhEn9UM%2FsCU%3D&reserved=0
participants (2)
-
James Ruffle -
Lietz, Haiko