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 engine options change this treatment, passed via
Options (e.g. run(net, options=Options(skip_adjust_bipartite_flow=True))):
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¶
Declare the split by setting bipartite_start_id (or
bipartite_start_id) before running, and link opposite
types with add_link(); modules()
covers both types. The bipartite engine options (hide_bipartite_nodes,
skip_adjust_bipartite_flow, bipartite_teleportation) are in the Options
table below.
Options¶
Option |
Where |
Effect |
|---|---|---|
|
|
First node id of the type-B block (the second type); declares the network bipartite |
|
|
Omit the type-B nodes from written output files (the in-memory result keeps both types) |
|
Keep flow on the type-B nodes instead of folding it onto type-A |
|
|
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).