Options and multilayer inputs

Options captures a reusable Infomap configuration; pass an instance to infomap.run() (or Network.run()) via the options argument. InfomapOptions is a backward-compatible alias for the same class.

class infomap.Options(*args, **kwargs)

Reusable Infomap keyword options.

This class mirrors the keyword arguments accepted by infomap.Infomap and infomap.Infomap.run(). Construct it like any dataclass (Options(num_trials=10)) – unknown keys raise, as usual – use to_args() to render command-line flags, or pass an instance to infomap.run() via infomap.run(input, options=options) to apply a reusable configuration.

Instances are immutable (frozen). Derive a tweaked copy with replace() rather than mutating in place:

base = Options(num_trials=20, seed=123)
directed = base.replace(flow_model="directed")   # base is unchanged

A field marked args-only in library mode below drives the engine’s own file writer, which runs only with an output directory passed via the raw args escape hatch; on the normal library surface it writes nothing. Write results from the Result (result.write_tree / write_clu / …) or the Network (write_pajek / write_state_network) instead.

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. Valid range: >= 0.0. Engine default: 0.

  • 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. Valid range: >= 1.

  • 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. Valid range: >= 1.

  • 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. Valid range: >= 0.0.

  • 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.

    Args-only in library mode (see the note above).

  • no_file_output (bool, optional) –

    Do not write output files.

    Args-only in library mode (see the note above).

  • tree (bool, optional) –

    Write the modular hierarchy to a tree file. Enabled by default when no other output format is selected.

    Args-only in library mode (see the note above).

  • ftree (bool, optional) –

    Write the modular hierarchy and aggregated links between nested modules to an ftree file. Used by Network Navigator.

    Args-only in library mode (see the note above).

  • clu (bool, optional) –

    Write top-level module ids for each node to a clu file.

    Args-only in library mode (see the note above).

  • clu_level (int, optional) –

    With –clu or –output clu, write module ids at this depth from the root. Use -1 for bottom-level modules. Valid range: >= -1. Engine default: 1.

    Args-only in library mode (see the note above).

  • 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.

    Args-only in library mode (see the note above).

  • hide_bipartite_nodes (bool, optional) –

    Hide bipartite nodes in output by projecting the solution to primary nodes.

    Args-only on the Python library surface. It projects the secondary (type-B) bipartite nodes out of what result.write_tree/write_clu emit, leaving the in-memory result covering both node types. Set it via Options and write from the Result to use it.

  • print_all_trials (bool, optional) –

    Write each trial to separate output files. Has effect only when –num-trials is greater than 1.

    Args-only in library mode (see the note above).

  • no_overwrite (bool, optional) –

    Fail with an output error if any target output file already exists. By default existing files are replaced.

    Args-only in library mode (see the note above).

  • print_config_fingerprint (bool, optional) –

    Print the canonical configuration fingerprint and exit.

    Not a Python library option; it leaves the surface in 3.0. A print-and-exit CLI diagnostic; run the infomap binary.

  • timing_json (str, optional) – Write machine-readable run timing JSON to this path. Use - for stdout.

  • summary_json (str, optional) – Write machine-readable final run summary JSON to this path. Use - for stdout.

  • manifest_json (str, optional) – Write a machine-readable run manifest JSON to this path. Use - for stdout.

  • memory_report (bool, optional) – Include peak RSS and best-effort bytes per node/link estimates in timing JSON. Requires –timing-json.

  • trial_offset (int, optional) – Global index of the first trial this process runs; trial i uses seed = base_seed + (trial_offset + i). Default 0 (single-process behavior). Valid range: >= 0. Engine default: 0.

  • trial_results (str, optional) – Write this shard’s per-trial results (codelengths, seeds, best-tree reference, fingerprints) as JSON to this path, for deterministic merging of distributed shard runs into a final solution.

  • no_final_output (bool, optional) – Skip writing this process’s aggregate best result. Per-trial outputs and –trial-results are still written.

  • verbosity_level (int, optional) –

    Verbosity level on the console. 1 keeps the default output level, 2 renders -vv and so on.

    Not a Python library option; it leaves the surface in 3.0. A DEBUG-enabled ‘infomap’ logger (infomap.enable_log(logging.DEBUG)) raises engine verbosity; logger levels filter the records.

  • silent (bool, optional) –

    Suppress console output. The Python API is already quiet by default; to see the engine log, use infomap.enable_log() rather than this flag. The command-line interface is unaffected.

    Not a Python library option; it leaves the surface in 3.0. The Python API is quiet by default; logging is the control. Attach handlers to logging.getLogger(‘infomap’) (e.g. infomap.enable_log()) for the engine log.

  • 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. Valid range: between 0.0 and 1.0 (inclusive).

  • max_flow_iterations (int, optional) – Limit the power iteration used to calculate flow (directed and regularized flow models) to this many iterations. Valid range: >= 1.

  • min_flow_iterations (int, optional) – Require at least this many power iterations before the flow calculation can converge, even if –flow-tolerance is already met. Valid range: >= 0.

  • flow_tolerance (float, optional) – Convergence tolerance for the power iteration used to calculate flow. Iteration stops once the per-iteration change in flow drops to or below this value, after –min-flow-iterations have run. Valid range: >= 0.0.

  • 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. Valid range: >= 0.0.

  • 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. Valid range: >= 0.0.

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

  • 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). Valid range: between 0.0 and 1.0 (inclusive).

  • 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. Valid range: >= 1.

  • preferred_number_of_levels (int, optional) – Soft preference for the depth of the hierarchy. Steering to a shallower depth is reliable at a small codelength cost; deeper is best-effort, bounded by what the optimizer proposes. No-op with –two-level or strength 0. Valid range: >= 1.

  • preferred_number_of_levels_strength (float, optional) – Scale the strength of –preferred-number-of-levels. 0 disables the preference; larger values increase the cost of deviating from the preferred depth. Valid range: >= 0.0.

  • multilayer_relax_rate (float, optional) – Set the probability of relaxing from a state node to neighboring layers instead of staying in the current layer. Valid range: between 0.0 and 1.0 (inclusive).

  • 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.

  • multilayer_relax_to_self (bool, optional) – On relaxation, link a state node to its own physical node in the target layer instead of spreading to its out-neighbors. Builds a smaller state network with the same flow as the default.

  • seed (int, optional) – Set the random number generator seed for reproducible results. Valid range: >= 1.

  • num_trials (int, optional) – Run this many independent trials and keep the best solution. Valid range: >= 1.

  • core_loop_limit (int, optional) – Limit how many core loops try to move each node to the best module. Valid range: >= 1.

  • 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. Valid range: >= 0. Engine default: 0.

  • tune_iteration_limit (int, optional) – Limit the main iterations in the two-level partition algorithm. 0 means no limit. Valid range: >= 0. Engine default: 0.

  • core_loop_codelength_threshold (float, optional) – Require at least this codelength improvement to accept a new solution in a core loop. Valid range: >= 0.0.

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

  • 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) – Experimental: use batched parallel node moves for coarse optimization. Performance gains are workload-dependent, often require a relaxed core-loop-codelength-threshold and low tune-iteration-limit, and may produce a different partition than serial optimization.

  • parallel_trials (bool, optional) – Run independent trials in parallel with OpenMP. –num-trials remains the total number of trials; the number of parallel workers follows the OpenMP thread count (e.g. OMP_NUM_THREADS), clamped to –num-trials. Peak memory scales with the worker count. Nested OpenMP and –inner-parallelization are disabled inside workers.

  • converge (bool, optional) – Treat the trial count as a cap and stop early once the best codelength has plateaued (no meaningful improvement over several consecutive trials). Runs trials serially; cannot be combined with parallel trials or distributed sharding. With no explicit trial count, a default cap is used.

  • num_threads (str or int, optional) – Effective thread budget: ‘auto’ (resolve from –num-threads > INFOMAP_NUM_THREADS > SLURM_CPUS_PER_TASK > OMP_NUM_THREADS > cpuset > hardware), or a positive integer. 1 forces fully serial. Governs the recursive partition, parallel trials, and inner parallelization.

  • threads (str or int, optional) –

    Alias for –num-threads.

    Not a Python library option; it leaves the surface in 3.0. Use num_threads; threads is a redundant alias of the same engine option.

  • 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. Valid range: >= 0.

  • max_degree_for_random_moves (int, optional) – Try random moves only for nodes with degree at most this value. Valid range: >= 0.

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

replace(**changes) Options

Return a copy of these options with changes applied.

The ergonomic way to derive a variant of a base configuration without mutating it (instances are frozen). Validates like construction, so an out-of-range or misspelled change raises here:

base = Options(num_trials=20, seed=123)
faster = base.replace(num_trials=5)   # base is unchanged
Parameters:

**changes – Option fields to override, by name. Unknown names raise TypeError; out-of-range values raise ValueError.

Returns:

A new Options with the given fields replaced.

Return type:

Options

to_args(base_args: str | None = None)

Render the options as an Infomap command-line argument string.

Options that keep their default values render no flags.

Parameters:

base_args (str, optional) – Raw Infomap arguments to prepend before the rendered flags.

Returns:

The rendered argument string, prefixed by base_args if given.

Return type:

str

to_kwargs()

Return the options as a keyword-argument dict.

Returns:

A dict with one entry per option field, suitable for Infomap(**options.to_kwargs()).

Return type:

dict

infomap.InfomapOptions

Reusable Infomap keyword options.

This class mirrors the keyword arguments accepted by infomap.Infomap and infomap.Infomap.run(). Construct it like any dataclass (Options(num_trials=10)) – unknown keys raise, as usual – use to_args() to render command-line flags, or pass an instance to infomap.run() via infomap.run(input, options=options) to apply a reusable configuration.

Instances are immutable (frozen). Derive a tweaked copy with replace() rather than mutating in place:

base = Options(num_trials=20, seed=123)
directed = base.replace(flow_model="directed")   # base is unchanged

A field marked args-only in library mode below drives the engine’s own file writer, which runs only with an output directory passed via the raw args escape hatch; on the normal library surface it writes nothing. Write results from the Result (result.write_tree / write_clu / …) or the Network (write_pajek / write_state_network) instead.

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. Valid range: >= 0.0. Engine default: 0.

  • 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. Valid range: >= 1.

  • 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. Valid range: >= 1.

  • 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. Valid range: >= 0.0.

  • 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.

    Args-only in library mode (see the note above).

  • no_file_output (bool, optional) –

    Do not write output files.

    Args-only in library mode (see the note above).

  • tree (bool, optional) –

    Write the modular hierarchy to a tree file. Enabled by default when no other output format is selected.

    Args-only in library mode (see the note above).

  • ftree (bool, optional) –

    Write the modular hierarchy and aggregated links between nested modules to an ftree file. Used by Network Navigator.

    Args-only in library mode (see the note above).

  • clu (bool, optional) –

    Write top-level module ids for each node to a clu file.

    Args-only in library mode (see the note above).

  • clu_level (int, optional) –

    With –clu or –output clu, write module ids at this depth from the root. Use -1 for bottom-level modules. Valid range: >= -1. Engine default: 1.

    Args-only in library mode (see the note above).

  • 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.

    Args-only in library mode (see the note above).

  • hide_bipartite_nodes (bool, optional) –

    Hide bipartite nodes in output by projecting the solution to primary nodes.

    Args-only on the Python library surface. It projects the secondary (type-B) bipartite nodes out of what result.write_tree/write_clu emit, leaving the in-memory result covering both node types. Set it via Options and write from the Result to use it.

  • print_all_trials (bool, optional) –

    Write each trial to separate output files. Has effect only when –num-trials is greater than 1.

    Args-only in library mode (see the note above).

  • no_overwrite (bool, optional) –

    Fail with an output error if any target output file already exists. By default existing files are replaced.

    Args-only in library mode (see the note above).

  • print_config_fingerprint (bool, optional) –

    Print the canonical configuration fingerprint and exit.

    Not a Python library option; it leaves the surface in 3.0. A print-and-exit CLI diagnostic; run the infomap binary.

  • timing_json (str, optional) – Write machine-readable run timing JSON to this path. Use - for stdout.

  • summary_json (str, optional) – Write machine-readable final run summary JSON to this path. Use - for stdout.

  • manifest_json (str, optional) – Write a machine-readable run manifest JSON to this path. Use - for stdout.

  • memory_report (bool, optional) – Include peak RSS and best-effort bytes per node/link estimates in timing JSON. Requires –timing-json.

  • trial_offset (int, optional) – Global index of the first trial this process runs; trial i uses seed = base_seed + (trial_offset + i). Default 0 (single-process behavior). Valid range: >= 0. Engine default: 0.

  • trial_results (str, optional) – Write this shard’s per-trial results (codelengths, seeds, best-tree reference, fingerprints) as JSON to this path, for deterministic merging of distributed shard runs into a final solution.

  • no_final_output (bool, optional) – Skip writing this process’s aggregate best result. Per-trial outputs and –trial-results are still written.

  • verbosity_level (int, optional) –

    Verbosity level on the console. 1 keeps the default output level, 2 renders -vv and so on.

    Not a Python library option; it leaves the surface in 3.0. A DEBUG-enabled ‘infomap’ logger (infomap.enable_log(logging.DEBUG)) raises engine verbosity; logger levels filter the records.

  • silent (bool, optional) –

    Suppress console output. The Python API is already quiet by default; to see the engine log, use infomap.enable_log() rather than this flag. The command-line interface is unaffected.

    Not a Python library option; it leaves the surface in 3.0. The Python API is quiet by default; logging is the control. Attach handlers to logging.getLogger(‘infomap’) (e.g. infomap.enable_log()) for the engine log.

  • 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. Valid range: between 0.0 and 1.0 (inclusive).

  • max_flow_iterations (int, optional) – Limit the power iteration used to calculate flow (directed and regularized flow models) to this many iterations. Valid range: >= 1.

  • min_flow_iterations (int, optional) – Require at least this many power iterations before the flow calculation can converge, even if –flow-tolerance is already met. Valid range: >= 0.

  • flow_tolerance (float, optional) – Convergence tolerance for the power iteration used to calculate flow. Iteration stops once the per-iteration change in flow drops to or below this value, after –min-flow-iterations have run. Valid range: >= 0.0.

  • 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. Valid range: >= 0.0.

  • 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. Valid range: >= 0.0.

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

  • 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). Valid range: between 0.0 and 1.0 (inclusive).

  • 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. Valid range: >= 1.

  • preferred_number_of_levels (int, optional) – Soft preference for the depth of the hierarchy. Steering to a shallower depth is reliable at a small codelength cost; deeper is best-effort, bounded by what the optimizer proposes. No-op with –two-level or strength 0. Valid range: >= 1.

  • preferred_number_of_levels_strength (float, optional) – Scale the strength of –preferred-number-of-levels. 0 disables the preference; larger values increase the cost of deviating from the preferred depth. Valid range: >= 0.0.

  • multilayer_relax_rate (float, optional) – Set the probability of relaxing from a state node to neighboring layers instead of staying in the current layer. Valid range: between 0.0 and 1.0 (inclusive).

  • 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.

  • multilayer_relax_to_self (bool, optional) – On relaxation, link a state node to its own physical node in the target layer instead of spreading to its out-neighbors. Builds a smaller state network with the same flow as the default.

  • seed (int, optional) – Set the random number generator seed for reproducible results. Valid range: >= 1.

  • num_trials (int, optional) – Run this many independent trials and keep the best solution. Valid range: >= 1.

  • core_loop_limit (int, optional) – Limit how many core loops try to move each node to the best module. Valid range: >= 1.

  • 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. Valid range: >= 0. Engine default: 0.

  • tune_iteration_limit (int, optional) – Limit the main iterations in the two-level partition algorithm. 0 means no limit. Valid range: >= 0. Engine default: 0.

  • core_loop_codelength_threshold (float, optional) – Require at least this codelength improvement to accept a new solution in a core loop. Valid range: >= 0.0.

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

  • 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) – Experimental: use batched parallel node moves for coarse optimization. Performance gains are workload-dependent, often require a relaxed core-loop-codelength-threshold and low tune-iteration-limit, and may produce a different partition than serial optimization.

  • parallel_trials (bool, optional) – Run independent trials in parallel with OpenMP. –num-trials remains the total number of trials; the number of parallel workers follows the OpenMP thread count (e.g. OMP_NUM_THREADS), clamped to –num-trials. Peak memory scales with the worker count. Nested OpenMP and –inner-parallelization are disabled inside workers.

  • converge (bool, optional) – Treat the trial count as a cap and stop early once the best codelength has plateaued (no meaningful improvement over several consecutive trials). Runs trials serially; cannot be combined with parallel trials or distributed sharding. With no explicit trial count, a default cap is used.

  • num_threads (str or int, optional) – Effective thread budget: ‘auto’ (resolve from –num-threads > INFOMAP_NUM_THREADS > SLURM_CPUS_PER_TASK > OMP_NUM_THREADS > cpuset > hardware), or a positive integer. 1 forces fully serial. Governs the recursive partition, parallel trials, and inner parallelization.

  • threads (str or int, optional) –

    Alias for –num-threads.

    Not a Python library option; it leaves the surface in 3.0. Use num_threads; threads is a redundant alias of the same engine option.

  • 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. Valid range: >= 0.

  • max_degree_for_random_moves (int, optional) – Try random moves only for nodes with degree at most this value. Valid range: >= 0.

  • 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