Deprecation policy¶
Infomap’s Python API follows a predictable deprecation contract so you can rely on it across releases. Nothing listed here leaves before 3.0; until then the old spelling keeps working. The reference docs mark each deprecated name with the release that deprecated it.
Signature tiers¶
The keyword arguments on Infomap and Infomap.run() are split into
two tiers:
Common tier — the handful of options most runs touch (
seed,num_trials,two_level,directed,markov_time). These stay on theInfomapsignatures.Advanced tier — the long tail of tuning and I/O options. From 2.15 they carry a versioned note on the
Infomapsignatures and leave those signatures in 3.0. Most are tuning options that stay available — only their entry point moves, marked.. versionchanged:: 2.15. Pass them throughOptionsinstead:import infomap options = infomap.Options(regularized=True, flow_tolerance=1e-12) result = infomap.run("network.net", options=options)
The same
Optionsobject works withNetwork.run(). A few advanced options migrate elsewhere rather than toOptions, and each keyword’s.. deprecated::note states its own path:The file-output options (
no_file_output,tree,clu,out_name, …) move to theResult.write_*/Network.write_*methods.silentandverbosity_levelgive way to logging (see Running Infomap).num_threadsreplacesthreads.print_config_fingerprintis a CLI-only diagnostic with no library replacement.
Passing an advanced-tier keyword to Infomap or Infomap.run()
emits a DeprecationWarning, shown by default when the calling code runs
as a script (__main__, per PEP 565) and surfaced everywhere else by
python -W or a warning-escalating tool. Routing the option through
Options is the warning-free path, so existing code keeps running
unchanged until 3.0.
Redesigned result access¶
The stateful accessors on Infomap (get_modules, codelength,
num_top_modules, and friends) are .. deprecated:: 2.15 in favour of the
immutable Result that run() and Infomap.run() return.
Reading one from user code emits the same DeprecationWarning as the
advanced-tier keywords. Read scalars
as properties (result.codelength) and collections as methods
(result.modules(), result.nodes(), result.tree()). See
Reading the result.
The tree-level selector¶
From 2.16 the Result readers and write_clu select a level of the
hierarchy with level (1 is the top, coarsest level; -1 the bottom):
result.modules(level=2)
result.to_dataframe(level=-1)
result.write_clu("bottom.clu", level=-1)
depth was the selector through 2.15, but the same word is
TreeNode.depth, a node’s distance from the root, so
result.nodes(depth=1) yielded nodes whose .depth is 2. depth
and the older depth_level keep working as aliases through 2.x and emit the
legacy tier’s DeprecationWarning; they leave in 3.0. On the same
grounds Result.max_depth is a deprecated alias of
Result.num_levels.
Compatibility aliases¶
On the graph constructors and finders,
node_idandlayer_idwere the attribute names to read ids from, whilenode_idson the matrix constructors was a sequence of labels – two unrelated parameters that read as singular and plural of one. From 2.16 the attribute names arenode_id_attribute/layer_id_attribute(the*_attributespellingmeta_attributealready uses) and the label sequence isnode_labels, onNetwork.from_networkx(),Network.from_igraph(),Network.from_scipy_sparse_matrix(),Network.from_edge_index(),find_communities()andfind_igraph_communities(). The old spellings keep working, emit the legacy tier’sDeprecationWarning, and leave in 3.0.annotate_networkx_graphandannotate_igraph_graphare the pre-2.16 spellings ofinfomap.io.export.annotate_networkx()andinfomap.io.export.annotate_igraph()– the_graphsuffix thatto_networkx/from_networkxnever carried. Same arguments; the long names emit the legacy tier’sDeprecationWarningand leave in 3.0.include_self_linksis a deprecated alias kept for backward compatibility. Infomap includes self-links by default. Passno_self_links=Trueto exclude them. Passinginclude_self_linksexplicitly emits aFutureWarning– the louder tier, shown under every filter, because an argument you actually typed is being ignored.prettyis a deprecated no-op — the API accepts it for backward compatibility but it has no effect. Passing it explicitly emits aFutureWarning, for the same reason asinclude_self_links.
Error base classes¶
infomap.merge.MergeError derives from InfomapError since 2.16,
so except InfomapError catches shard-merge failures too; it derived from
plain Exception before. except MergeError keeps working.
Through 2.x, InfomapError inherits RuntimeError, and
NotRunError also keeps ValueError in its MRO. Pre-taxonomy
except RuntimeError / except ValueError code therefore keeps working.
These legacy bases detach in 3.0 — catch InfomapError (or a subclass)
instead. See Errors.