Get partitions from NestedBlockState
the get_bs() method for a NestedBlockState object returns a list of array objects. In many cases it would be very convenient to also get a list of vertex property maps where each list item is a property map for a non-trivial level of the NestedBlockState. Would you consider adding such a method?
I am using this one -- feel free to use or edit it (I'm also curious how you would implement this):
def NestedBlockState_get_partitions(state): ''' Description: Returns the partition of building blocks per level given a nested blockmodel. Inputs: state: Nested blockmodel (graph-tool NestedBlockState object). Output: partitions: List of partitions (graph-tool property maps) with as many partitions as the hierarchy is deep. ''' levels = state.get_levels() depth = 0 for s in levels: depth += 1 if s.get_N() == 1: break partitions =  for level in range(len(levels)-(depth-1), len(levels)): partition =  for v in range(state.g.num_vertices()): r = levels.get_blocks()[v] l = 1 while l < len(levels)-level: r = levels[l].get_blocks()[r] l += 1 partition.append(r) vp_partition = state.g.new_vertex_property('int') vp_partition.a = partition partitions.append(vp_partition) return partitions