Am 19.06.2018 um 21:01 schrieb Alexandre Hannud Abdo: > Ni! Hi Philipp, > > Yes, there are more straightforward paths to the same information: > > # get some graph and model it > import graph_tool.all as gt > g = gt.collection.data["celegansneural"] > s = gt.minimize_nested_blockmodel_dl(g) > > # get your groups of vertices in a dictionary > l0 = s.levels[0] > block2vertices = dict() > for i in range(l0.B): > block2vertices[i] = gt.find_vertex(l0.g, l0.b, i)
Since find_vertex() is O(N), the above is O(B * N). A faster O(N) approach is simply: groups = defaultdict(list) for v in g.vertices(): groups[l0.b[v]].append(v) Best, Tiago -- Tiago de Paula Peixoto <[email protected]> _______________________________________________ graph-tool mailing list [email protected] https://lists.skewed.de/mailman/listinfo/graph-tool
