Metadata-Version: 2.4
Name: scanwidth
Version: 0.2.0
Summary: Package for computing the edge- and node-scanwidth of a directed acyclic graph (DAG)
Author: Niels Holtgrefe
License: MIT License
        
        Copyright (c) 2023-2026 Niels Holtgrefe
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Keywords: graph,dag,scanwidth,edge-scanwidth,node-scanwidth
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: networkx>=3.0.0
Requires-Dist: numpy>=1.20.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Provides-Extra: scipy
Requires-Dist: scipy; extra == "scipy"
Provides-Extra: gurobi
Requires-Dist: gurobipy; extra == "gurobi"
Provides-Extra: ilp
Requires-Dist: scipy; extra == "ilp"
Requires-Dist: gurobipy; extra == "ilp"
Provides-Extra: docs
Requires-Dist: sphinx>=7.0.0; extra == "docs"
Requires-Dist: pydata-sphinx-theme>=0.15.0; extra == "docs"
Dynamic: license-file

# scanwidth

Python package for computing edge-scanwidth and node-scanwidth of directed
acyclic graphs (DAGs).

## Installation

Install the base package:

```bash
pip install scanwidth
```

Install optional dependency groups:

```bash
# Development and test dependencies
pip install scanwidth[dev]

# Documentation dependencies
pip install scanwidth[docs]

# SciPy backend for node ILP (algorithm="ilp", backend="scipy")
pip install scanwidth[scipy]

# Gurobi backend for node ILP (algorithm="ilp", backend="gurobi")
pip install scanwidth[gurobi]

# Both ILP backends
pip install scanwidth[ilp]
```

`gurobipy` requires a working Gurobi installation and a valid Gurobi license
(typically commercial, with academic licenses available separately from Gurobi).

Build docs locally:

```bash
sphinx-build -b html docs/source docs/build/html
```

## Quick Start

```python
import networkx as nx
from scanwidth import DAG
from scanwidth.edge_scanwidth import edge_scanwidth
from scanwidth.node_scanwidth import node_scanwidth

graph = nx.read_edgelist(
    "path/to/graph.el",
    create_using=nx.DiGraph,
    nodetype=str,
)
dag = DAG(graph)

esw, ext = edge_scanwidth(dag, algorithm="xp")
nsw, ext = node_scanwidth(dag, algorithm="ilp")
```

## Repository Structure

- `src/scanwidth/`: installable Python package.
- `tests/`: repository test suite (not part of the installed package).
- `experiments/`: experimental materials (not part of the installed package).

For details on experiments, see `experiments/README.md`.

## Citation

If you use this repository in research, please cite:

**Exact and heuristic computation of the scanwidth of directed acyclic
graphs**. *Niels Holtgrefe, Leo van Iersel, and Mark Jones*. Journal of
Computer and System Sciences, 160:103802, 2026. doi:
[10.1016/j.jcss.2026.103802](https://doi.org/10.1016/j.jcss.2026.103802)

## License

MIT License - see `LICENSE`.
