Options and multilayer inputs

class infomap.InfomapOptions(include_self_links: bool | None = None, skip_adjust_bipartite_flow: bool = False, bipartite_teleportation: bool = False, weight_threshold: float | None = None, no_self_links: bool = False, node_limit: int | None = None, matchable_multilayer_ids: int | None = None, cluster_data: str | None = None, assign_to_neighbouring_module: bool = False, meta_data: str | None = None, meta_data_rate: float = 1.0, meta_data_unweighted: bool = False, no_infomap: bool = False, out_name: str | None = None, no_file_output: bool = False, tree: bool = False, ftree: bool = False, clu: bool = False, clu_level: int | None = None, output: list[str] | tuple[str, ...] | None = None, hide_bipartite_nodes: bool = False, print_all_trials: bool = False, verbosity_level: int = 1, silent: bool = False, pretty: bool = False, two_level: bool = False, flow_model: str | None = None, directed: bool | None = None, recorded_teleportation: bool = False, use_node_weights_as_flow: bool = False, to_nodes: bool = False, teleportation_probability: float = 0.15, regularized: bool = False, regularization_strength: float = 1.0, entropy_corrected: bool = False, entropy_correction_strength: float = 1.0, markov_time: float = 1.0, variable_markov_time: bool = False, variable_markov_damping: float = 1.0, variable_markov_min_scale: float = 1.0, preferred_number_of_modules: int | None = None, multilayer_relax_rate: float = 0.15, multilayer_relax_limit: int = -1, multilayer_relax_limit_up: int = -1, multilayer_relax_limit_down: int = -1, multilayer_relax_by_jsd: bool = False, seed: int = 123, num_trials: int = 1, core_loop_limit: int = 10, core_level_limit: int | None = None, tune_iteration_limit: int | None = None, core_loop_codelength_threshold: float = 1e-10, tune_iteration_relative_threshold: float = 1e-05, fast_hierarchical_solution: int | None = None, inner_parallelization: bool = False, prefer_modular_solution: bool = False, num_random_moves: int | None = None, max_degree_for_random_moves: int | None = None)

Reusable Infomap keyword options.

This class mirrors the keyword arguments accepted by infomap.Infomap and infomap.Infomap.run(). Use to_args() to render command-line flags, from_mapping() to construct options from existing keyword dicts, or the convenience methods infomap.Infomap.from_options() and infomap.Infomap.run_with_options() to apply a reusable configuration.

Parameters:
  • skip_adjust_bipartite_flow (bool, optional) – Keep flow on bipartite nodes instead of distributing it to primary nodes.

  • bipartite_teleportation (bool, optional) – Use bipartite teleportation instead of the default two-step unipartite teleportation.

  • weight_threshold (float, optional) – Ignore input links with weight below this threshold.

  • no_self_links (bool, optional) – Exclude self-links from the input network.

  • node_limit (int, optional) – Read only nodes up to this node id and ignore links connected to higher node ids.

  • matchable_multilayer_ids (int, optional) – Construct state ids from node ids and layer ids that stay comparable across networks. Set at least to the largest layer id among networks to match.

  • cluster_data (str, optional) – Read an initial partition from a clu file or a hierarchy from a tree/ftree file. Tree input may use physical or state nodes for higher-order networks.

  • assign_to_neighbouring_module (bool, optional) – With –cluster-data, assign nodes missing module ids to a neighboring node’s module when possible.

  • meta_data (str, optional) – Read metadata to encode from a clu-format file.

  • meta_data_rate (float, optional) – With –meta-data, set the metadata encoding rate. The default encodes metadata at each step.

  • meta_data_unweighted (bool, optional) – With –meta-data, encode metadata without weighting by node flow.

  • no_infomap (bool, optional) – Skip optimization. Use this to calculate codelength for –cluster-data or to print non-modular statistics.

  • out_name (str, optional) – Base name for output files, for example [out_directory]/[out-name].tree.

  • no_file_output (bool, optional) – Do not write output files.

  • tree (bool, optional) – Write the modular hierarchy to a tree file. Enabled by default when no other output format is selected.

  • ftree (bool, optional) – Write the modular hierarchy and aggregated links between nested modules to an ftree file. Used by Network Navigator.

  • clu (bool, optional) – Write top-level module ids for each node to a clu file.

  • clu_level (int, optional) – With –clu or –output clu, write module ids at this depth from the root. Use -1 for bottom-level modules.

  • output (sequence of str, optional) – Write selected output formats as a comma-separated list without spaces, e.g. -o clu,tree,ftree. Options: clu, tree, ftree, newick, json, csv, network, states, flow.

  • hide_bipartite_nodes (bool, optional) – Hide bipartite nodes in output by projecting the solution to primary nodes.

  • print_all_trials (bool, optional) – Write each trial to separate output files. Has effect only when –num-trials is greater than 1.

  • verbosity_level (int, optional) – Verbosity level on the console. 1 keeps the default output level, 2 renders -vv and so on.

  • silent (bool, optional) – Suppress console output.

  • pretty (bool, optional) – Use modernized console output with color and Unicode on interactive terminals.

  • two_level (bool, optional) – Optimize a two-level partition instead of the default multi-level hierarchy.

  • flow_model (str, optional) – Choose how Infomap derives flow from the input links. Options: undirected, directed, undirdir, outdirdir, rawdir, precomputed.

  • directed (bool, optional) – Treat input links as directed. Shorthand for –flow-model directed.

  • recorded_teleportation (bool, optional) – When teleportation is used to calculate flow, also record teleportation steps in the codelength.

  • use_node_weights_as_flow (bool, optional) – Use node weights from the API or Pajek node records as normalized node flow.

  • to_nodes (bool, optional) – Teleport to nodes instead of links. Uses uniform node weights unless node weights are provided.

  • teleportation_probability (float, optional) – Set the probability of teleporting to a random node or link when calculating flow.

  • regularized (bool, optional) – Add a fully connected Bayesian prior network to reduce overfitting to missing links. Activates –recorded-teleportation.

  • regularization_strength (float, optional) – Scale the relative strength of the Bayesian prior network used by –regularized.

  • entropy_corrected (bool, optional) – Correct for negative entropy bias in small samples, especially solutions with many modules.

  • entropy_correction_strength (float, optional) – Scale the default correction used by –entropy-corrected.

  • markov_time (float, optional) – Scale link flow to change the cost of moving between modules. Higher values result in fewer modules.

  • variable_markov_time (bool, optional) – Vary Markov time locally to reduce overpartitioning in sparse areas while keeping higher resolution in dense areas.

  • variable_markov_damping (float, optional) – With –variable-markov-time, set damping between local effective degree (0) and local entropy (1).

  • variable_markov_min_scale (float, optional) – With –variable-markov-time, set the minimum local scale for zero-entropy nodes. Local Markov time is max scale divided by local scale.

  • preferred_number_of_modules (int, optional) – Penalize solutions by how far their number of modules differs from this value.

  • multilayer_relax_rate (float, optional) – Set the probability of relaxing from a state node to neighboring layers instead of staying in the current layer.

  • multilayer_relax_limit (int, optional) – Limit relaxation to this many neighboring layer ids in each direction. Use a negative value to allow relaxation to any layer.

  • multilayer_relax_limit_up (int, optional) – Limit relaxation upward to this many higher neighboring layer ids. Use a negative value to allow relaxation to any higher layer.

  • multilayer_relax_limit_down (int, optional) – Limit relaxation downward to this many lower neighboring layer ids. Use a negative value to allow relaxation to any lower layer.

  • multilayer_relax_by_jsd (bool, optional) – Weight multilayer relaxation by out-link similarity measured with Jensen-Shannon divergence.

  • seed (int, optional) – Set the random number generator seed for reproducible results.

  • num_trials (int, optional) – Run this many independent trials and keep the best solution.

  • core_loop_limit (int, optional) – Limit how many core loops try to move each node to the best module.

  • core_level_limit (int, optional) – Limit how many times core loops are reapplied to the aggregated modular network to find larger structures. 0 means no limit.

  • tune_iteration_limit (int, optional) – Limit the main iterations in the two-level partition algorithm. 0 means no limit.

  • core_loop_codelength_threshold (float, optional) – Require at least this codelength improvement to accept a new solution in a core loop.

  • tune_iteration_relative_threshold (float, optional) – Require each tune iteration to improve codelength by this fraction of the initial two-level codelength.

  • fast_hierarchical_solution (int, optional) – Find top modules fast. Use 2 to keep all fast levels and 3 to skip the recursive part.

  • inner_parallelization (bool, optional) – Parallelize the innermost loop for speed, with a possible accuracy tradeoff.

  • prefer_modular_solution (bool, optional) – Prefer a modular solution even when one module gives a lower codelength.

  • num_random_moves (int, optional) – Try this many random moves in each core loop to merge weakly connected nodes.

  • max_degree_for_random_moves (int, optional) – Try random moves only for nodes with degree at most this value.

  • include_self_links (bool, optional) – Deprecated. Self-links are included by default; use no_self_links=True to exclude them.

class infomap.MultilayerNode(layer_id, node_id)
layer_id

Alias for field number 0

node_id

Alias for field number 1