Skip to main content

Asunder: Constrained Structure Detection on Undirected Graphs.

Project description

Asunder

Asunder is a Python package for constrained network structure detection (graph clustering) on undirected graphs, with workflows centered on column generation and customizable master/subproblem pipelines. In said workflows, expensive Integer Linear Program (ILP) subproblems are replaced with heuristic clustering algorithms while ensuring that dual information from the master problem are respected. This enables the solution of a wide range of constrained structure detection (graph clustering) problems, insofar as a master problem, and any other relevant custom element, can be properly formulated. See problem fit section for more detail.

Development of Asunder is led by Andrew Allman's Process Systems Research Team at the University of Michigan.

Install

Base install:

pip install put-asunder

Optional extras:

pip install "put-asunder[graph,viz]"

Legacy heuristics (best-effort on Python 3.13):

pip install "put-asunder[legacy]"

Python Support

  • Guaranteed: Python 3.10, 3.11, 3.12, 3.13 for core package.
  • Guaranteed: mainstream extras (graph, viz) on Python 3.10–3.13.
  • Best-effort: legacy extra on Python 3.13.

Quickstart

import numpy as np
from asunder import CSDDecomposition, CSDDecompositionConfig

A = np.array([
    [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
    [0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1],
    [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1],
    [0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1],
    [0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0]
], dtype=float)

cfg = CSDDecompositionConfig(
    ifc_params={"generator": lambda N, **_: [np.ones((N, N))], "num": 1, "args": {"N": A.shape[0]}},
    extract_dual=False,
    final_master_solve=False,
)

result = CSDDecomposition(config=cfg).run(A)
print(result.metadata)

Solver Setup

Asunder accepts user-provided solver objects. For Gurobi, GRB_LICENSE_FILE is used by your environment. Example:

from asunder import create_solver

solver = create_solver("gurobi_direct")

Problem Fit

Asunder works well out of the box for optimization problems where coordination or operations are coupled across space (e.g. central coupling) and/or time and those interactions can be represented as a graph over constraints.

Asunder also supports general constrained partitioning beyond these domain examples when requirements can be expressed as must-link and cannot-link constraints.

Typical fit signals:

  • coupling across time periods, units, or resources
  • mixed discrete-continuous structure with meaningful constraint interactions
  • a useful interpretation of must-link/cannot-link or worthy-edge constraints
  • value from multilevel partitioning or core-periphery structure detection

Representative domains:

  • stochastic design and dispatch in energy systems
  • scheduling and resource allocation in healthcare systems
  • planning, routing, and location in supply chain and logistics
  • network configuration and resource management in telecommunications

For a fuller guide on where default workflows are sufficient vs where customization helps, see docs/problem_fit.rst.

Customization Points

For custom problems, typical extension points are:

  1. Initial feasible partition generator.
  2. solve_master_problem replacement.
  3. Optional heuristic or ILP subproblem replacement.
  4. Optional partition refinement stage.

Constraint Graph Compatibility

For the built-in case-study evaluation workflows (run_evaluation), Asunder expects a constraint-graph pattern consistent with the provided case studies.

Required structure for run_evaluation-style workflows:

  • undirected graph (typically networkx.Graph)
  • node attribute constraint (string tag used for ground-truth and role grouping)
  • edge attribute var_type with values "integer" or "continuous"

Commonly present (recommended) attributes:

  • node attribute type (for example "constraint")
  • node attribute details (metadata dict)
  • edge attributes weight, variables, var_types

How these are used:

  • constraint identifies core/nonlinear tags in built-in case studies
  • var_type determines candidate edge sets for CP and CD_Refine paths

If you are not using run_evaluation and instead calling decomposition APIs directly, you can work from an adjacency matrix plus explicit must_link, cannot_link, and optional worthy_edges.

Examples

  • Nonlinear B&P-style decomposition: examples/nonlinear_bp.py
  • Custom subproblem wiring: examples/custom_subproblem.py

Documentation

Sphinx docs are scaffolded in docs/ and intended for Read the Docs deployment.

References

Asunder integrates or wraps methods from:

  • networkx
  • sklearn
  • python-igraph / leidenalg
  • scikit-network
  • signed-louvain style algorithms

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

put_asunder-0.1.1.tar.gz (55.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

put_asunder-0.1.1-py3-none-any.whl (62.4 kB view details)

Uploaded Python 3

File details

Details for the file put_asunder-0.1.1.tar.gz.

File metadata

  • Download URL: put_asunder-0.1.1.tar.gz
  • Upload date:
  • Size: 55.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for put_asunder-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b93c262fad1c118fddb5d2bf28cd1d44ffa721841540259b13095f0c4a64ef0b
MD5 bc83c90277b34bd969993b3cd8b9b480
BLAKE2b-256 38bb800bec4270948ff76faf240282e4de96167b41558ea8b9336898563a67e6

See more details on using hashes here.

File details

Details for the file put_asunder-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: put_asunder-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 62.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for put_asunder-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 730fe76ed0bc9fa6ed552a6c0ce62e2739754450088e3d335f24111533adb390
MD5 ecc47618bec21421bae81867f03b3991
BLAKE2b-256 8e8d0b9e9ec3da0acedfc2390e6bf0465354aa2d10fe832f027b1b701da293fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page