goatd 0.1.2__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 (164) hide show
  1. goatd-0.1.2/AGENTS.md +30 -0
  2. goatd-0.1.2/CLAUDE.md +30 -0
  3. goatd-0.1.2/Cargo.lock +107 -0
  4. goatd-0.1.2/Cargo.toml +48 -0
  5. goatd-0.1.2/LICENSE +201 -0
  6. goatd-0.1.2/PKG-INFO +77 -0
  7. goatd-0.1.2/README.md +106 -0
  8. goatd-0.1.2/bindings/python/.gitignore +6 -0
  9. goatd-0.1.2/bindings/python/Cargo.lock +231 -0
  10. goatd-0.1.2/bindings/python/Cargo.toml +31 -0
  11. goatd-0.1.2/bindings/python/README.md +60 -0
  12. goatd-0.1.2/bindings/python/goatd.pyi +60 -0
  13. goatd-0.1.2/bindings/python/src/lib.rs +475 -0
  14. goatd-0.1.2/bindings/python/tests/test_goatd.py +218 -0
  15. goatd-0.1.2/build.rs +86 -0
  16. goatd-0.1.2/docs/ACKNOWLEDGEMENTS.md +57 -0
  17. goatd-0.1.2/docs/CONTRIBUTING.md +81 -0
  18. goatd-0.1.2/docs/THIRD-PARTY.md +125 -0
  19. goatd-0.1.2/docs/algorithms.md +159 -0
  20. goatd-0.1.2/docs/building.md +34 -0
  21. goatd-0.1.2/docs/logo.png +0 -0
  22. goatd-0.1.2/examples/basic.rs +27 -0
  23. goatd-0.1.2/notices/LICENSE +201 -0
  24. goatd-0.1.2/notices/THIRD-PARTY.md +125 -0
  25. goatd-0.1.2/pyproject.toml +39 -0
  26. goatd-0.1.2/src/bin/goatd.rs +348 -0
  27. goatd-0.1.2/src/deadline/mod.rs +47 -0
  28. goatd-0.1.2/src/deadline/tests/mod.rs +39 -0
  29. goatd-0.1.2/src/decomposition/mod.rs +14 -0
  30. goatd-0.1.2/src/decomposition/model/mod.rs +304 -0
  31. goatd-0.1.2/src/decomposition/model/tests/mod.rs +17 -0
  32. goatd-0.1.2/src/decomposition/model/tests/validation.rs +313 -0
  33. goatd-0.1.2/src/decomposition/ops/mod.rs +453 -0
  34. goatd-0.1.2/src/decomposition/ops/tests/mod.rs +185 -0
  35. goatd-0.1.2/src/decomposition/refine/mod.rs +164 -0
  36. goatd-0.1.2/src/decomposition/refine/tests/mod.rs +34 -0
  37. goatd-0.1.2/src/elimination/build_td.rs +40 -0
  38. goatd-0.1.2/src/elimination/engine.rs +390 -0
  39. goatd-0.1.2/src/elimination/execution.rs +114 -0
  40. goatd-0.1.2/src/elimination/graph.rs +537 -0
  41. goatd-0.1.2/src/elimination/greedy/deterministic.rs +274 -0
  42. goatd-0.1.2/src/elimination/greedy/min_degree.rs +94 -0
  43. goatd-0.1.2/src/elimination/greedy/min_fill.rs +224 -0
  44. goatd-0.1.2/src/elimination/greedy/mod.rs +316 -0
  45. goatd-0.1.2/src/elimination/greedy/sampling.rs +217 -0
  46. goatd-0.1.2/src/elimination/greedy/tests/min_fill.rs +29 -0
  47. goatd-0.1.2/src/elimination/greedy/tests/mod.rs +10 -0
  48. goatd-0.1.2/src/elimination/mod.rs +97 -0
  49. goatd-0.1.2/src/elimination/nested_dissection.rs +246 -0
  50. goatd-0.1.2/src/elimination/order.rs +57 -0
  51. goatd-0.1.2/src/elimination/preprocess.rs +192 -0
  52. goatd-0.1.2/src/elimination/tests/end_to_end.rs +243 -0
  53. goatd-0.1.2/src/elimination/tests/engine.rs +97 -0
  54. goatd-0.1.2/src/elimination/tests/graph.rs +110 -0
  55. goatd-0.1.2/src/elimination/tests/mod.rs +6 -0
  56. goatd-0.1.2/src/elimination/tests/nested_dissection.rs +57 -0
  57. goatd-0.1.2/src/elimination/tests/preprocess.rs +83 -0
  58. goatd-0.1.2/src/elimination/tests/vertex_cover_separator.rs +41 -0
  59. goatd-0.1.2/src/elimination/vertex_cover_separator.rs +219 -0
  60. goatd-0.1.2/src/error.rs +38 -0
  61. goatd-0.1.2/src/flowcutter/mod.rs +220 -0
  62. goatd-0.1.2/src/flowcutter/native.rs +321 -0
  63. goatd-0.1.2/src/flowcutter/separator/cutter.rs +591 -0
  64. goatd-0.1.2/src/flowcutter/separator/expanded.rs +113 -0
  65. goatd-0.1.2/src/flowcutter/separator/graph.rs +104 -0
  66. goatd-0.1.2/src/flowcutter/separator/mod.rs +416 -0
  67. goatd-0.1.2/src/flowcutter/separator/result.rs +135 -0
  68. goatd-0.1.2/src/flowcutter/separator/tests/mod.rs +15 -0
  69. goatd-0.1.2/src/flowcutter/separator/tests/separator.rs +290 -0
  70. goatd-0.1.2/src/flowcutter/tests/budget.rs +44 -0
  71. goatd-0.1.2/src/flowcutter/tests/guards.rs +25 -0
  72. goatd-0.1.2/src/flowcutter/tests/heap.rs +43 -0
  73. goatd-0.1.2/src/flowcutter/tests/mod.rs +4 -0
  74. goatd-0.1.2/src/flowcutter/tests/native.rs +11 -0
  75. goatd-0.1.2/src/graph/mod.rs +138 -0
  76. goatd-0.1.2/src/graph/tests/mod.rs +45 -0
  77. goatd-0.1.2/src/lib.rs +51 -0
  78. goatd-0.1.2/src/meter/mod.rs +108 -0
  79. goatd-0.1.2/src/pace.rs +356 -0
  80. goatd-0.1.2/src/partition/common/mod.rs +378 -0
  81. goatd-0.1.2/src/partition/common/tests/mod.rs +153 -0
  82. goatd-0.1.2/src/partition/graph/coarsen.rs +209 -0
  83. goatd-0.1.2/src/partition/graph/csr.rs +79 -0
  84. goatd-0.1.2/src/partition/graph/initial.rs +145 -0
  85. goatd-0.1.2/src/partition/graph/mod.rs +235 -0
  86. goatd-0.1.2/src/partition/graph/refine_fm.rs +400 -0
  87. goatd-0.1.2/src/partition/graph/tests/initial.rs +30 -0
  88. goatd-0.1.2/src/partition/graph/tests/mod.rs +15 -0
  89. goatd-0.1.2/src/partition/hypergraph/coarsen.rs +175 -0
  90. goatd-0.1.2/src/partition/hypergraph/initial.rs +142 -0
  91. goatd-0.1.2/src/partition/hypergraph/mod.rs +252 -0
  92. goatd-0.1.2/src/partition/hypergraph/model.rs +261 -0
  93. goatd-0.1.2/src/partition/hypergraph/refine_flow.rs +272 -0
  94. goatd-0.1.2/src/partition/hypergraph/refine_fm.rs +382 -0
  95. goatd-0.1.2/src/partition/hypergraph/tests/mod.rs +97 -0
  96. goatd-0.1.2/src/partition/mod.rs +38 -0
  97. goatd-0.1.2/src/portfolio/candidates.rs +63 -0
  98. goatd-0.1.2/src/portfolio/config.rs +91 -0
  99. goatd-0.1.2/src/portfolio/mod.rs +319 -0
  100. goatd-0.1.2/src/rng/mod.rs +65 -0
  101. goatd-0.1.2/src/rng/tests/mod.rs +143 -0
  102. goatd-0.1.2/src/tests/mod.rs +3 -0
  103. goatd-0.1.2/src/tests/td_fixture.rs +65 -0
  104. goatd-0.1.2/tests/api.rs +131 -0
  105. goatd-0.1.2/tests/cli.rs +254 -0
  106. goatd-0.1.2/tests/error.rs +32 -0
  107. goatd-0.1.2/tests/flowcutter.rs +203 -0
  108. goatd-0.1.2/tests/meter.rs +89 -0
  109. goatd-0.1.2/tests/pace.rs +251 -0
  110. goatd-0.1.2/tests/partition.rs +270 -0
  111. goatd-0.1.2/tests/portfolio.rs +87 -0
  112. goatd-0.1.2/tests/separator.rs +62 -0
  113. goatd-0.1.2/vendor/treedecomp/ffi.cpp +106 -0
  114. goatd-0.1.2/vendor/treedecomp/ffi.h +84 -0
  115. goatd-0.1.2/vendor/treedecomp/heap_selftest.cpp +76 -0
  116. goatd-0.1.2/vendor/treedecomp/upstream/IFlowCutter.cpp +960 -0
  117. goatd-0.1.2/vendor/treedecomp/upstream/IFlowCutter.hpp +112 -0
  118. goatd-0.1.2/vendor/treedecomp/upstream/TreeDecomposition.cpp +157 -0
  119. goatd-0.1.2/vendor/treedecomp/upstream/TreeDecomposition.hpp +96 -0
  120. goatd-0.1.2/vendor/treedecomp/upstream/bitset.hpp +343 -0
  121. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/LICENSE +22 -0
  122. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/README.md +45 -0
  123. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/array_id_func.hpp +188 -0
  124. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/back_arc.hpp +51 -0
  125. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/cch_order.hpp +784 -0
  126. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/cell.cpp +20 -0
  127. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/cell.hpp +33 -0
  128. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/chain.hpp +54 -0
  129. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/connected_components.hpp +218 -0
  130. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/contraction_graph.hpp +279 -0
  131. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/count_range.hpp +47 -0
  132. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/filter.hpp +73 -0
  133. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/flow_cutter.hpp +1161 -0
  134. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/flow_cutter_config.hpp +189 -0
  135. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/greedy_order.cpp +255 -0
  136. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/greedy_order.hpp +48 -0
  137. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/heap.hpp +544 -0
  138. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/histogram.hpp +66 -0
  139. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/id_func.hpp +119 -0
  140. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/id_func_traits.hpp +76 -0
  141. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/id_multi_func.hpp +146 -0
  142. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/id_sort.hpp +39 -0
  143. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/io_helper.hpp +36 -0
  144. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/list_graph.hpp +23 -0
  145. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/min_max.hpp +75 -0
  146. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/multi_arc.hpp +103 -0
  147. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/node_flow_cutter.hpp +297 -0
  148. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/pace.cpp +572 -0
  149. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/permutation.hpp +48 -0
  150. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/preorder.hpp +56 -0
  151. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/range.hpp +13 -0
  152. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/separator.hpp +283 -0
  153. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/sort_arc.hpp +38 -0
  154. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/tiny_id_func.hpp +156 -0
  155. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/tree.hpp +40 -0
  156. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/tree_decomposition.cpp +210 -0
  157. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/tree_decomposition.hpp +12 -0
  158. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/tree_node_ranking.hpp +205 -0
  159. goatd-0.1.2/vendor/treedecomp/upstream/flow-cutter-pace17/src/union_find.hpp +86 -0
  160. goatd-0.1.2/vendor/treedecomp/upstream/graph.cpp +246 -0
  161. goatd-0.1.2/vendor/treedecomp/upstream/graph.hpp +161 -0
  162. goatd-0.1.2/vendor/treedecomp/upstream/time_mem.hpp +138 -0
  163. goatd-0.1.2/vendor/treedecomp/upstream/treedecomp_defs.hpp +38 -0
  164. goatd-0.1.2/vendor/treedecomp/upstream/utils.hpp +51 -0
goatd-0.1.2/AGENTS.md ADDED
@@ -0,0 +1,30 @@
1
+ # Agent Instructions — goatd
2
+
3
+ `CLAUDE.md` is the instruction file for this repository. `AGENTS.md` is a
4
+ relative symlink to it so agents read the same rules. Edit this file, not the
5
+ symlink.
6
+
7
+ goatd is a public Rust library and CLI: a graph goes in and a tree
8
+ decomposition comes out. Library code, solver code, tests, documentation, and
9
+ vendored dependencies live here. Every tracked file and commit is public.
10
+
11
+ [`CONTRIBUTING.md`](docs/CONTRIBUTING.md) binds in full. In particular:
12
+
13
+ - Run the complete gate set before reporting a change finished, including
14
+ `--all-targets` so the CLI and examples are covered.
15
+ - For a bug fix, add a regression test and confirm that it fails on the
16
+ unfixed parent.
17
+ - Keep the library single-threaded. Consumers own parallelism across graph
18
+ instances.
19
+ - Keep budgets and seeds explicit. Library code does not read the process
20
+ environment.
21
+ - Reject an inert CLI flag with an error naming both the flag and the order
22
+ that accepts it.
23
+ - Put public-surface tests in top-level `tests/`; put tests of private or
24
+ crate-visible items in a `tests/` directory inside their module.
25
+ - Extend shared implementations, fixtures, and tables instead of creating a
26
+ second path that must be kept in sync.
27
+ - Update [docs/algorithms.md](docs/algorithms.md) when an algorithm or its
28
+ selection policy changes.
29
+ - The first build compiles the vendored C++ code. Compiler setup is in
30
+ [docs/building.md](docs/building.md).
goatd-0.1.2/CLAUDE.md ADDED
@@ -0,0 +1,30 @@
1
+ # Agent Instructions — goatd
2
+
3
+ `CLAUDE.md` is the instruction file for this repository. `AGENTS.md` is a
4
+ relative symlink to it so agents read the same rules. Edit this file, not the
5
+ symlink.
6
+
7
+ goatd is a public Rust library and CLI: a graph goes in and a tree
8
+ decomposition comes out. Library code, solver code, tests, documentation, and
9
+ vendored dependencies live here. Every tracked file and commit is public.
10
+
11
+ [`CONTRIBUTING.md`](docs/CONTRIBUTING.md) binds in full. In particular:
12
+
13
+ - Run the complete gate set before reporting a change finished, including
14
+ `--all-targets` so the CLI and examples are covered.
15
+ - For a bug fix, add a regression test and confirm that it fails on the
16
+ unfixed parent.
17
+ - Keep the library single-threaded. Consumers own parallelism across graph
18
+ instances.
19
+ - Keep budgets and seeds explicit. Library code does not read the process
20
+ environment.
21
+ - Reject an inert CLI flag with an error naming both the flag and the order
22
+ that accepts it.
23
+ - Put public-surface tests in top-level `tests/`; put tests of private or
24
+ crate-visible items in a `tests/` directory inside their module.
25
+ - Extend shared implementations, fixtures, and tables instead of creating a
26
+ second path that must be kept in sync.
27
+ - Update [docs/algorithms.md](docs/algorithms.md) when an algorithm or its
28
+ selection policy changes.
29
+ - The first build compiles the vendored C++ code. Compiler setup is in
30
+ [docs/building.md](docs/building.md).
goatd-0.1.2/Cargo.lock ADDED
@@ -0,0 +1,107 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "cc"
7
+ version = "1.4.4"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "0ad534f4357a5264cce5019c989cf66a4f0dc4e0d1b1d15f8aacec0ff7360273"
10
+ dependencies = [
11
+ "find-msvc-tools",
12
+ "shlex",
13
+ ]
14
+
15
+ [[package]]
16
+ name = "cfg-if"
17
+ version = "1.0.4"
18
+ source = "registry+https://github.com/rust-lang/crates.io-index"
19
+ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
20
+
21
+ [[package]]
22
+ name = "chacha20"
23
+ version = "0.10.2"
24
+ source = "registry+https://github.com/rust-lang/crates.io-index"
25
+ checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06"
26
+ dependencies = [
27
+ "cfg-if",
28
+ "cpufeatures",
29
+ "rand_core",
30
+ ]
31
+
32
+ [[package]]
33
+ name = "cpufeatures"
34
+ version = "0.3.0"
35
+ source = "registry+https://github.com/rust-lang/crates.io-index"
36
+ checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201"
37
+ dependencies = [
38
+ "libc",
39
+ ]
40
+
41
+ [[package]]
42
+ name = "find-msvc-tools"
43
+ version = "0.1.11"
44
+ source = "registry+https://github.com/rust-lang/crates.io-index"
45
+ checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890"
46
+
47
+ [[package]]
48
+ name = "getrandom"
49
+ version = "0.4.3"
50
+ source = "registry+https://github.com/rust-lang/crates.io-index"
51
+ checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
52
+ dependencies = [
53
+ "cfg-if",
54
+ "libc",
55
+ "r-efi",
56
+ "rand_core",
57
+ ]
58
+
59
+ [[package]]
60
+ name = "goatd"
61
+ version = "0.1.2"
62
+ dependencies = [
63
+ "cc",
64
+ "rand",
65
+ "rustc-hash",
66
+ ]
67
+
68
+ [[package]]
69
+ name = "libc"
70
+ version = "0.2.189"
71
+ source = "registry+https://github.com/rust-lang/crates.io-index"
72
+ checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
73
+
74
+ [[package]]
75
+ name = "r-efi"
76
+ version = "6.0.0"
77
+ source = "registry+https://github.com/rust-lang/crates.io-index"
78
+ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
79
+
80
+ [[package]]
81
+ name = "rand"
82
+ version = "0.10.2"
83
+ source = "registry+https://github.com/rust-lang/crates.io-index"
84
+ checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80"
85
+ dependencies = [
86
+ "chacha20",
87
+ "getrandom",
88
+ "rand_core",
89
+ ]
90
+
91
+ [[package]]
92
+ name = "rand_core"
93
+ version = "0.10.1"
94
+ source = "registry+https://github.com/rust-lang/crates.io-index"
95
+ checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
96
+
97
+ [[package]]
98
+ name = "rustc-hash"
99
+ version = "2.1.3"
100
+ source = "registry+https://github.com/rust-lang/crates.io-index"
101
+ checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
102
+
103
+ [[package]]
104
+ name = "shlex"
105
+ version = "2.0.1"
106
+ source = "registry+https://github.com/rust-lang/crates.io-index"
107
+ checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
goatd-0.1.2/Cargo.toml ADDED
@@ -0,0 +1,48 @@
1
+ [package]
2
+ name = "goatd"
3
+ version = "0.1.2"
4
+ edition = "2024"
5
+ # The floor let-chains (`if let … && let …`) set for edition 2024.
6
+ rust-version = "1.88"
7
+ license = "Apache-2.0"
8
+ repository = "https://github.com/Tractables/goatd"
9
+ documentation = "https://docs.rs/goatd"
10
+ description = "Greatest Of All Tree Decompositions: tree decompositions of graphs — elimination orders, FlowCutter, multilevel bisection — with PACE .gr/.td I/O and a command-line solver."
11
+ keywords = ["treewidth", "tree-decomposition", "graph", "pace", "elimination-order"]
12
+ categories = ["algorithms", "science", "mathematics", "command-line-utilities"]
13
+ readme = "README.md"
14
+ # Allowlist: `cargo package` ships exactly these. `vendor/treedecomp` is the
15
+ # C++ FlowCutter builder `build.rs` compiles; it sits under the package root
16
+ # because `include` cannot reach outside it.
17
+ include = [
18
+ "src/**/*.rs",
19
+ "tests/**/*.rs",
20
+ "examples/**/*.rs",
21
+ "build.rs",
22
+ "Cargo.toml",
23
+ "README.md",
24
+ "CLAUDE.md",
25
+ "AGENTS.md",
26
+ "docs/**/*.md",
27
+ "docs/logo.png",
28
+ "LICENSE",
29
+ "vendor/**",
30
+ ]
31
+ # `build.rs` compiles the vendored FlowCutter into `libtreedecomp.a`. Declaring
32
+ # `links` reserves that native library name, so two copies of this crate can
33
+ # never be linked into one program.
34
+ links = "treedecomp"
35
+
36
+ [lib]
37
+ name = "goatd"
38
+
39
+ [[bin]]
40
+ name = "goatd"
41
+ path = "src/bin/goatd.rs"
42
+
43
+ [dependencies]
44
+ rand = "0.10"
45
+ rustc-hash = "2"
46
+
47
+ [build-dependencies]
48
+ cc = "1"
goatd-0.1.2/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
goatd-0.1.2/PKG-INFO ADDED
@@ -0,0 +1,77 @@
1
+ Metadata-Version: 2.4
2
+ Name: goatd
3
+ Version: 0.1.2
4
+ Classifier: Programming Language :: Python :: 3
5
+ Classifier: Programming Language :: Rust
6
+ Classifier: Intended Audience :: Science/Research
7
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
8
+ License-File: notices/LICENSE
9
+ License-File: notices/THIRD-PARTY.md
10
+ Summary: Greatest Of All Tree Decompositions: tree decompositions of graphs — elimination orders, FlowCutter, multilevel bisection — with PACE .gr/.td text in and out.
11
+ License-Expression: Apache-2.0
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
14
+ Project-URL: Documentation, https://docs.rs/goatd
15
+ Project-URL: Repository, https://github.com/Tractables/goatd
16
+
17
+ # goatd for Python
18
+
19
+ Python bindings for [goatd](https://github.com/Tractables/goatd), built with
20
+ [PyO3](https://pyo3.rs) and [maturin](https://www.maturin.rs).
21
+
22
+ ```sh
23
+ pip install goatd
24
+ ```
25
+
26
+ Wheels cover CPython 3.10 and later on Linux x86-64, macOS arm64 and Windows
27
+ x64. Anywhere else, pip builds from the source distribution, which needs a
28
+ Rust toolchain and a C++20 compiler.
29
+
30
+ ```python
31
+ import goatd
32
+
33
+ graph = goatd.Graph(4, [(0, 1), (1, 2), (2, 3), (3, 0), (0, 2)])
34
+ td = goatd.decompose(graph, order="portfolio", budget_ms=100)
35
+
36
+ td.treewidth # 2
37
+ td.bags # [[0, 1, 2], [0, 2, 3]]
38
+ td.edges # [(0, 1)] — pairs of positions in td.bags
39
+ td.validate(graph) # raises goatd.Error if td does not decompose graph
40
+ print(td.to_td()) # PACE .td text
41
+ ```
42
+
43
+ `decompose` takes the solver's knobs under the solver's names: `order` is one
44
+ of `minfill`, `mindegree`, `nested-dissection`, `flowcutter` and `portfolio`;
45
+ `seed` breaks ties; `ties="sample"` and `weights` control weighted sampling for
46
+ the two greedy orders; `steps` gives flowcutter a repeatable step budget in
47
+ place of a clock; `refine=True` re-cuts the result along FlowCutter separators.
48
+ An argument the chosen order cannot act on raises `ValueError` naming both.
49
+ Budgets are milliseconds, so the name is `budget_ms` rather than the command
50
+ line's `--budget`.
51
+
52
+ `goatd.Graph.from_gr` and `TreeDecomposition.from_td` read the PACE formats;
53
+ `to_gr` and `to_td` write them.
54
+
55
+ goatd is single-threaded. The interpreter lock is released for the whole of a
56
+ solve, so a caller can decompose several graphs at once from Python threads.
57
+
58
+ ## Building
59
+
60
+ The extension builds against the published `goatd` crate rather than the
61
+ checkout around it, so it needs a Rust toolchain, a C++20 compiler for the
62
+ vendored FlowCutter, and maturin.
63
+
64
+ PEP 639 resolves `license-files` against the directory holding
65
+ `pyproject.toml` and forbids `..`, so the two notice files are copied in from
66
+ the repository root first rather than kept here in a second copy:
67
+
68
+ ```sh
69
+ mkdir -p bindings/python/notices
70
+ cp LICENSE docs/THIRD-PARTY.md bindings/python/notices/
71
+ pip install maturin
72
+ maturin build --release --manifest-path bindings/python/Cargo.toml
73
+ ```
74
+
75
+ `maturin develop` installs the extension into the active virtualenv for
76
+ `pytest bindings/python/tests`.
77
+
goatd-0.1.2/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # goatd — Greatest Of All Tree Decompositions
2
+
3
+ <p align="center">
4
+ <img src="docs/logo.png" alt="goatd logo" width="280">
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/Tractables/goatd/actions/workflows/ci.yml"><img
9
+ src="https://github.com/Tractables/goatd/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
10
+ <a href="LICENSE"><img
11
+ src="https://img.shields.io/badge/license-Apache--2.0-blue.svg" alt="License: Apache-2.0"></a>
12
+ <a href="https://crates.io/crates/goatd"><img
13
+ src="https://img.shields.io/crates/v/goatd.svg" alt="crates.io"></a>
14
+ <a href="https://docs.rs/goatd"><img
15
+ src="https://docs.rs/goatd/badge.svg" alt="docs.rs"></a>
16
+ </p>
17
+
18
+ Tree decompositions of graphs, as a Rust library and command-line solver. The
19
+ portfolio runs several constructions and keeps the narrowest result:
20
+
21
+ - **portfolio search** — safe reductions, several seeds and construction
22
+ methods, then optional separator refinement;
23
+ - **greedy elimination** — min-fill and min-degree, with deterministic or
24
+ weighted-sampling tie breaking;
25
+ - **nested dissection** — recursive multilevel bisection, with each separator
26
+ eliminated after its two sides;
27
+ - **flow-based separation** — balanced cuts for constructing and refining
28
+ decompositions. goatd includes a Rust FlowCutter separator search and the
29
+ vendored PACE 2017 FlowCutter decomposer.
30
+
31
+ See [Algorithms](docs/algorithms.md) for the details and the differences from
32
+ the upstream methods.
33
+
34
+ ## Solver
35
+
36
+ ```sh
37
+ cargo install goatd
38
+ goatd graph.gr > graph.td
39
+ ```
40
+
41
+ `goatd` reads and writes the PACE `.gr` and `.td` formats. Choose `--order
42
+ minfill`, `mindegree`, `nested-dissection`, `flowcutter`, or `portfolio`; run
43
+ `goatd --help` for budgets, seeds, weighted ties, and refinement.
44
+
45
+ ## Library
46
+
47
+ ```toml
48
+ [dependencies]
49
+ goatd = "0.1"
50
+ ```
51
+
52
+ The [`basic` example](examples/basic.rs) constructs a graph, computes a
53
+ decomposition, validates it, and writes it in PACE format:
54
+
55
+ ```sh
56
+ cargo run --example basic
57
+ ```
58
+
59
+ The public API also exposes graph and hypergraph bisection, the Rust separator
60
+ search, the C++ FlowCutter decomposer, and decomposition projection and
61
+ refinement. Rustdoc documents each entry point.
62
+
63
+ ## Bindings
64
+
65
+ The same constructions are available from
66
+ [Python](bindings/python/README.md) and from
67
+ [C and C++](bindings/c/README.md).
68
+
69
+ ## Evaluation
70
+
71
+ The [solver comparison](https://tractables.github.io/goatd/) evaluates the
72
+ shipped portfolio and seven public baselines on component graphs obtained from
73
+ Model Counting Competition CNFs after two seconds of preprocessing. Each
74
+ configuration receives ten seconds on one CPU, and every decomposition is
75
+ checked by the same validator.
76
+
77
+ The default view excludes tree components and focuses on harder cases: graphs
78
+ where the smallest validated width found is 30 or greater. It also retains 17
79
+ graphs for which no displayed configuration returned a validated
80
+ decomposition. “Exact best” means a tie with the smallest validated width
81
+ found, not a proven optimum.
82
+
83
+ <!-- Generated table; 6,640 selected graphs. -->
84
+
85
+ | Solver | Valid | Exact best | Within +1 | Within +4 |
86
+ | --- | ---: | ---: | ---: | ---: |
87
+ | goatd portfolio | 6,442 (97.0%) | **4,047 (60.9%)** | **5,203 (78.4%)** | **6,166 (92.9%)** |
88
+ | Jdrasil heuristic | 6,361 (95.8%) | 2,745 (41.3%) | 3,993 (60.1%) | 5,718 (86.1%) |
89
+ | FlowCutter PACE 2017 | **6,565 (98.9%)** | 1,239 (18.7%) | 1,774 (26.7%) | 3,921 (59.1%) |
90
+ | Tamaki PACE 2017 | 6,400 (96.4%) | 922 (13.9%) | 1,435 (21.6%) | 2,870 (43.2%) |
91
+ | HTD | 6,401 (96.4%) | 381 (5.7%) | 579 (8.7%) | 1,991 (30.0%) |
92
+ | NetworkX min-degree | 6,266 (94.4%) | 157 (2.4%) | 172 (2.6%) | 332 (5.0%) |
93
+ | NetworkX min-fill | 5,564 (83.8%) | 129 (1.9%) | 311 (4.7%) | 1,712 (25.8%) |
94
+ | Arboretum heuristic | 3,059 (46.1%) | 75 (1.1%) | 162 (2.4%) | 820 (12.3%) |
95
+
96
+ ## Building and contributing
97
+
98
+ Build setup is in [Building](docs/building.md). Contributions follow
99
+ [CONTRIBUTING.md](docs/CONTRIBUTING.md).
100
+
101
+ ## Licence
102
+
103
+ Apache-2.0. Vendored code and modifications are recorded in
104
+ [THIRD-PARTY.md](docs/THIRD-PARTY.md);
105
+ [ACKNOWLEDGEMENTS.md](docs/ACKNOWLEDGEMENTS.md)
106
+ credits the work behind the algorithms.
@@ -0,0 +1,6 @@
1
+ /target
2
+ /dist
3
+
4
+ # Copied in from the repository root before a build; the tracked originals are
5
+ # LICENSE and docs/THIRD-PARTY.md.
6
+ /notices