Hi Tiago, I looked at the example in the document here https://graph-tool.skewed.de/static/doc/demos/inference/inference.html#sampl... <https://graph-tool.skewed.de/static/doc/demos/inference/inference.html#sampling-from-the-posterior-distribution> . As the example shows, we can obtain vertex marginals on all hierarchical levels, i.e. a "vertex_pie_fractions" at each level for each node. However, I want to find the node partition at each level for each node according to the *largest* "vertex_pie_fraction". Therefore, I use the following code # Hierarchical node partition as a list of np.array bs = [np.array([np.argmax(list(pv[i])[j]) for j in range(len(list(pv[i])))]) for i in range(len(pv))] where pv is exactly the one shown in the example. I believe the above line of code is correct since I have checked the results in several real networks with small sizes (around 200 nodes and 500 edges at most). But it will take a quite a long time for a large network (30k nodes with 400k edges or more). Is there any efficient way to do the above work? Best, Alex -- Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/