Bipartite networks¶
Flow model
At a glance
A bipartite network has two node types with links only between them. Declare
the boundary with bipartite_start_id and Infomap models the alternating
random walk directly, returning modules that mix both node types.
Two node types, links between them¶
Many networks connect two distinct kinds of entities: users rating movies, species visiting flowers, authors writing papers. Links go exclusively between the two types, never within them. This is a bipartite network.
A common workaround is to project one type onto the other, replacing user–item links with user–user links whenever two users share an item. The projection densifies the network and conflates distinct interaction patterns into weighted cliques. Running Infomap on the bipartite network itself avoids that loss: the walk alternates between the types, and the communities keep both types together.
How Infomap handles the two types¶
You assign integer node ids so that all type-A nodes come first and all
type-B nodes start at a threshold id, and declare that threshold by setting
bipartite_start_id. Infomap then models the alternating walk with a
two-step encoding: each move A → B → A counts as one step between type-A
nodes, and by default the type-B nodes’ visit rates are folded onto the
type-A side. The codelength therefore describes the flow among the type-A
nodes, with the type-B nodes acting as the contexts that route it. Both
types still receive module assignments.
Which type goes first?
Put the nodes whose communities you care about below the threshold: their
flow is what the code describes. If you also write native output files with
the stateful Infomap, hide_bipartite_nodes=True drops the
other type from those files (it does not filter the in-memory
Result).
Two options change this treatment: skip_adjust_bipartite_flow=True keeps
flow on the type-B nodes so both types are coded, and
bipartite_teleportation=True makes a directed run teleport with
bipartite-aware jumps instead of the default two-step unipartite scheme.
API pointers¶
infomap.Infomap.bipartite_start_iddeclares the first node id of the second type: assignim.bipartite_start_id = nand every node with id>= nis a right node, ids below are left nodes. Set it beforerun().infomap.Network.bipartite_start_idis the same property on aNetwork.infomap.Network.add_link()adds a weighted edge between any two node ids; for bipartite networks the source and target should be opposite types.infomap.Result.modules()returns a{node_id: module_id}dict covering both types.The option
hide_bipartite_nodes=Trueomits right-type nodes from written output files (.tree,.clu, …), which helps when only the left-type assignments matter (projecting a user partition, say). It does not filterinfomap.Result.modules(), which always covers both types.
Options¶
Option |
Where |
Effect |
|---|---|---|
|
|
First node id of the second type; declares the network bipartite |
|
|
Omit the second-type nodes from written output files (the in-memory result keeps both types) |
|
Keep flow on the second-type nodes instead of folding it onto the first type |
|
|
On directed runs, teleport with bipartite-aware jumps instead of the two-step unipartite scheme |
Going deeper¶
Blöcker and Rosvall [2020] analyse coding schemes that use the node-type information explicitly, giving each module separate codebooks per type, and quantify the compression gains across 21 real bipartite networks.
The survey (§6.2) covers bipartite networks [Smiljanić et al., 2026]; its companion notebook
examples/notebooks/6.2 Bipartite Networks.ipynbapplies both coding schemes to a real weighted plant–ant web (Fonseca & Ganade 1996).