Tree nodes and iterators¶
Walking a partition yields nodes via these iterator types. Result.tree()
and Result.leaf_modules() return them (the legacy Infomap.tree() and
friends return the same objects). Each step yields an iterator positioned at the
current node. The iterator proxies the attributes of the underlying
InfoNode (available via current()).
- class infomap.InfoNode(*args)¶
A node in the hierarchical partition tree.
The underlying node type of the tree-walking iterators on
Infomap(Infomap.tree(),Infomap.nodes(), and friends); the iterators proxy its attributes and expose it directly via theircurrent()method. Exposes the node’s ids, flow, and position in the tree as properties.- get_meta_data(dimension=0)¶
Get meta data on a specific dimension.
- property is_leaf_module¶
True if the node has children but no grandchildren.
- Returns:
Is leaf module
- Return type:
State-node iterators¶
- class infomap.InfomapIterator(*args)¶
Depth-first pre-order iterator over the full partition tree, modules and leaf nodes alike. Returned by
Infomap.tree(). Each step exposes the current node’s attributes (module_id,path,depth,flow, …) directly on the iterator.- property modular_centrality¶
Get the modular centrality of the node.
- Returns:
The modular centrality
- Return type:
- class infomap.InfomapLeafModuleIterator(*args)¶
Iterator over the leaf modules of the partition tree (modules whose children are leaf nodes). Returned by
Infomap.leaf_modules().- property modular_centrality¶
Get the modular centrality of the node.
- Returns:
The modular centrality
- Return type:
- class infomap.InfomapLeafIterator(*args)¶
Iterator over the leaf nodes of the partition tree. Returned by
Infomap.nodes().- property modular_centrality¶
Get the modular centrality of the node.
- Returns:
The modular centrality
- Return type:
Physical-node iterators¶
- class infomap.InfomapIteratorPhysical(*args)¶
Like
InfomapIterator, but aggregates state nodes belonging to the same physical node within each leaf module. Returned byInfomap.physical_tree()for memory networks.- property modular_centrality¶
Get the modular centrality of the node.
- Returns:
The modular centrality
- Return type:
- class infomap.InfomapLeafIteratorPhysical(*args)¶
Iterator over the leaf nodes of the partition tree, aggregating state nodes belonging to the same physical node within each leaf module.
- property modular_centrality¶
Get the modular centrality of the node.
- Returns:
The modular centrality
- Return type: