ogdf-py 0.1.1__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/.github/workflows/build-publish.yml +11 -6
  2. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/.github/workflows/ci.yml +34 -3
  3. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/.gitignore +4 -0
  4. ogdf_py-0.3.0/CHANGELOG.md +95 -0
  5. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/CMakeLists.txt +28 -18
  6. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/Makefile +18 -7
  7. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/PKG-INFO +15 -6
  8. ogdf_py-0.3.0/README.md +83 -0
  9. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/demos/README.md +5 -2
  10. ogdf_py-0.3.0/demos/algorithms_visual.py +348 -0
  11. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/demos/gallery.py +93 -3
  12. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/demos/generators_zoo.py +15 -0
  13. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/demos/layouts_gallery.py +53 -0
  14. ogdf_py-0.3.0/docs/coverage.md +281 -0
  15. ogdf_py-0.3.0/docs/getting-started.md +111 -0
  16. ogdf_py-0.3.0/docs/index.md +46 -0
  17. ogdf_py-0.3.0/mkdocs.yml +39 -0
  18. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/pyproject.toml +9 -4
  19. ogdf_py-0.3.0/scripts/bootstrap_ogdf.py +126 -0
  20. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/src/ogdf/__init__.py +1 -1
  21. ogdf_py-0.3.0/src/ogdf/bind_algorithms.cpp +687 -0
  22. ogdf_py-0.3.0/src/ogdf/bind_generators.cpp +185 -0
  23. ogdf_py-0.3.0/src/ogdf/bind_layouts.cpp +436 -0
  24. ogdf_py-0.3.0/tests/test_algorithms.py +552 -0
  25. ogdf_py-0.3.0/tests/test_generators.py +153 -0
  26. ogdf_py-0.3.0/tests/test_layouts.py +198 -0
  27. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/uv.lock +395 -1
  28. ogdf_py-0.1.1/CHANGELOG.md +0 -55
  29. ogdf_py-0.1.1/README.md +0 -74
  30. ogdf_py-0.1.1/demos/algorithms_visual.py +0 -110
  31. ogdf_py-0.1.1/scripts/bootstrap_ogdf.sh +0 -83
  32. ogdf_py-0.1.1/src/ogdf/bind_algorithms.cpp +0 -208
  33. ogdf_py-0.1.1/src/ogdf/bind_generators.cpp +0 -62
  34. ogdf_py-0.1.1/src/ogdf/bind_layouts.cpp +0 -222
  35. ogdf_py-0.1.1/tests/test_algorithms.py +0 -189
  36. ogdf_py-0.1.1/tests/test_generators.py +0 -70
  37. ogdf_py-0.1.1/tests/test_layouts.py +0 -70
  38. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/LICENSE +0 -0
  39. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/demos/_common.py +0 -0
  40. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/demos/io_roundtrip.py +0 -0
  41. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/demos/run_all.py +0 -0
  42. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/demos/styling_showcase.py +0 -0
  43. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/src/ogdf/_core.cpp +0 -0
  44. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/src/ogdf/bind_graph.cpp +0 -0
  45. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/src/ogdf/bind_io.cpp +0 -0
  46. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/src/ogdf/bindings.h +0 -0
  47. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/src/ogdf/py.typed +0 -0
  48. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/tests/test_ogdf.py +0 -0
  49. {ogdf_py-0.1.1 → ogdf_py-0.3.0}/tests/test_styling.py +0 -0
@@ -22,16 +22,19 @@ concurrency:
22
22
  cancel-in-progress: true
23
23
 
24
24
  env:
25
- # Build CPython 3.10-3.13; skip musllinux (OGDF is bootstrapped on
25
+ # Build CPython 3.10-3.14; skip musllinux (OGDF is bootstrapped on
26
26
  # manylinux/glibc) and PyPy.
27
- CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
27
+ CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*"
28
28
  CIBW_SKIP: "*-musllinux_* pp*"
29
29
  # Clone + build OGDF once per platform before building any wheels. On Linux
30
30
  # this runs inside the manylinux container (git present; install cmake).
31
31
  CIBW_BEFORE_ALL_LINUX: >-
32
32
  (command -v cmake >/dev/null 2>&1 || pipx install cmake) &&
33
- bash scripts/bootstrap_ogdf.sh
34
- CIBW_BEFORE_ALL_MACOS: bash scripts/bootstrap_ogdf.sh
33
+ python3 scripts/bootstrap_ogdf.py
34
+ CIBW_BEFORE_ALL_MACOS: python3 scripts/bootstrap_ogdf.py
35
+ # windows-latest ships git, CMake, and MSVC; the bootstrap builds OGDF with
36
+ # the MSVC toolchain.
37
+ CIBW_BEFORE_ALL_WINDOWS: python scripts/bootstrap_ogdf.py
35
38
  # Exercise each wheel end-to-end (import + layouts + I/O).
36
39
  CIBW_TEST_REQUIRES: pytest
37
40
  CIBW_TEST_COMMAND: pytest {project}/tests -v
@@ -75,6 +78,8 @@ jobs:
75
78
  - os: macos-14
76
79
  arch: arm64
77
80
  macos_target: "11.0"
81
+ - os: windows-latest
82
+ arch: AMD64
78
83
  env:
79
84
  MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macos_target }}
80
85
  steps:
@@ -82,10 +87,10 @@ jobs:
82
87
 
83
88
  # Cache the cloned+built OGDF per platform/arch so reruns skip the build.
84
89
  - name: Cache OGDF
85
- uses: actions/cache@v4
90
+ uses: actions/cache@v6
86
91
  with:
87
92
  path: thirdparty/ogdf
88
- key: ogdf-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('scripts/bootstrap_ogdf.sh') }}
93
+ key: ogdf-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('scripts/bootstrap_ogdf.py') }}
89
94
 
90
95
  - name: Build wheels
91
96
  uses: pypa/cibuildwheel@v4.1.0
@@ -24,13 +24,13 @@ jobs:
24
24
  # Cache the cloned+built OGDF so most runs skip the ~2 min build.
25
25
  # Keyed on the bootstrap script (which pins the OGDF tag).
26
26
  - name: Cache OGDF
27
- uses: actions/cache@v4
27
+ uses: actions/cache@v6
28
28
  with:
29
29
  path: thirdparty/ogdf
30
- key: ogdf-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/bootstrap_ogdf.sh') }}
30
+ key: ogdf-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/bootstrap_ogdf.py') }}
31
31
 
32
32
  - name: Bootstrap OGDF
33
- run: ./scripts/bootstrap_ogdf.sh
33
+ run: python3 scripts/bootstrap_ogdf.py
34
34
 
35
35
  - name: Install uv
36
36
  uses: astral-sh/setup-uv@v8.3.0
@@ -61,3 +61,34 @@ jobs:
61
61
  files: coverage.xml
62
62
  fail_ci_if_error: false
63
63
  token: ${{ secrets.CODECOV_TOKEN }}
64
+
65
+ windows:
66
+ name: Build & test (Windows)
67
+ runs-on: windows-latest
68
+ steps:
69
+ - uses: actions/checkout@v7
70
+
71
+ # windows-latest ships git, CMake, and MSVC; the bootstrap builds OGDF
72
+ # with the MSVC toolchain into thirdparty/ogdf/build/Release.
73
+ - name: Cache OGDF
74
+ uses: actions/cache@v6
75
+ with:
76
+ path: thirdparty/ogdf
77
+ key: ogdf-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/bootstrap_ogdf.py') }}
78
+
79
+ - name: Bootstrap OGDF
80
+ run: python scripts/bootstrap_ogdf.py
81
+
82
+ - name: Install uv
83
+ uses: astral-sh/setup-uv@v8.3.0
84
+ with:
85
+ enable-cache: true
86
+
87
+ - name: Set up Python
88
+ run: uv python install 3.13
89
+
90
+ - name: Install dependencies (builds the extension)
91
+ run: uv sync
92
+
93
+ - name: Run tests
94
+ run: uv run pytest tests/ -v
@@ -44,3 +44,7 @@ cmake_install.cmake
44
44
  .claude
45
45
  CLAUDE.md
46
46
 
47
+
48
+ # MkDocs
49
+ site/
50
+ docs/gallery.md
@@ -0,0 +1,95 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.3.0]
10
+
11
+ ### Added
12
+
13
+ - Planar layouts: `FPPLayout`, `PlanarStraightLayout`, `PlanarDrawLayout`, and `MixedModelLayout` - straight-line and mixed-model planar grid drawings, completing the planar-drawing family alongside `SchnyderLayout`. Each validates that the input is a simple planar graph with at least 3 nodes.
14
+
15
+ - Shortest paths: `a_star_search`, point-to-point A* with an optional admissible heuristic; returns the path length and edges, or `None` if the target is unreachable.
16
+
17
+ - Crossing minimization: `crossing_number` (heuristic minimum crossings via the subgraph planarizer) and `insert_edges` (routes a chosen set of edges through the otherwise-planar rest of the graph and returns, per edge, the original edges it crosses).
18
+
19
+ - Flow / cut and connectivity: `min_st_cut` (directed or undirected s-t minimum cut, returning the value and the cut edges) and `node_connectivity` / `edge_connectivity` (global and local/Menger k-connectivity).
20
+
21
+ - Documentation: expanded the coverage checklist with a priority roadmap.
22
+
23
+ ## [0.2.0]
24
+
25
+ ### Added
26
+
27
+ - Layouts: `RadialTreeLayout`, `LinearLayout` (arc diagram), `TutteLayout` (convex planar), `DominanceLayout` / `VisibilityLayout` (upward, for DAGs), `MultilevelLayout` / `ModularMultilevelMixer` (large graphs), and `BalloonLayout`.
28
+
29
+ - Algorithms: cut vertices (`cut_vertices`) and bridges (`bridges`), Bellman-Ford shortest paths (`bellman_ford`), minimum-cost flow (`min_cost_flow`), general maximum-weight matching (`maximum_weight_matching`, Blossom V), minimum Steiner tree (`steiner_tree`, Mehlhorn), maximal planar subgraph (`maximal_planar_subgraph`), and triconnectivity via `separation_pair` and `spqr_tree_summary`.
30
+
31
+ - Cross-platform Python bootstrap (`scripts/bootstrap_ogdf.py`) replacing the bash script; generalized CMake linking (MSVC-aware); Windows build+test CI job.
32
+
33
+ - MkDocs documentation site (`docs/`) with a coverage checklist and a Gallery page rendering the demo drawings; `make docs`, `make docs-serve`, `make docs-deploy`.
34
+
35
+ - Demos: gallery entries for the new layouts, and algorithm visualizations for cut vertices/bridges, maximum-weight matching, Bellman-Ford distances, minimum-cost flow, the minimum Steiner tree, and the maximal planar subgraph.
36
+
37
+ - Generators: circulant, complete-k-partite, globe, regular-lattice; graph products (cartesian, tensor, strong, lexicographical); operations (union, complement, suspension); and random models (preferential attachment, Chung-Lu, Watts-Strogatz, Waxman, geometric-cube, hierarchy, series-parallel DAG, triconnected, planar-biconnected, planar-triconnected).
38
+
39
+ - Predicates and small algorithms: `is_two_edge_connected`, `is_regular`, `is_arborescence`, `triangulate`, `make_bimodal`, and `bfs_distances` (unweighted single-source distances).
40
+
41
+ - Windows support: the release workflow now builds Windows (AMD64) wheels alongside Linux and macOS, and the wheel matrix covers CPython 3.10-3.14.
42
+
43
+ ### Fixed
44
+
45
+ - Removed the persistent CMake `build-dir` from `pyproject.toml`. Sharing it between editable installs and wheel builds could leave stale objects, so a `uv build --wheel` sometimes omitted recently-added functions. Each build now uses a fresh directory (OGDF is prebuilt, so this stays fast).
46
+
47
+ - MSVC build: replaced the non-standard `M_PI` (undefined on MSVC) with an explicit constant so the extension compiles on Windows.
48
+
49
+ ## [0.1.1]
50
+
51
+ ### Added
52
+
53
+ - OGDF bindings (curated subset): `Graph`/`Node`/`Edge` with iteration; `NodeArray`/`EdgeArray` in int/double/bool; `GraphAttributes` with coordinates, size, labels, and styling (colors, shapes, fill patterns, stroke, edge arrows, bends).
54
+
55
+ - Layout algorithms: `SugiyamaLayout`, `FMMMLayout`, `GEMLayout`, `SpringEmbedderKK`, `StressMinimization`, `PivotMDS`, `PlanarizationLayout` (with optional orthogonal routing), `SchnyderLayout`, `TreeLayout`, `CircularLayout`.
56
+
57
+ - Core graph algorithms: connectivity/structure predicates, connected / strong / biconnected components, topological numbering, Dijkstra shortest paths, minimum spanning tree, maximum flow, global minimum cut, matching, node coloring, and planar embedding.
58
+
59
+ - Graph generators: complete, complete-bipartite, wheel, cube, grid, Petersen, regular tree, plus random graphs, trees, digraphs, and regular / biconnected / planar variants.
60
+
61
+ - File I/O: interchange formats GML, GraphML, DOT, GEXF, GDF, TLP (with extension-based `read`/`write`) and drawing output as SVG and TikZ.
62
+
63
+ - `demos/` folder with illustrative scripts (layout gallery, styling showcase, algorithm visualizations, generator zoo, I/O round-trips) writing to `build/demo-output`; `make demos` also builds a self-contained HTML gallery (`index.html`) of every drawing.
64
+
65
+ - Bindings split into modular translation units (`bind_graph`, `bind_layouts`, `bind_algorithms`, `bind_io`, `bind_generators`).
66
+
67
+ - Auto-generated `_core.pyi` type stub for typed usage and IDE completion.
68
+
69
+ - `cibuildwheel` release workflow building CPython 3.10-3.13 wheels for Linux (x86_64, aarch64) and macOS (x86_64, arm64) on native runners, bootstrapping OGDF once per platform; trusted-publishing jobs for TestPyPI/PyPI on tags.
70
+
71
+ - CMake auto-bootstraps OGDF if missing, so `pip install` from an sdist works without a manual step (Unix only).
72
+
73
+ ### Changed
74
+
75
+ - Reproducible OGDF dependency: `scripts/bootstrap_ogdf.py` (cross-platform: Linux, macOS, Windows) shallow-clones OGDF at a pinned tag (`foxglove-202510`) and builds its static libraries from source; the extension links them. `make build`/`make sync` auto-bootstrap if needed. Replaces reliance on a manually placed OGDF checkout.
76
+
77
+ - Persist the CMake build directory so only the bindings recompile on edits.
78
+
79
+ ### Fixed
80
+
81
+ - `make build` targeted the wrong package name (`ogdf` vs `ogdf-py`), making it a silent no-op; it now rebuilds correctly.
82
+
83
+ - The generic `write` now raises `ValueError` for attribute-incapable formats (e.g. LEDA, Chaco) instead of crashing the interpreter.
84
+
85
+ ## [0.1.0]
86
+
87
+ ### Added
88
+
89
+ - Initial project structure
90
+
91
+ - Core module with example functions
92
+
93
+ - Test suite with pytest
94
+
95
+ - Build system using scikit-build-core
@@ -11,32 +11,45 @@ find_package(Threads REQUIRED)
11
11
 
12
12
  # --- OGDF (prebuilt static libraries) ---------------------------------------
13
13
  # OGDF is cloned at a pinned tag and built from source by
14
- # scripts/bootstrap_ogdf.sh, which produces libOGDF.a / libCOIN.a and the
15
- # generated config header. We link those static libs into the extension.
14
+ # scripts/bootstrap_ogdf.py, which produces the OGDF/COIN static libraries and
15
+ # the generated config header. We link those static libs into the extension.
16
16
  set(OGDF_ROOT "${CMAKE_SOURCE_DIR}/thirdparty/ogdf")
17
17
  set(OGDF_BUILD "${OGDF_ROOT}/build")
18
18
 
19
- # If OGDF has not been built yet, try to bootstrap it automatically (clone the
20
- # pinned tag + build from source). This lets `pip install` from an sdist work
21
- # without a separate manual step. Windows is not supported by the bash script.
22
- if(NOT EXISTS "${OGDF_BUILD}/libOGDF.a"
23
- AND EXISTS "${CMAKE_SOURCE_DIR}/scripts/bootstrap_ogdf.sh"
24
- AND NOT WIN32)
25
- message(STATUS "OGDF not built; running scripts/bootstrap_ogdf.sh ...")
19
+ # Locate the prebuilt OGDF/COIN static libraries produced by
20
+ # scripts/bootstrap_ogdf.py. Search both the single-config location and the
21
+ # multi-config Release/ subdirectory (used by MSVC and Xcode), and match both
22
+ # the Unix (libOGDF.a) and MSVC (OGDF.lib) naming.
23
+ set(_ogdf_lib_dirs "${OGDF_BUILD}" "${OGDF_BUILD}/Release")
24
+ find_library(OGDF_LIBRARY NAMES OGDF libOGDF PATHS ${_ogdf_lib_dirs}
25
+ NO_DEFAULT_PATH)
26
+
27
+ # If OGDF has not been built yet, bootstrap it automatically (clone the pinned
28
+ # tag + build from source), then search again. This lets `pip install` from an
29
+ # sdist work without a separate manual step. Uses the interpreter CMake found.
30
+ if(NOT OGDF_LIBRARY AND EXISTS "${CMAKE_SOURCE_DIR}/scripts/bootstrap_ogdf.py")
31
+ message(STATUS "OGDF not built; running scripts/bootstrap_ogdf.py ...")
26
32
  execute_process(
27
- COMMAND bash "${CMAKE_SOURCE_DIR}/scripts/bootstrap_ogdf.sh"
33
+ COMMAND "${Python_EXECUTABLE}"
34
+ "${CMAKE_SOURCE_DIR}/scripts/bootstrap_ogdf.py"
28
35
  RESULT_VARIABLE _ogdf_bootstrap_result)
29
36
  if(NOT _ogdf_bootstrap_result EQUAL 0)
30
37
  message(FATAL_ERROR
31
38
  "OGDF bootstrap failed (exit ${_ogdf_bootstrap_result}).")
32
39
  endif()
40
+ unset(OGDF_LIBRARY CACHE)
41
+ find_library(OGDF_LIBRARY NAMES OGDF libOGDF PATHS ${_ogdf_lib_dirs}
42
+ NO_DEFAULT_PATH)
33
43
  endif()
34
44
 
35
- if(NOT EXISTS "${OGDF_BUILD}/libOGDF.a")
45
+ find_library(COIN_LIBRARY NAMES COIN libCOIN PATHS ${_ogdf_lib_dirs}
46
+ NO_DEFAULT_PATH)
47
+
48
+ if(NOT OGDF_LIBRARY OR NOT COIN_LIBRARY)
36
49
  message(FATAL_ERROR
37
- "Prebuilt OGDF not found at ${OGDF_BUILD}/libOGDF.a.\n"
38
- "Run the bootstrap script first:\n"
39
- " scripts/bootstrap_ogdf.sh\n"
50
+ "Prebuilt OGDF not found under ${OGDF_BUILD}.\n"
51
+ "Run the bootstrap first:\n"
52
+ " python scripts/bootstrap_ogdf.py\n"
40
53
  "(or `make bootstrap`), which clones OGDF at a pinned tag and builds it.")
41
54
  endif()
42
55
 
@@ -46,10 +59,7 @@ set(OGDF_INCLUDE_DIRS
46
59
  "${OGDF_ROOT}/include"
47
60
  "${OGDF_BUILD}/include/ogdf-release")
48
61
 
49
- set(OGDF_LIBRARIES
50
- "${OGDF_BUILD}/libOGDF.a"
51
- "${OGDF_BUILD}/libCOIN.a"
52
- Threads::Threads)
62
+ set(OGDF_LIBRARIES ${OGDF_LIBRARY} ${COIN_LIBRARY} Threads::Threads)
53
63
 
54
64
  nanobind_add_module(_core
55
65
  src/ogdf/_core.cpp
@@ -4,7 +4,7 @@
4
4
  # This Makefile wraps common build commands for convenience.
5
5
  # The actual build is handled by scikit-build-core via pyproject.toml
6
6
 
7
- .PHONY: all bootstrap sync build rebuild test demos lint lint-check format format-check typecheck qa clean distclean wheel sdist dist check publish-test publish upgrade coverage coverage-html docs release help
7
+ .PHONY: all bootstrap sync build rebuild test demos lint lint-check format format-check typecheck qa clean distclean wheel sdist dist check publish-test publish upgrade coverage coverage-html docs docs-serve docs-deploy release help
8
8
 
9
9
  # Prebuilt OGDF static library; its presence marks a completed bootstrap.
10
10
  OGDF_LIB := thirdparty/ogdf/build/libOGDF.a
@@ -14,11 +14,11 @@ all: build
14
14
 
15
15
  # Clone OGDF at the pinned tag and build its static libraries from source.
16
16
  bootstrap:
17
- @./scripts/bootstrap_ogdf.sh
17
+ @python3 scripts/bootstrap_ogdf.py
18
18
 
19
19
  # Auto-bootstrap: build OGDF only if it has not been built yet.
20
20
  $(OGDF_LIB):
21
- @./scripts/bootstrap_ogdf.sh
21
+ @python3 scripts/bootstrap_ogdf.py
22
22
 
23
23
  # Sync environment (initial setup, installs dependencies + package)
24
24
  sync: $(OGDF_LIB)
@@ -101,9 +101,18 @@ coverage-html:
101
101
  @uv run pytest tests/ -v --cov=src/ogdf --cov-report=html
102
102
  @echo "Coverage report: htmlcov/index.html"
103
103
 
104
- # Build documentation (requires sphinx in dev dependencies)
105
- docs:
106
- @uv run sphinx-build -b html docs/ docs/_build/html
104
+ # Build the documentation site with MkDocs (into site/).
105
+ # Depends on demos so the gallery page (docs/gallery.md) is regenerated first.
106
+ docs: demos
107
+ @uv run --group docs mkdocs build
108
+
109
+ # Serve the documentation locally with live reload
110
+ docs-serve: demos
111
+ @uv run --group docs mkdocs serve
112
+
113
+ # Deploy the documentation to GitHub Pages (gh-pages branch)
114
+ docs-deploy: demos
115
+ @uv run --group docs mkdocs gh-deploy
107
116
 
108
117
  # Create a release (bump version, tag, push)
109
118
  release:
@@ -150,7 +159,9 @@ help:
150
159
  @echo " upgrade - Upgrade all dependencies"
151
160
  @echo " coverage - Run tests with coverage"
152
161
  @echo " coverage-html- Generate HTML coverage report"
153
- @echo " docs - Build documentation with Sphinx"
162
+ @echo " docs - Build the MkDocs documentation site"
163
+ @echo " docs-serve - Serve the docs locally with live reload"
164
+ @echo " docs-deploy - Deploy the docs to GitHub Pages"
154
165
  @echo " release - Bump version, tag, and prepare release"
155
166
  @echo " clean - Remove build artifacts"
156
167
  @echo " distclean - Remove all generated files"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ogdf-py
3
- Version: 0.1.1
3
+ Version: 0.3.0
4
4
  Summary: Python bindings for the Open Graph Drawing Framework (OGDF), built with nanobind.
5
5
  Keywords: nanobind,python,extension
6
6
  Author-Email: Shakeeb Alireza <shakfu@users.noreply.github.com>
@@ -70,11 +70,11 @@ n = ogdf.connected_components(g, component) # -> number of components
70
70
 
71
71
  - **Attributes:** `GraphAttributes` with coordinates, size, labels, and full styling (colors, shapes, fill patterns, stroke, edge arrows, and bends).
72
72
 
73
- - **Layouts:** `SugiyamaLayout` (layered), `FMMMLayout` / `GEMLayout` / `SpringEmbedderKK` (force-directed), `StressMinimization` / `PivotMDS` (stress/MDS), `PlanarizationLayout` (with optional orthogonal routing), `SchnyderLayout` (planar straight-line), `TreeLayout`, `CircularLayout`.
73
+ - **Layouts:** `SugiyamaLayout` (layered), `FMMMLayout` / `GEMLayout` / `SpringEmbedderKK` / `MultilevelLayout` (force-directed), `StressMinimization` / `PivotMDS` (stress/MDS), `PlanarizationLayout` (with optional orthogonal routing), `SchnyderLayout` / `FPPLayout` / `PlanarStraightLayout` / `PlanarDrawLayout` / `MixedModelLayout` (planar straight-line and mixed-model), `TreeLayout` / `RadialTreeLayout` / `BalloonLayout`, `CircularLayout`, `LinearLayout` (arc diagram), `TutteLayout` (convex planar), and `DominanceLayout` / `VisibilityLayout` (upward, for DAGs).
74
74
 
75
- - **Algorithms:** connectivity and structure tests (`is_connected`, `is_biconnected`, `is_bipartite`, `is_acyclic`, `is_planar`, ...), connected / strongly-connected / biconnected components, topological numbering, shortest paths (`dijkstra`), minimum spanning tree, maximum flow, global minimum cut, matching, node coloring, and planar embedding.
75
+ - **Algorithms:** connectivity and structure tests (`is_connected`, `is_biconnected`, `is_bipartite`, `is_acyclic`, `is_planar`, ...), node/edge k-connectivity (`node_connectivity`, `edge_connectivity`), components, cut vertices and bridges, separation pairs and SPQR-tree summary, topological numbering, shortest paths (`dijkstra`, `bellman_ford`, `a_star_search`), minimum spanning tree, maximum flow, minimum-cost flow, global minimum cut and s-t minimum cut (`min_st_cut`), matching (bipartite and maximum-weight), node coloring, minimum Steiner tree, planar embedding, maximal planar subgraph, crossing minimization (`crossing_number`), and edge-insertion routing (`insert_edges`).
76
76
 
77
- - **Generators:** complete, complete-bipartite, wheel, cube, grid, Petersen, regular tree, plus random graphs, trees, digraphs, and regular / biconnected / planar variants.
77
+ - **Generators:** classic graphs (complete, bipartite, wheel, cube, grid, Petersen, circulant, k-partite, globe, lattice), graph products (cartesian, tensor, strong, lexicographical), operations (union, complement, suspension), and random models (Erdos-Renyi, regular, planar, triconnected, Watts-Strogatz, preferential attachment, Chung-Lu, Waxman, geometric, series-parallel DAG, hierarchy).
78
78
 
79
79
  - **File I/O:** interchange formats GML, GraphML, DOT, GEXF, GDF, TLP (plus extension-based `read`/`write`), and drawing output as SVG and TikZ.
80
80
 
@@ -86,8 +86,17 @@ make demos # writes SVGs and data files to build/demo-output/
86
86
 
87
87
  The demos exercise layouts, styling, algorithm visualizations, generators, and file I/O, and assemble every drawing into `build/demo-output/index.html` for a side-by-side view. See [`demos/README.md`](demos/README.md) for details.
88
88
 
89
+ ## Documentation
90
+
91
+ ```bash
92
+ make docs # build the MkDocs site into site/
93
+ make docs-serve # serve locally with live reload
94
+ ```
95
+
96
+ The documentation site (`docs/`) includes a getting-started guide, a [coverage checklist](docs/coverage.md) of exactly what OGDF functionality is exposed, and a gallery of the demo drawings.
97
+
89
98
  ## How it builds
90
99
 
91
- `scripts/bootstrap_ogdf.sh` shallow-clones OGDF at a pinned release tag (`foxglove-202510`) into `thirdparty/ogdf` and builds its static libraries from source. The extension then links `libOGDF.a` / `libCOIN.a` statically, so wheels are self-contained. Because OGDF is prebuilt once (a couple of minutes), rebuilding the bindings only recompiles `_core.cpp` and is fast.
100
+ `scripts/bootstrap_ogdf.py` shallow-clones OGDF at a pinned release tag (`foxglove-202510`) into `thirdparty/ogdf` and builds its static libraries from source. The extension then links the OGDF / COIN static libraries, so wheels are self-contained. Because OGDF is prebuilt once (a couple of minutes), rebuilding the bindings only recompiles the binding sources and is fast.
92
101
 
93
- The pin can be overridden: `scripts/bootstrap_ogdf.sh --tag <tag>` or `OGDF_TAG=<tag> make bootstrap`. In CI, run the bootstrap once per platform (e.g. in `cibuildwheel`'s `CIBW_BEFORE_ALL`) so OGDF is reused across all Python versions.
102
+ The bootstrap script (`scripts/bootstrap_ogdf.py`) is cross-platform (Linux, macOS, Windows). The pin can be overridden: `python scripts/bootstrap_ogdf.py --tag <tag>` or `OGDF_TAG=<tag> make bootstrap`. In CI, run the bootstrap once per platform (e.g. in `cibuildwheel`'s `CIBW_BEFORE_ALL`) so OGDF is reused across all Python versions.
@@ -0,0 +1,83 @@
1
+ # ogdf-py
2
+
3
+ Python bindings for the [Open Graph Drawing Framework (OGDF)](https://ogdf.github.io/), built with [nanobind](https://nanobind.readthedocs.io/).
4
+
5
+ This is a curated subset of OGDF, not a full wrapper: enough to build graphs, run layout and core graph algorithms, style and draw them, and read/write common graph file formats.
6
+
7
+ ## Quick Start
8
+
9
+ ```bash
10
+ make bootstrap # clone OGDF at the pinned tag and build it from source (once)
11
+ uv sync # build the extension
12
+ uv run pytest # run the tests
13
+ uv build # build a wheel
14
+ ```
15
+
16
+ `make build` (and `make sync`) run the bootstrap automatically if OGDF has not been built yet. Use `make help` for additional targets.
17
+
18
+ ## Example
19
+
20
+ ```python
21
+ import ogdf
22
+
23
+ # Build a graph.
24
+ g = ogdf.Graph()
25
+ ogdf.random_planar_connected_graph(g, 30, 45)
26
+
27
+ # Attach drawing attributes and run a force-directed layout.
28
+ ga = ogdf.GraphAttributes(g)
29
+ ogdf.FMMMLayout().call(ga)
30
+
31
+ # Export to SVG.
32
+ ogdf.draw_svg(ga, "graph.svg")
33
+ ```
34
+
35
+ Algorithms operate on the same `Graph`, writing per-node/edge results into an array you pass in:
36
+
37
+ ```python
38
+ g = ogdf.Graph()
39
+ ogdf.complete_bipartite_graph(g, 3, 4)
40
+ assert ogdf.is_bipartite(g)
41
+
42
+ component = ogdf.NodeArrayInt(g)
43
+ n = ogdf.connected_components(g, component) # -> number of components
44
+ ```
45
+
46
+ ## What's included
47
+
48
+ - **Graph model:** `Graph`, `Node`, `Edge`, node/edge iteration.
49
+
50
+ - **Attribute arrays:** `NodeArray` / `EdgeArray` in int, double, and bool.
51
+
52
+ - **Attributes:** `GraphAttributes` with coordinates, size, labels, and full styling (colors, shapes, fill patterns, stroke, edge arrows, and bends).
53
+
54
+ - **Layouts:** `SugiyamaLayout` (layered), `FMMMLayout` / `GEMLayout` / `SpringEmbedderKK` / `MultilevelLayout` (force-directed), `StressMinimization` / `PivotMDS` (stress/MDS), `PlanarizationLayout` (with optional orthogonal routing), `SchnyderLayout` / `FPPLayout` / `PlanarStraightLayout` / `PlanarDrawLayout` / `MixedModelLayout` (planar straight-line and mixed-model), `TreeLayout` / `RadialTreeLayout` / `BalloonLayout`, `CircularLayout`, `LinearLayout` (arc diagram), `TutteLayout` (convex planar), and `DominanceLayout` / `VisibilityLayout` (upward, for DAGs).
55
+
56
+ - **Algorithms:** connectivity and structure tests (`is_connected`, `is_biconnected`, `is_bipartite`, `is_acyclic`, `is_planar`, ...), node/edge k-connectivity (`node_connectivity`, `edge_connectivity`), components, cut vertices and bridges, separation pairs and SPQR-tree summary, topological numbering, shortest paths (`dijkstra`, `bellman_ford`, `a_star_search`), minimum spanning tree, maximum flow, minimum-cost flow, global minimum cut and s-t minimum cut (`min_st_cut`), matching (bipartite and maximum-weight), node coloring, minimum Steiner tree, planar embedding, maximal planar subgraph, crossing minimization (`crossing_number`), and edge-insertion routing (`insert_edges`).
57
+
58
+ - **Generators:** classic graphs (complete, bipartite, wheel, cube, grid, Petersen, circulant, k-partite, globe, lattice), graph products (cartesian, tensor, strong, lexicographical), operations (union, complement, suspension), and random models (Erdos-Renyi, regular, planar, triconnected, Watts-Strogatz, preferential attachment, Chung-Lu, Waxman, geometric, series-parallel DAG, hierarchy).
59
+
60
+ - **File I/O:** interchange formats GML, GraphML, DOT, GEXF, GDF, TLP (plus extension-based `read`/`write`), and drawing output as SVG and TikZ.
61
+
62
+ ## Demos
63
+
64
+ ```bash
65
+ make demos # writes SVGs and data files to build/demo-output/
66
+ ```
67
+
68
+ The demos exercise layouts, styling, algorithm visualizations, generators, and file I/O, and assemble every drawing into `build/demo-output/index.html` for a side-by-side view. See [`demos/README.md`](demos/README.md) for details.
69
+
70
+ ## Documentation
71
+
72
+ ```bash
73
+ make docs # build the MkDocs site into site/
74
+ make docs-serve # serve locally with live reload
75
+ ```
76
+
77
+ The documentation site (`docs/`) includes a getting-started guide, a [coverage checklist](docs/coverage.md) of exactly what OGDF functionality is exposed, and a gallery of the demo drawings.
78
+
79
+ ## How it builds
80
+
81
+ `scripts/bootstrap_ogdf.py` shallow-clones OGDF at a pinned release tag (`foxglove-202510`) into `thirdparty/ogdf` and builds its static libraries from source. The extension then links the OGDF / COIN static libraries, so wheels are self-contained. Because OGDF is prebuilt once (a couple of minutes), rebuilding the bindings only recompiles the binding sources and is fast.
82
+
83
+ The bootstrap script (`scripts/bootstrap_ogdf.py`) is cross-platform (Linux, macOS, Windows). The pin can be overridden: `python scripts/bootstrap_ogdf.py --tag <tag>` or `OGDF_TAG=<tag> make bootstrap`. In CI, run the bootstrap once per platform (e.g. in `cibuildwheel`'s `CIBW_BEFORE_ALL`) so OGDF is reused across all Python versions.
@@ -20,12 +20,15 @@ uv run python demos/layouts_gallery.py
20
20
 
21
21
  - **`layouts_gallery.py`** - renders graphs with every layout algorithm
22
22
  (Sugiyama, FMMM, GEM, Kamada-Kawai, stress minimization, pivot MDS, Schnyder,
23
- circular, tree, and orthogonal), one SVG per layout.
23
+ circular, tree, radial tree, linear/arc, Tutte, dominance, visibility, and
24
+ orthogonal), one SVG per layout.
24
25
  - **`styling_showcase.py`** - a wheel graph styled with per-degree node colors,
25
26
  ellipse shapes, sizes, labels, and edge arrows.
26
27
  - **`algorithms_visual.py`** - visualizes algorithm results by coloring:
27
28
  connected components, a proper node coloring, shortest-path distances (as a
28
- gradient), and a highlighted minimum spanning tree.
29
+ gradient), a minimum spanning tree, cut vertices and bridges, a maximum-weight
30
+ matching, Bellman-Ford distances, a minimum-cost flow (edge width by flow),
31
+ and a minimum Steiner tree.
29
32
  - **`generators_zoo.py`** - builds a variety of named graphs (complete,
30
33
  bipartite, wheel, cube, grid, Petersen, trees, random regular) and draws each.
31
34
  - **`io_roundtrip.py`** - writes a graph to GML, GraphML, DOT, GEXF, TLP, SVG,