Infomap Online»

Python API »

from infomap import Infomap
im = Infomap()
im.read_file("ninetriangles.net")
im.add_link(1, 10)
im.run("--two-level --num-trials 5")
print(im.codelength)
for node in im.tree:
  if node.is_leaf:
    print(node.node_id, node.module_id)
              

Infomap 0.x »

using infomath::plogp;
for (unsigned int i = 0; i < numNodes; ++i)
{
    enter_log_enter += plogp(m_moduleFlowData[i].enterFlow);
    exit_log_exit += plogp(m_moduleFlowData[i].exitFlow);
    flow_log_flow += plogp(m_moduleFlowData[i].exitFlow + m_moduleFlowData[i].flow);
    enterFlow += m_moduleFlowData[i].enterFlow;
}
enterFlow += exitNetworkFlow;
enterFlow_log_enterFlow = plogp(enterFlow);

indexCodelength = enterFlow_log_enterFlow - enter_log_enter - exitNetworkFlow_log_exitNetworkFlow;
moduleCodelength = -exit_log_exit + flow_log_flow - nodeFlow_log_nodeFlow;
codelength = indexCodelength + moduleCodelength;
						

Partition validation »

Solution landscape »

Significance clustering »