synkit 1.6.5__py3-none-win_amd64.whl

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 (636) hide show
  1. synkit/CRN/Benchmark/__init__.py +53 -0
  2. synkit/CRN/Benchmark/crosschecks.py +13 -0
  3. synkit/CRN/Benchmark/kegg.py +12 -0
  4. synkit/CRN/Benchmark/networks.py +13 -0
  5. synkit/CRN/Benchmark/scaling.py +13 -0
  6. synkit/CRN/Benchmark/validate.py +13 -0
  7. synkit/CRN/Construct/__init__.py +16 -0
  8. synkit/CRN/Construct/abstract.py +668 -0
  9. synkit/CRN/Construct/arity.py +36 -0
  10. synkit/CRN/Construct/builder.py +619 -0
  11. synkit/CRN/Construct/derivation.py +63 -0
  12. synkit/CRN/Construct/flattener.py +100 -0
  13. synkit/CRN/Construct/keys.py +14 -0
  14. synkit/CRN/Construct/mixtures.py +117 -0
  15. synkit/CRN/Construct/rdkit_worker.py +69 -0
  16. synkit/CRN/Construct/smiles.py +99 -0
  17. synkit/CRN/Construct/state.py +31 -0
  18. synkit/CRN/Construct/strategy.py +75 -0
  19. synkit/CRN/Construct/worker.py +42 -0
  20. synkit/CRN/IO/__init__.py +36 -0
  21. synkit/CRN/IO/sbml.py +925 -0
  22. synkit/CRN/Pathway/__init__.py +72 -0
  23. synkit/CRN/Pathway/_adapter.py +333 -0
  24. synkit/CRN/Pathway/pathfinder.py +500 -0
  25. synkit/CRN/Pathway/reachability.py +796 -0
  26. synkit/CRN/Pathway/realizability.py +1322 -0
  27. synkit/CRN/Petrinet/__init__.py +93 -0
  28. synkit/CRN/Petrinet/analyzer.py +486 -0
  29. synkit/CRN/Petrinet/minimal_semiflows.py +436 -0
  30. synkit/CRN/Petrinet/net.py +1041 -0
  31. synkit/CRN/Petrinet/persistence.py +97 -0
  32. synkit/CRN/Petrinet/semiflows.py +483 -0
  33. synkit/CRN/Petrinet/siphon_search.py +402 -0
  34. synkit/CRN/Petrinet/structure.py +286 -0
  35. synkit/CRN/Props/__init__.py +130 -0
  36. synkit/CRN/Props/_rank.py +29 -0
  37. synkit/CRN/Props/deficiency.py +953 -0
  38. synkit/CRN/Props/dynamics.py +832 -0
  39. synkit/CRN/Props/helper.py +151 -0
  40. synkit/CRN/Props/stoich.py +751 -0
  41. synkit/CRN/Props/thermo.py +584 -0
  42. synkit/CRN/Query/__init__.py +66 -0
  43. synkit/CRN/Query/cache.py +41 -0
  44. synkit/CRN/Query/kegg_api.py +99 -0
  45. synkit/CRN/Query/kegg_extract.py +714 -0
  46. synkit/CRN/Query/kegg_impute.py +707 -0
  47. synkit/CRN/Query/kegg_parse.py +480 -0
  48. synkit/CRN/Query/to_syncrn.py +290 -0
  49. synkit/CRN/README.md +234 -0
  50. synkit/CRN/Structure/__init__.py +12 -0
  51. synkit/CRN/Structure/_graph_io.py +713 -0
  52. synkit/CRN/Structure/_matrices.py +88 -0
  53. synkit/CRN/Structure/_parse.py +544 -0
  54. synkit/CRN/Structure/reaction.py +237 -0
  55. synkit/CRN/Structure/rule.py +55 -0
  56. synkit/CRN/Structure/species.py +46 -0
  57. synkit/CRN/Structure/syncrn.py +929 -0
  58. synkit/CRN/Symmetry/__init__.py +20 -0
  59. synkit/CRN/Symmetry/_common.py +1059 -0
  60. synkit/CRN/Symmetry/_ir.py +940 -0
  61. synkit/CRN/Symmetry/automorphism.py +472 -0
  62. synkit/CRN/Symmetry/canon.py +441 -0
  63. synkit/CRN/Symmetry/isomorphism.py +412 -0
  64. synkit/CRN/Symmetry/symmetry.py +61 -0
  65. synkit/CRN/Symmetry/wl_canon.py +967 -0
  66. synkit/CRN/Visualize/__init__.py +11 -0
  67. synkit/CRN/Visualize/labels.py +113 -0
  68. synkit/CRN/Visualize/layout.py +708 -0
  69. synkit/CRN/Visualize/palette.py +292 -0
  70. synkit/CRN/Visualize/validation.py +122 -0
  71. synkit/CRN/Visualize/vis.py +1152 -0
  72. synkit/CRN/__init__.py +233 -0
  73. synkit/CRN/_build.py +50 -0
  74. synkit/CRN/_native_build.py +175 -0
  75. synkit/CRN/analysis.py +629 -0
  76. synkit/CRN/backend.py +74 -0
  77. synkit/CRN/cpp/CMakeLists.txt +58 -0
  78. synkit/CRN/cpp/algebra.cpp +46 -0
  79. synkit/CRN/cpp/closure.cpp +29 -0
  80. synkit/CRN/cpp/exact.h +55 -0
  81. synkit/CRN/cpp/pathway.cpp +46 -0
  82. synkit/CRN/cpp/semiflows.cpp +209 -0
  83. synkit/CRN/cpp/structural.cpp +240 -0
  84. synkit/CRN/cpp/symmetry.cpp +45 -0
  85. synkit/CRN/cpp/write_manifest.cmake +28 -0
  86. synkit/CRN/kinds.py +137 -0
  87. synkit/CRN/lib/synkit_crn.dll +0 -0
  88. synkit/CRN/lib/synkit_crn.json +33 -0
  89. synkit/CRN/native.py +388 -0
  90. synkit/CRN/native_analysis.py +459 -0
  91. synkit/Chem/Cluster/__init__.py +0 -0
  92. synkit/Chem/Cluster/butina.py +140 -0
  93. synkit/Chem/Fingerprint/__init__.py +0 -0
  94. synkit/Chem/Fingerprint/fp_calculator.py +155 -0
  95. synkit/Chem/Fingerprint/smiles_featurizer.py +258 -0
  96. synkit/Chem/Fingerprint/transformation_fp.py +139 -0
  97. synkit/Chem/Mapper/README.rst +43 -0
  98. synkit/Chem/Mapper/__init__.py +255 -0
  99. synkit/Chem/Mapper/_compat.py +130 -0
  100. synkit/Chem/Mapper/adapters/__init__.py +1 -0
  101. synkit/Chem/Mapper/adapters/prediction.py +126 -0
  102. synkit/Chem/Mapper/adapters/template.py +412 -0
  103. synkit/Chem/Mapper/chem/__init__.py +52 -0
  104. synkit/Chem/Mapper/chem/aam.py +673 -0
  105. synkit/Chem/Mapper/chem/blind.py +160 -0
  106. synkit/Chem/Mapper/chem/its.py +309 -0
  107. synkit/Chem/Mapper/chem/smiles.py +564 -0
  108. synkit/Chem/Mapper/graph/__init__.py +66 -0
  109. synkit/Chem/Mapper/graph/automorphism.py +395 -0
  110. synkit/Chem/Mapper/graph/blockcut.py +98 -0
  111. synkit/Chem/Mapper/graph/labeled_graph.py +104 -0
  112. synkit/Chem/Mapper/graph/refine.py +176 -0
  113. synkit/Chem/Mapper/graph/synkit_adapter.py +110 -0
  114. synkit/Chem/Mapper/io/__init__.py +13 -0
  115. synkit/Chem/Mapper/io/idxmapstr.py +82 -0
  116. synkit/Chem/Mapper/mapper.py +685 -0
  117. synkit/Chem/Mapper/reaction_search.py +554 -0
  118. synkit/Chem/Mapper/reporting/__init__.py +1 -0
  119. synkit/Chem/Mapper/reporting/alternatives.py +451 -0
  120. synkit/Chem/Mapper/reporting/analysis.py +681 -0
  121. synkit/Chem/Mapper/reporting/native_analysis.py +485 -0
  122. synkit/Chem/Mapper/reporting/spectrum.py +642 -0
  123. synkit/Chem/Mapper/solvers/__init__.py +1 -0
  124. synkit/Chem/Mapper/solvers/exact/__init__.py +141 -0
  125. synkit/Chem/Mapper/solvers/exact/assignment/__init__.py +1 -0
  126. synkit/Chem/Mapper/solvers/exact/assignment/assignment_certificate.py +113 -0
  127. synkit/Chem/Mapper/solvers/exact/assignment/assignment_domains.py +162 -0
  128. synkit/Chem/Mapper/solvers/exact/assignment/assignment_verification.py +58 -0
  129. synkit/Chem/Mapper/solvers/exact/assignment/incremental_assignment.py +247 -0
  130. synkit/Chem/Mapper/solvers/exact/certificate.py +128 -0
  131. synkit/Chem/Mapper/solvers/exact/core.py +183 -0
  132. synkit/Chem/Mapper/solvers/exact/distance_search/__init__.py +1 -0
  133. synkit/Chem/Mapper/solvers/exact/distance_search/bounds.py +319 -0
  134. synkit/Chem/Mapper/solvers/exact/distance_search/exhaustive.py +179 -0
  135. synkit/Chem/Mapper/solvers/exact/distance_search/inputs.py +283 -0
  136. synkit/Chem/Mapper/solvers/exact/distance_search/records.py +242 -0
  137. synkit/Chem/Mapper/solvers/exact/distance_search/search.py +1025 -0
  138. synkit/Chem/Mapper/solvers/exact/distance_search/verify.py +378 -0
  139. synkit/Chem/Mapper/solvers/exact/edit_support.py +375 -0
  140. synkit/Chem/Mapper/solvers/exact/hybrid.py +224 -0
  141. synkit/Chem/Mapper/solvers/exact/hydrogen.py +264 -0
  142. synkit/Chem/Mapper/solvers/exact/kernel_solvers/__init__.py +1 -0
  143. synkit/Chem/Mapper/solvers/exact/kernel_solvers/branching.py +499 -0
  144. synkit/Chem/Mapper/solvers/exact/kernel_solvers/enumerate.py +1050 -0
  145. synkit/Chem/Mapper/solvers/exact/kernel_solvers/enumeration_result.py +30 -0
  146. synkit/Chem/Mapper/solvers/exact/kernel_solvers/kernel.py +256 -0
  147. synkit/Chem/Mapper/solvers/exact/kernel_solvers/milp.py +194 -0
  148. synkit/Chem/Mapper/solvers/exact/native/__init__.py +1 -0
  149. synkit/Chem/Mapper/solvers/exact/native/build.py +154 -0
  150. synkit/Chem/Mapper/solvers/exact/native/candidates.py +593 -0
  151. synkit/Chem/Mapper/solvers/exact/native/canonical.py +396 -0
  152. synkit/Chem/Mapper/solvers/exact/native/disk_frontier.py +415 -0
  153. synkit/Chem/Mapper/solvers/exact/native/frontier.py +390 -0
  154. synkit/Chem/Mapper/solvers/exact/native/hydrogen_quotient.py +213 -0
  155. synkit/Chem/Mapper/solvers/exact/native/its.py +528 -0
  156. synkit/Chem/Mapper/solvers/exact/native/native_distance.cpp +2803 -0
  157. synkit/Chem/Mapper/solvers/exact/native/orbit_aggregation.py +328 -0
  158. synkit/Chem/Mapper/solvers/exact/native/parallel.py +205 -0
  159. synkit/Chem/Mapper/solvers/exact/native/pmcd.py +203 -0
  160. synkit/Chem/Mapper/solvers/exact/native/runtime.py +40 -0
  161. synkit/Chem/Mapper/solvers/exact/native/search.py +294 -0
  162. synkit/Chem/Mapper/solvers/exact/native/separator.py +224 -0
  163. synkit/Chem/Mapper/solvers/exact/native_build.py +12 -0
  164. synkit/Chem/Mapper/solvers/exact/pabs/__init__.py +1 -0
  165. synkit/Chem/Mapper/solvers/exact/pabs/cost_lattice.py +43 -0
  166. synkit/Chem/Mapper/solvers/exact/pabs/factor_spectrum.py +110 -0
  167. synkit/Chem/Mapper/solvers/exact/pabs/multi_shell.py +368 -0
  168. synkit/Chem/Mapper/solvers/exact/pabs/propagation.py +679 -0
  169. synkit/Chem/Mapper/solvers/exact/pabs/propagation_bounds.py +436 -0
  170. synkit/Chem/Mapper/solvers/exact/pabs/propagation_limits.py +13 -0
  171. synkit/Chem/Mapper/solvers/exact/pabs/propagation_search.py +856 -0
  172. synkit/Chem/Mapper/solvers/exact/pabs/propagation_symmetry.py +66 -0
  173. synkit/Chem/Mapper/solvers/exact/pabs/residual_typed_bonds.py +136 -0
  174. synkit/Chem/Mapper/solvers/exact/pabs/reward_frontier.py +201 -0
  175. synkit/Chem/Mapper/solvers/exact/pabs/separator_bound.py +258 -0
  176. synkit/Chem/Mapper/solvers/exact/pabs/separator_spectrum.py +308 -0
  177. synkit/Chem/Mapper/solvers/exact/pabs/sparse_reward_bound.py +207 -0
  178. synkit/Chem/Mapper/solvers/exact/pabs/suffix_spectrum.py +299 -0
  179. synkit/Chem/Mapper/solvers/exact/search.py +55 -0
  180. synkit/Chem/Mapper/solvers/exact/seeds/__init__.py +1 -0
  181. synkit/Chem/Mapper/solvers/exact/seeds/seed.py +104 -0
  182. synkit/Chem/Mapper/solvers/exact/seeds/seed_fragments.py +148 -0
  183. synkit/Chem/Mapper/solvers/exact/seeds/seed_relaxation.py +181 -0
  184. synkit/Chem/Mapper/solvers/exact/symmetry.py +223 -0
  185. synkit/Chem/Mapper/solvers/native/__init__.py +4 -0
  186. synkit/Chem/Mapper/solvers/native/assignment.py +99 -0
  187. synkit/Chem/Mapper/solvers/native/astar.py +22 -0
  188. synkit/Chem/Mapper/solvers/native/build.py +385 -0
  189. synkit/Chem/Mapper/solvers/native/classification.py +641 -0
  190. synkit/Chem/Mapper/solvers/native/core.py +378 -0
  191. synkit/Chem/Mapper/solvers/native/cpp/CMakeLists.txt +120 -0
  192. synkit/Chem/Mapper/solvers/native/cpp/examples/map_reaction.cpp +29 -0
  193. synkit/Chem/Mapper/solvers/native/cpp/examples/slap_graph.cpp +63 -0
  194. synkit/Chem/Mapper/solvers/native/cpp/include/synkit_mapper/assignment/assignment.h +18 -0
  195. synkit/Chem/Mapper/solvers/native/cpp/include/synkit_mapper/astar/astar.h +18 -0
  196. synkit/Chem/Mapper/solvers/native/cpp/include/synkit_mapper/astar/bound.h +33 -0
  197. synkit/Chem/Mapper/solvers/native/cpp/include/synkit_mapper/core/pmcd_witness.h +16 -0
  198. synkit/Chem/Mapper/solvers/native/cpp/include/synkit_mapper/core/runtime.h +130 -0
  199. synkit/Chem/Mapper/solvers/native/cpp/include/synkit_mapper/hydrogen/hydrogen.h +73 -0
  200. synkit/Chem/Mapper/solvers/native/cpp/include/synkit_mapper/mapper.h +175 -0
  201. synkit/Chem/Mapper/solvers/native/cpp/include/synkit_mapper/mces/mces.h +9 -0
  202. synkit/Chem/Mapper/solvers/native/cpp/include/synkit_mapper/pabs/seed.h +34 -0
  203. synkit/Chem/Mapper/solvers/native/cpp/include/synkit_mapper/reaction/reaction.h +30 -0
  204. synkit/Chem/Mapper/solvers/native/cpp/include/synkit_mapper/sepdp/sepdp.h +21 -0
  205. synkit/Chem/Mapper/solvers/native/cpp/include/synkit_mapper/slap.h +72 -0
  206. synkit/Chem/Mapper/solvers/native/cpp/include/synkit_mapper/solvers/solvers.h +16 -0
  207. synkit/Chem/Mapper/solvers/native/cpp/include/synkit_mapper/symmetry/classification.h +140 -0
  208. synkit/Chem/Mapper/solvers/native/cpp/include/synkit_mapper/symmetry/cpabs.h +33 -0
  209. synkit/Chem/Mapper/solvers/native/cpp/src/assignment/abb.cpp +302 -0
  210. synkit/Chem/Mapper/solvers/native/cpp/src/astar/CMakeLists.txt +12 -0
  211. synkit/Chem/Mapper/solvers/native/cpp/src/astar/README.md +47 -0
  212. synkit/Chem/Mapper/solvers/native/cpp/src/astar/astar.cpp +228 -0
  213. synkit/Chem/Mapper/solvers/native/cpp/src/astar/astar_graph.cpp +37 -0
  214. synkit/Chem/Mapper/solvers/native/cpp/src/astar/bound.cpp +212 -0
  215. synkit/Chem/Mapper/solvers/native/cpp/src/core/dispatch.cpp +272 -0
  216. synkit/Chem/Mapper/solvers/native/cpp/src/core/pmcd_witness.cpp +36 -0
  217. synkit/Chem/Mapper/solvers/native/cpp/src/hydrogen/hydrogen.cpp +380 -0
  218. synkit/Chem/Mapper/solvers/native/cpp/src/mces/README.md +57 -0
  219. synkit/Chem/Mapper/solvers/native/cpp/src/mces/mces.cpp +287 -0
  220. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/bridge.cpp +334 -0
  221. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/chemical_floor.inc +181 -0
  222. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/endpoint_symmetry.inc +104 -0
  223. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/exact_helpers.h +20 -0
  224. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/lp_assignment_certificate.h +165 -0
  225. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/lp_certificate.h +125 -0
  226. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/lp_model.h +365 -0
  227. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/lp_provider.inc +319 -0
  228. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/lp_rounding.inc +170 -0
  229. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/lp_test_hooks.h +342 -0
  230. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/objective_reduction.inc +137 -0
  231. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/overlap_dual.inc +351 -0
  232. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/profile_seed.inc +214 -0
  233. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/seed_heuristics.inc +640 -0
  234. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/sparse_embedding.cpp +430 -0
  235. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/sparse_root_lp.h +176 -0
  236. synkit/Chem/Mapper/solvers/native/cpp/src/pabs/test_hooks.inc +262 -0
  237. synkit/Chem/Mapper/solvers/native/cpp/src/reaction/reaction.cpp +611 -0
  238. synkit/Chem/Mapper/solvers/native/cpp/src/sepdp/README.md +61 -0
  239. synkit/Chem/Mapper/solvers/native/cpp/src/sepdp/sepdp.cpp +253 -0
  240. synkit/Chem/Mapper/solvers/native/cpp/src/slap.cpp +810 -0
  241. synkit/Chem/Mapper/solvers/native/cpp/src/solvers/formulation.h +138 -0
  242. synkit/Chem/Mapper/solvers/native/cpp/src/solvers/maxsat.cpp +526 -0
  243. synkit/Chem/Mapper/solvers/native/cpp/src/solvers/ortools.cpp +475 -0
  244. synkit/Chem/Mapper/solvers/native/cpp/src/solvers/seed.h +80 -0
  245. synkit/Chem/Mapper/solvers/native/cpp/src/solvers/weighted_cnf.h +256 -0
  246. synkit/Chem/Mapper/solvers/native/cpp/src/supporting/README.md +43 -0
  247. synkit/Chem/Mapper/solvers/native/cpp/src/supporting/dfs.cpp +123 -0
  248. synkit/Chem/Mapper/solvers/native/cpp/src/supporting/edit_support.cpp +224 -0
  249. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/classification.cpp +553 -0
  250. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/classification_pipeline.cpp +124 -0
  251. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/classification_stream.h +13 -0
  252. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/cpabs.cpp +455 -0
  253. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/edge_deck.cpp +743 -0
  254. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/vendor/nauty/COPYRIGHT +44 -0
  255. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/vendor/nauty/LICENSE-2.0.txt +202 -0
  256. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/vendor/nauty/naugraph.c +732 -0
  257. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/vendor/nauty/naurng.c +94 -0
  258. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/vendor/nauty/naurng.h +49 -0
  259. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/vendor/nauty/nausparse.c +1771 -0
  260. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/vendor/nauty/nausparse.h +133 -0
  261. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/vendor/nauty/nautil.c +750 -0
  262. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/vendor/nauty/naututil.h +355 -0
  263. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/vendor/nauty/nauty.c +1256 -0
  264. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/vendor/nauty/nauty.h +1544 -0
  265. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/vendor/nauty/schreier.c +1131 -0
  266. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/vendor/nauty/schreier.h +70 -0
  267. synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/vendor/nauty/sorttemplates.c +580 -0
  268. synkit/Chem/Mapper/solvers/native/hydrogen.py +711 -0
  269. synkit/Chem/Mapper/solvers/native/implicit.py +506 -0
  270. synkit/Chem/Mapper/solvers/native/implicit_certificate.py +187 -0
  271. synkit/Chem/Mapper/solvers/native/implicit_preparation.py +309 -0
  272. synkit/Chem/Mapper/solvers/native/lib/synkit_mapper.dll +0 -0
  273. synkit/Chem/Mapper/solvers/native/mces.py +16 -0
  274. synkit/Chem/Mapper/solvers/native/reaction.py +179 -0
  275. synkit/Chem/Mapper/solvers/native/reaction_build.py +277 -0
  276. synkit/Chem/Mapper/solvers/native/reaction_text.py +26 -0
  277. synkit/Chem/Mapper/solvers/native/runtime.py +242 -0
  278. synkit/Chem/Mapper/solvers/native/sepdp.py +47 -0
  279. synkit/Chem/Mapper/solvers/native/slap.py +266 -0
  280. synkit/Chem/Mapper/solvers/native/solvers.py +67 -0
  281. synkit/Chem/Mapper/solvers/native/stereo.py +86 -0
  282. synkit/Chem/Mapper/solvers/native/supporting.py +34 -0
  283. synkit/Chem/Mapper/solvers/native/symmetry.py +91 -0
  284. synkit/Chem/Mapper/solvers/slap/__init__.py +29 -0
  285. synkit/Chem/Mapper/solvers/slap/lap.py +174 -0
  286. synkit/Chem/Mapper/solvers/slap/sequential.py +696 -0
  287. synkit/Chem/Mapper/validation/__init__.py +1 -0
  288. synkit/Chem/Mapper/validation/aam_validator.py +442 -0
  289. synkit/Chem/Mapper/validation/annotations.py +274 -0
  290. synkit/Chem/Mapper/validation/bonds.py +124 -0
  291. synkit/Chem/Mapper/validation/cohorts.py +72 -0
  292. synkit/Chem/Mapper/validation/identifiability.py +150 -0
  293. synkit/Chem/Mapper/validation/numerical_scope.py +36 -0
  294. synkit/Chem/Mapper/validation/orbits.py +137 -0
  295. synkit/Chem/Molecule/__init__.py +0 -0
  296. synkit/Chem/Molecule/_chirality_loci.py +165 -0
  297. synkit/Chem/Molecule/_chirality_types.py +231 -0
  298. synkit/Chem/Molecule/_helical_loci.py +167 -0
  299. synkit/Chem/Molecule/_stereo_axis_evidence.py +202 -0
  300. synkit/Chem/Molecule/_stereo_element_detection.py +193 -0
  301. synkit/Chem/Molecule/_stereo_orientation_constraints.py +511 -0
  302. synkit/Chem/Molecule/_tetrahedral_carriers.py +63 -0
  303. synkit/Chem/Molecule/atom_features.py +379 -0
  304. synkit/Chem/Molecule/chirality.py +1041 -0
  305. synkit/Chem/Molecule/cip_assignment.py +569 -0
  306. synkit/Chem/Molecule/cip_ranking.py +843 -0
  307. synkit/Chem/Molecule/coordinate_stereo.py +503 -0
  308. synkit/Chem/Molecule/derived_stereo_naming.py +165 -0
  309. synkit/Chem/Molecule/descriptors.py +452 -0
  310. synkit/Chem/Molecule/formula.py +249 -0
  311. synkit/Chem/Molecule/global_stereo.py +175 -0
  312. synkit/Chem/Molecule/graph_annotator.py +300 -0
  313. synkit/Chem/Molecule/standardize.py +817 -0
  314. synkit/Chem/Molecule/stereo_evidence.py +179 -0
  315. synkit/Chem/Molecule/stereo_perception.py +1032 -0
  316. synkit/Chem/Molecule/valence.py +123 -0
  317. synkit/Chem/Reaction/Mapper/__init__.py +44 -0
  318. synkit/Chem/Reaction/__init__.py +20 -0
  319. synkit/Chem/Reaction/aam_validator.py +5 -0
  320. synkit/Chem/Reaction/balance_check.py +138 -0
  321. synkit/Chem/Reaction/canon_rsmi.py +249 -0
  322. synkit/Chem/Reaction/cleaning.py +58 -0
  323. synkit/Chem/Reaction/deionize.py +199 -0
  324. synkit/Chem/Reaction/explicit_h_audit.py +232 -0
  325. synkit/Chem/Reaction/fix_aam.py +64 -0
  326. synkit/Chem/Reaction/neutralize.py +207 -0
  327. synkit/Chem/Reaction/radical_wildcard.py +224 -0
  328. synkit/Chem/Reaction/standardize.py +203 -0
  329. synkit/Chem/Reaction/tautomerize.py +205 -0
  330. synkit/Chem/__init__.py +1 -0
  331. synkit/Chem/utils.py +315 -0
  332. synkit/Data/__init__.py +0 -0
  333. synkit/Data/aldol.json.gz +1 -0
  334. synkit/Data/gen_partial_aam.py +147 -0
  335. synkit/Data/paracetamol.json.gz +1 -0
  336. synkit/Graph/Canon/__init__.py +16 -0
  337. synkit/Graph/Canon/_native/__init__.py +13 -0
  338. synkit/Graph/Canon/_native/build.py +93 -0
  339. synkit/Graph/Canon/_native/lib/synkit_canon.dll +0 -0
  340. synkit/Graph/Canon/_native/prepare.py +49 -0
  341. synkit/Graph/Canon/_native/runtime.py +140 -0
  342. synkit/Graph/Canon/_native/search.py +137 -0
  343. synkit/Graph/Canon/canon_algs.py +228 -0
  344. synkit/Graph/Canon/canon_graph.py +531 -0
  345. synkit/Graph/Canon/cpp/CMakeLists.txt +42 -0
  346. synkit/Graph/Canon/cpp/README.md +123 -0
  347. synkit/Graph/Canon/cpp/examples/canonical_graph.cpp +16 -0
  348. synkit/Graph/Canon/cpp/include/synkit_canon/canon.h +85 -0
  349. synkit/Graph/Canon/cpp/src/canonical.cpp +391 -0
  350. synkit/Graph/Canon/cpp/src/symmetry.h +83 -0
  351. synkit/Graph/Canon/cpp/tests/symmetry.cpp +93 -0
  352. synkit/Graph/Canon/exact.py +1020 -0
  353. synkit/Graph/Canon/exact_refinement.py +368 -0
  354. synkit/Graph/Canon/nauty.py +143 -0
  355. synkit/Graph/Context/__init__.py +0 -0
  356. synkit/Graph/Context/hier_context.py +244 -0
  357. synkit/Graph/Context/radius_expand.py +252 -0
  358. synkit/Graph/FG/__init__.py +19 -0
  359. synkit/Graph/FG/api.py +39 -0
  360. synkit/Graph/FG/audit.py +155 -0
  361. synkit/Graph/FG/catalog.py +919 -0
  362. synkit/Graph/FG/detector.py +288 -0
  363. synkit/Graph/FG/model.py +97 -0
  364. synkit/Graph/FG/recognizers.py +274 -0
  365. synkit/Graph/FG/ring_system.py +154 -0
  366. synkit/Graph/Feature/Descriptors/topology.py +857 -0
  367. synkit/Graph/Feature/Fingerprint/__init__.py +0 -0
  368. synkit/Graph/Feature/Fingerprint/wl_rxn_fps.py +222 -0
  369. synkit/Graph/Feature/__init__.py +5 -0
  370. synkit/Graph/Feature/graph_descriptors.py +323 -0
  371. synkit/Graph/Feature/graph_fps.py +96 -0
  372. synkit/Graph/Feature/graph_signature.py +239 -0
  373. synkit/Graph/Feature/hash_fps.py +133 -0
  374. synkit/Graph/Feature/morgan_fps.py +88 -0
  375. synkit/Graph/Feature/path_fps.py +81 -0
  376. synkit/Graph/Feature/wl_hash.py +134 -0
  377. synkit/Graph/Fusion/__init__.py +85 -0
  378. synkit/Graph/Fusion/candidate.py +559 -0
  379. synkit/Graph/Fusion/constructor.py +877 -0
  380. synkit/Graph/Fusion/identity.py +184 -0
  381. synkit/Graph/Fusion/interface.py +700 -0
  382. synkit/Graph/Fusion/search.py +241 -0
  383. synkit/Graph/Hyrogen/__init__.py +6 -0
  384. synkit/Graph/Hyrogen/_misc.py +591 -0
  385. synkit/Graph/Hyrogen/hcomplete.py +995 -0
  386. synkit/Graph/Hyrogen/hcomplete_legacy.py +368 -0
  387. synkit/Graph/Hyrogen/hcompletion_algorithms.py +713 -0
  388. synkit/Graph/Hyrogen/hextend.py +570 -0
  389. synkit/Graph/Hyrogen/hextend_legacy.py +215 -0
  390. synkit/Graph/ITS/__init__.py +4 -0
  391. synkit/Graph/ITS/its_builder.py +120 -0
  392. synkit/Graph/ITS/its_construction.py +719 -0
  393. synkit/Graph/ITS/its_decompose.py +572 -0
  394. synkit/Graph/ITS/its_destruction.py +331 -0
  395. synkit/Graph/ITS/its_expand.py +1251 -0
  396. synkit/Graph/ITS/its_relabel.py +187 -0
  397. synkit/Graph/ITS/its_reverter.py +356 -0
  398. synkit/Graph/ITS/normalize_aam.py +145 -0
  399. synkit/Graph/ITS/partial_its.py +238 -0
  400. synkit/Graph/ITS/rc_extractor.py +656 -0
  401. synkit/Graph/ITS/stereo.py +74 -0
  402. synkit/Graph/MTG/__init__.py +107 -0
  403. synkit/Graph/MTG/gluing.py +451 -0
  404. synkit/Graph/MTG/history.py +928 -0
  405. synkit/Graph/MTG/inventory.py +118 -0
  406. synkit/Graph/MTG/local.py +447 -0
  407. synkit/Graph/MTG/mcs_matcher.py +246 -0
  408. synkit/Graph/MTG/mtg.py +611 -0
  409. synkit/Graph/MTG/mtg_explore.py +74 -0
  410. synkit/Graph/MTG/observation.py +209 -0
  411. synkit/Graph/MTG/process.py +577 -0
  412. synkit/Graph/MTG/queries.py +66 -0
  413. synkit/Graph/MTG/realization.py +95 -0
  414. synkit/Graph/MTG/series_parallel.py +107 -0
  415. synkit/Graph/MTG/utils.py +424 -0
  416. synkit/Graph/Matcher/__init__.py +10 -0
  417. synkit/Graph/Matcher/approx_mcs.py +1264 -0
  418. synkit/Graph/Matcher/auto_est.py +736 -0
  419. synkit/Graph/Matcher/automorphism.py +314 -0
  420. synkit/Graph/Matcher/batch_cluster.py +224 -0
  421. synkit/Graph/Matcher/dedup_matches.py +247 -0
  422. synkit/Graph/Matcher/graph_cluster.py +191 -0
  423. synkit/Graph/Matcher/graph_matcher.py +312 -0
  424. synkit/Graph/Matcher/graph_morphism.py +421 -0
  425. synkit/Graph/Matcher/mcs_matcher.py +804 -0
  426. synkit/Graph/Matcher/multi_turbo_iso.py +186 -0
  427. synkit/Graph/Matcher/orbit.py +284 -0
  428. synkit/Graph/Matcher/partial_matcher.py +694 -0
  429. synkit/Graph/Matcher/sing.py +544 -0
  430. synkit/Graph/Matcher/subgraph_matcher.py +812 -0
  431. synkit/Graph/Matcher/turbo_iso.py +272 -0
  432. synkit/Graph/Matcher/wl_sel.py +537 -0
  433. synkit/Graph/Mech/__init__.py +26 -0
  434. synkit/Graph/Mech/conversion.py +1466 -0
  435. synkit/Graph/Mech/conversion_debug.py +237 -0
  436. synkit/Graph/Mech/electron_accounting.py +200 -0
  437. synkit/Graph/Mech/lwg_editor.py +406 -0
  438. synkit/Graph/Mech/lwg_ops.py +313 -0
  439. synkit/Graph/Morphism/__init__.py +99 -0
  440. synkit/Graph/Morphism/constraints.py +460 -0
  441. synkit/Graph/Morphism/llg.py +999 -0
  442. synkit/Graph/Morphism/morphism.py +349 -0
  443. synkit/Graph/Morphism/stereo.py +258 -0
  444. synkit/Graph/Morphism/stereo_morphism.py +383 -0
  445. synkit/Graph/Morphism/stereo_morphism_helpers.py +957 -0
  446. synkit/Graph/Morphism/stereo_morphism_types.py +117 -0
  447. synkit/Graph/Stereo/__init__.py +376 -0
  448. synkit/Graph/Stereo/_descriptor_core.py +207 -0
  449. synkit/Graph/Stereo/_descriptor_serialization.py +138 -0
  450. synkit/Graph/Stereo/canonical.py +648 -0
  451. synkit/Graph/Stereo/changes.py +964 -0
  452. synkit/Graph/Stereo/composition.py +391 -0
  453. synkit/Graph/Stereo/configured.py +946 -0
  454. synkit/Graph/Stereo/couplings.py +245 -0
  455. synkit/Graph/Stereo/descriptors.py +1030 -0
  456. synkit/Graph/Stereo/enumeration.py +597 -0
  457. synkit/Graph/Stereo/extended_descriptors.py +406 -0
  458. synkit/Graph/Stereo/global_configured.py +152 -0
  459. synkit/Graph/Stereo/global_stereo.py +304 -0
  460. synkit/Graph/Stereo/identity.py +648 -0
  461. synkit/Graph/Stereo/interchange.py +496 -0
  462. synkit/Graph/Stereo/legacy.py +460 -0
  463. synkit/Graph/Stereo/matching.py +899 -0
  464. synkit/Graph/Stereo/native.py +154 -0
  465. synkit/Graph/Stereo/orbits.py +668 -0
  466. synkit/Graph/Stereo/outcomes.py +99 -0
  467. synkit/Graph/Stereo/pairwise.py +350 -0
  468. synkit/Graph/Stereo/rdkit_adapter.py +662 -0
  469. synkit/Graph/Stereo/rdkit_identity.py +118 -0
  470. synkit/Graph/Stereo/rdkit_resonance.py +140 -0
  471. synkit/Graph/Stereo/reaction_interchange.py +266 -0
  472. synkit/Graph/Stereo/semantics.py +296 -0
  473. synkit/Graph/Stereo/supports.py +257 -0
  474. synkit/Graph/Stereo/wire.py +339 -0
  475. synkit/Graph/Wildcard/__init__.py +0 -0
  476. synkit/Graph/Wildcard/fuse_graph.py +156 -0
  477. synkit/Graph/Wildcard/graph_wc.py +303 -0
  478. synkit/Graph/Wildcard/its_merge.py +857 -0
  479. synkit/Graph/Wildcard/radwc.py +114 -0
  480. synkit/Graph/Wildcard/wc_matcher.py +576 -0
  481. synkit/Graph/Wildcard/wildcard.py +225 -0
  482. synkit/Graph/__init__.py +17 -0
  483. synkit/Graph/canon_graph.py +14 -0
  484. synkit/Graph/syn_graph.py +199 -0
  485. synkit/Graph/utils.py +324 -0
  486. synkit/IO/__init__.py +4 -0
  487. synkit/IO/chem_converter.py +1059 -0
  488. synkit/IO/combinatorial/__init__.py +8 -0
  489. synkit/IO/combinatorial/gml_to_graph.py +223 -0
  490. synkit/IO/combinatorial/graph_to_gml.py +280 -0
  491. synkit/IO/combinatorial/graph_to_smarts.py +186 -0
  492. synkit/IO/combinatorial/smarts_expander.py +147 -0
  493. synkit/IO/combinatorial/smarts_generalizer.py +133 -0
  494. synkit/IO/combinatorial/smarts_to_graph.py +179 -0
  495. synkit/IO/conversion.py +42 -0
  496. synkit/IO/data_io.py +269 -0
  497. synkit/IO/data_process.py +143 -0
  498. synkit/IO/debug.py +73 -0
  499. synkit/IO/gml_to_nx.py +150 -0
  500. synkit/IO/graph_to_mol.py +199 -0
  501. synkit/IO/mol_to_graph.py +1105 -0
  502. synkit/IO/mol_to_graph_chemistry.py +545 -0
  503. synkit/IO/nx_to_gml.py +209 -0
  504. synkit/IO/smiles_to_id.py +123 -0
  505. synkit/Mechanism/__init__.py +151 -0
  506. synkit/Mechanism/adapters.py +136 -0
  507. synkit/Mechanism/audit.py +323 -0
  508. synkit/Mechanism/benchmark.py +638 -0
  509. synkit/Mechanism/compatibility.py +13 -0
  510. synkit/Mechanism/drawing.py +85 -0
  511. synkit/Mechanism/electron_models.py +725 -0
  512. synkit/Mechanism/equivalence.py +521 -0
  513. synkit/Mechanism/evidence.py +262 -0
  514. synkit/Mechanism/interchange.py +141 -0
  515. synkit/Mechanism/model.py +918 -0
  516. synkit/Mechanism/neighbor_stereo.py +312 -0
  517. synkit/Mechanism/radical_data.py +740 -0
  518. synkit/Mechanism/replay.py +986 -0
  519. synkit/Mechanism/schema.py +264 -0
  520. synkit/Mechanism/stereo_state.py +416 -0
  521. synkit/Mechanism/symbols.py +91 -0
  522. synkit/Rule/Apply/__init__.py +35 -0
  523. synkit/Rule/Apply/conditions.py +45 -0
  524. synkit/Rule/Apply/dpo.py +998 -0
  525. synkit/Rule/Apply/rule_matcher.py +218 -0
  526. synkit/Rule/Apply/validation.py +354 -0
  527. synkit/Rule/Compose/__init__.py +106 -0
  528. synkit/Rule/Compose/_identity.py +43 -0
  529. synkit/Rule/Compose/composition.py +976 -0
  530. synkit/Rule/Compose/laws.py +439 -0
  531. synkit/Rule/Compose/search.py +771 -0
  532. synkit/Rule/Compose/synrule.py +170 -0
  533. synkit/Rule/Modify/__init__.py +0 -0
  534. synkit/Rule/Modify/implict_rule.py +56 -0
  535. synkit/Rule/Modify/longest_path.py +92 -0
  536. synkit/Rule/Modify/molecule_rule.py +115 -0
  537. synkit/Rule/Modify/prune_templates.py +78 -0
  538. synkit/Rule/Modify/rule_utils.py +194 -0
  539. synkit/Rule/Modify/strip_rule.py +97 -0
  540. synkit/Rule/__init__.py +28 -0
  541. synkit/Rule/generic_stereo.py +884 -0
  542. synkit/Rule/stereo_identity.py +271 -0
  543. synkit/Rule/syn_rule.py +1090 -0
  544. synkit/Synthesis/MSR/__init__.py +0 -0
  545. synkit/Synthesis/MSR/path_finder.py +239 -0
  546. synkit/Synthesis/Metrics/__init__.py +0 -0
  547. synkit/Synthesis/Metrics/_base.py +52 -0
  548. synkit/Synthesis/Metrics/_plot.py +129 -0
  549. synkit/Synthesis/Metrics/_ranking.py +179 -0
  550. synkit/Synthesis/RBL/__init__.py +80 -0
  551. synkit/Synthesis/RBL/engine.py +1249 -0
  552. synkit/Synthesis/RBL/matching.py +652 -0
  553. synkit/Synthesis/RBL/overlap.py +336 -0
  554. synkit/Synthesis/RBL/pipeline.py +376 -0
  555. synkit/Synthesis/RBL/policy.py +139 -0
  556. synkit/Synthesis/RBL/proof.py +370 -0
  557. synkit/Synthesis/RBL/reaction.py +506 -0
  558. synkit/Synthesis/RBL/state.py +169 -0
  559. synkit/Synthesis/RBL/validation.py +1060 -0
  560. synkit/Synthesis/Reactor/__init__.py +60 -0
  561. synkit/Synthesis/Reactor/core/__init__.py +1 -0
  562. synkit/Synthesis/Reactor/core/engine.py +967 -0
  563. synkit/Synthesis/Reactor/core/product.py +621 -0
  564. synkit/Synthesis/Reactor/core/rewrite.py +561 -0
  565. synkit/Synthesis/Reactor/core/strategy.py +44 -0
  566. synkit/Synthesis/Reactor/matching/__init__.py +1 -0
  567. synkit/Synthesis/Reactor/matching/mixin.py +920 -0
  568. synkit/Synthesis/Reactor/matching/policy.py +345 -0
  569. synkit/Synthesis/Reactor/matching/symmetry.py +309 -0
  570. synkit/Synthesis/Reactor/output/__init__.py +1 -0
  571. synkit/Synthesis/Reactor/output/deduplication.py +703 -0
  572. synkit/Synthesis/Reactor/output/policy.py +16 -0
  573. synkit/Synthesis/Reactor/output/serialization.py +485 -0
  574. synkit/Synthesis/Reactor/output/structural.py +893 -0
  575. synkit/Synthesis/Reactor/stereo/__init__.py +1 -0
  576. synkit/Synthesis/Reactor/stereo/assignment.py +35 -0
  577. synkit/Synthesis/Reactor/stereo/mixin.py +780 -0
  578. synkit/Synthesis/Reactor/variants/__init__.py +1 -0
  579. synkit/Synthesis/Reactor/variants/imbalanced.py +180 -0
  580. synkit/Synthesis/Reactor/variants/partial.py +84 -0
  581. synkit/Synthesis/Reactor/workflow/__init__.py +1 -0
  582. synkit/Synthesis/Reactor/workflow/batch.py +550 -0
  583. synkit/Synthesis/Reactor/workflow/benchmark.py +143 -0
  584. synkit/Synthesis/Reactor/workflow/postprocess.py +267 -0
  585. synkit/Synthesis/Reactor/workflow/rule_filter.py +210 -0
  586. synkit/Synthesis/__init__.py +0 -0
  587. synkit/Synthesis/reactor_utils.py +316 -0
  588. synkit/Utils/__init__.py +0 -0
  589. synkit/Utils/utils.py +172 -0
  590. synkit/Vis/__init__.py +91 -0
  591. synkit/Vis/crn/__init__.py +40 -0
  592. synkit/Vis/epd/__init__.py +20 -0
  593. synkit/Vis/epd/arrows.py +425 -0
  594. synkit/Vis/epd/chem.py +197 -0
  595. synkit/Vis/epd/constants.py +83 -0
  596. synkit/Vis/epd/layout.py +283 -0
  597. synkit/Vis/epd/mapping.py +51 -0
  598. synkit/Vis/epd/models.py +136 -0
  599. synkit/Vis/epd/render.py +543 -0
  600. synkit/Vis/epd/utils.py +108 -0
  601. synkit/Vis/epd/visualizer.py +811 -0
  602. synkit/Vis/graph_visualizer.py +375 -0
  603. synkit/Vis/its/__init__.py +19 -0
  604. synkit/Vis/its/drawer.py +615 -0
  605. synkit/Vis/its_drawer.py +35 -0
  606. synkit/Vis/molecule/__init__.py +31 -0
  607. synkit/Vis/molecule/drawer.py +563 -0
  608. synkit/Vis/molecule/reaction.py +285 -0
  609. synkit/Vis/molecule_drawer.py +33 -0
  610. synkit/Vis/mtg/__init__.py +17 -0
  611. synkit/Vis/mtg/drawer.py +769 -0
  612. synkit/Vis/mtg_drawer.py +34 -0
  613. synkit/Vis/pdf_writer.py +146 -0
  614. synkit/Vis/reaction/__init__.py +19 -0
  615. synkit/Vis/reaction/rule.py +141 -0
  616. synkit/Vis/reaction/rxn.py +532 -0
  617. synkit/Vis/reaction_drawer.py +41 -0
  618. synkit/Vis/space/__init__.py +17 -0
  619. synkit/Vis/space/chemical.py +80 -0
  620. synkit/Vis/space/embedding.py +87 -0
  621. synkit/Vis/vis_synedu/Vis/__init__.py +7 -0
  622. synkit/Vis/vis_synedu/Vis/dpo.py +862 -0
  623. synkit/Vis/vis_synedu/rxn_vis.py +377 -0
  624. synkit/Vis/vis_synedu/vis.py +501 -0
  625. synkit/Vis/visual_drawer.py +215 -0
  626. synkit/Vis/visual_model.py +520 -0
  627. synkit/__init__.py +3 -0
  628. synkit/_native.py +91 -0
  629. synkit/examples.py +50 -0
  630. synkit/version.py +23 -0
  631. synkit-1.6.5.dist-info/METADATA +156 -0
  632. synkit-1.6.5.dist-info/RECORD +636 -0
  633. synkit-1.6.5.dist-info/WHEEL +4 -0
  634. synkit-1.6.5.dist-info/licenses/LICENSE +21 -0
  635. synkit-1.6.5.dist-info/licenses/synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/vendor/nauty/COPYRIGHT +44 -0
  636. synkit-1.6.5.dist-info/licenses/synkit/Chem/Mapper/solvers/native/cpp/src/symmetry/vendor/nauty/LICENSE-2.0.txt +202 -0
@@ -0,0 +1,1256 @@
1
+ /*****************************************************************************
2
+ * *
3
+ * Main source file for version 2.9 of nauty. *
4
+ * *
5
+ * Copyright (1984-) Brendan McKay. *
6
+ * Subject to the conditions and disclaimers in the file COPYRIGHT. *
7
+ * *
8
+ * CHANGE HISTORY *
9
+ * 10-Nov-87 : final changes for version 1.2 *
10
+ * 5-Dec-87 : renamed to version 1.3 (no changes to this file) *
11
+ * 28-Sep-88 : renamed to version 1.4 (no changes to this file) *
12
+ * 23-Mar-89 : changes for version 1.5 : *
13
+ * - add use of refine1 instead of refine for m==1 *
14
+ * - changes for new optionblk syntax *
15
+ * - disable tc_level use for digraphs *
16
+ * - interposed doref() interface to refine() so that *
17
+ * options.invarproc can be supported *
18
+ * - declared local routines static *
19
+ * 28-Mar-89 : - implemented mininvarlevel/maxinvarlevel < 0 options *
20
+ * 2-Apr-89 : - added invarproc fields in stats *
21
+ * 5-Apr-89 : - modified error returns from nauty() *
22
+ * - added error message to ERRFILE *
23
+ * - changed MAKEEMPTY uses to EMPTYSET *
24
+ * 18-Apr-89 : - added MTOOBIG and CANONGNIL *
25
+ * 8-May-89 : - changed firstcode[] and canoncode[] to short *
26
+ * 10-Nov-90 : changes for version 1.6 : *
27
+ * - added dummy routine nauty_null (see dreadnaut.c) *
28
+ * 2-Sep-91 : changes for version 1.7 : *
29
+ * - moved MULTIPLY into nauty.h *
30
+ * 27-Mar-92 : - changed 'n' into 'm' in error message in nauty() *
31
+ * 5-Jun-93 : renamed to version 1.7+ (no changes to this file) *
32
+ * 18-Aug-93 : renamed to version 1.8 (no changes to this file) *
33
+ * 17-Sep-93 : renamed to version 1.9 (no changes to this file) *
34
+ * 13-Jul-96 : changes for version 2.0 : *
35
+ * - added dynamic allocation *
36
+ * 21-Oct-98 : - made short into shortish for BIGNAUTY as needed *
37
+ * 7-Jan-00 : - allowed n=0 *
38
+ * - added nauty_check() and a call to it *
39
+ * 12-Feb-00 : - used better method for target cell memory allocation *
40
+ * - did a little formating of the code *
41
+ * 27-May-00 : - fixed error introduced on Feb 12. *
42
+ * - dynamic allocations in nauty() are now deallocated *
43
+ * before return if n >= 320. *
44
+ * 16-Nov-00 : - use function prototypes, change UPROC to void. *
45
+ * - added argument to tcellproc(), removed nvector *
46
+ * - now use options.dispatch, options.groupopts is gone. *
47
+ * 22-Apr-01 : - Added code for compilation into Magma *
48
+ * - Removed nauty_null() and EXTDEFS *
49
+ * 2-Oct-01 : - Improved error message for bad dispatch vector *
50
+ * 21-Nov-01 : - use NAUTYREQUIRED in nauty_check() *
51
+ * 20-Dec-02 : changes for version 2.2: *
52
+ * - made tcnode0 global *
53
+ * - added nauty_freedyn() *
54
+ * 17-Nov-03 : changed INFINITY to NAUTY_INFINITY *
55
+ * 14-Sep-04 : extended prototypes even to recursive functions *
56
+ * 16-Oct-04 : disallow NULL dispatch vector *
57
+ * 11-Nov-05 : changes for version 2.3: *
58
+ * - init() and cleanup() optional calls *
59
+ * 23-Nov-06 : changes for version 2.4: *
60
+ * - use maketargetcell() instead of tcellproc() *
61
+ * 29-Nov-06 : add extra_autom, extra_level, extra_options *
62
+ * 10-Dec-06 : remove BIGNAUTY *
63
+ * 10-Nov-09 : remove shortish and permutation types *
64
+ * 16-Nov-11 : added Shreier option *
65
+ * 15-Jan-12 : added TLS_ATTR to static declarations *
66
+ * 18-Jan-13 : added signal aborting *
67
+ * 19-Jan-13 : added usercanonproc() *
68
+ * 14-Oct-17 : corrected code for n=0 *
69
+ * *
70
+ *****************************************************************************/
71
+
72
+ #define ONE_WORD_SETS
73
+ #include "nauty.h"
74
+ #include "schreier.h"
75
+
76
+ #ifdef NAUTY_IN_MAGMA
77
+ #include "cleanup.e"
78
+ #endif
79
+
80
+ #define NAUTY_ABORTED (-11)
81
+ #define NAUTY_KILLED (-12)
82
+
83
+ typedef struct tcnode_struct
84
+ {
85
+ struct tcnode_struct *next;
86
+ set *tcellptr;
87
+ } tcnode;
88
+
89
+ /* aproto: header new_nauty_protos.h */
90
+
91
+ #ifndef NAUTY_IN_MAGMA
92
+ #if !MAXN
93
+ static int firstpathnode0(int*, int*, int, int, tcnode*);
94
+ static int othernode0(int*, int*, int, int, tcnode*);
95
+ #else
96
+ static int firstpathnode(int*, int*, int, int);
97
+ static int othernode(int*, int*, int, int);
98
+ #endif
99
+ static void firstterminal(int*, int);
100
+ static int processnode(int*, int*, int, int);
101
+ static void recover(int*, int);
102
+ static void writemarker(int, int, int, int, int, int);
103
+ #endif
104
+
105
+ #if MAXM==1
106
+ #define M 1
107
+ #else
108
+ #define M m
109
+ #endif
110
+
111
+ #define OPTCALL(proc) if (proc != NULL) (*proc)
112
+
113
+ /* copies of some of the options: */
114
+ static TLS_ATTR
115
+ boolean getcanon,digraph,writeautoms,domarkers,cartesian,doschreier;
116
+ static TLS_ATTR int linelength,tc_level,mininvarlevel,maxinvarlevel,invararg;
117
+ static TLS_ATTR void (*usernodeproc)(graph*,int*,int*,int,int,int,int,int,int);
118
+ static TLS_ATTR void (*userautomproc)(int,int*,int*,int,int,int);
119
+ static TLS_ATTR void (*userlevelproc)
120
+ (int*,int*,int,int*,statsblk*,int,int,int,int,int,int);
121
+ static TLS_ATTR int (*usercanonproc)
122
+ (graph*,int*,graph*,unsigned long,int,int,int);
123
+ static TLS_ATTR void (*invarproc)
124
+ (graph*,int*,int*,int,int,int,int*,int,boolean,int,int);
125
+ static TLS_ATTR FILE *outfile;
126
+ static TLS_ATTR dispatchvec dispatch;
127
+
128
+ /* local versions of some of the arguments: */
129
+ static TLS_ATTR int m,n;
130
+ static TLS_ATTR graph *g,*canong;
131
+ static TLS_ATTR int *orbits;
132
+ static TLS_ATTR statsblk *stats;
133
+ /* temporary versions of some stats: */
134
+ static TLS_ATTR unsigned long invapplics,invsuccesses;
135
+ static TLS_ATTR int invarsuclevel;
136
+
137
+ /* working variables: <the "bsf leaf" is the leaf which is best guess so
138
+ far at the canonical leaf> */
139
+ static TLS_ATTR int gca_first, /* level of greatest common ancestor of
140
+ current node and first leaf */
141
+ gca_canon, /* ditto for current node and bsf leaf */
142
+ noncheaplevel, /* level of greatest ancestor for which cheapautom==FALSE */
143
+ allsamelevel, /* level of least ancestor of first leaf for
144
+ which all descendant leaves are known to be
145
+ equivalent */
146
+ eqlev_first, /* level to which codes for this node match those
147
+ for first leaf */
148
+ eqlev_canon, /* level to which codes for this node match those
149
+ for the bsf leaf. */
150
+ comp_canon, /* -1,0,1 according as code at eqlev_canon+1 is
151
+ <,==,> that for bsf leaf. Also used for
152
+ similar purpose during leaf processing */
153
+ samerows, /* number of rows of canong which are correct for
154
+ the bsf leaf BDM:correct description? */
155
+ canonlevel, /* level of bsf leaf */
156
+ stabvertex, /* point fixed in ancestor of first leaf at level
157
+ gca_canon */
158
+ cosetindex; /* the point being fixed at level gca_first */
159
+
160
+ static TLS_ATTR boolean needshortprune; /* used to flag calls to shortprune */
161
+
162
+ #if !MAXN
163
+ DYNALLSTAT(set,defltwork,defltwork_sz);
164
+ DYNALLSTAT(int,workperm,workperm_sz);
165
+ DYNALLSTAT(set,fixedpts,fixedpts_sz);
166
+ DYNALLSTAT(int,firstlab,firstlab_sz);
167
+ DYNALLSTAT(int,canonlab,canonlab_sz);
168
+ DYNALLSTAT(short,firstcode,firstcode_sz);
169
+ DYNALLSTAT(short,canoncode,canoncode_sz);
170
+ DYNALLSTAT(int,firsttc,firsttc_sz);
171
+ DYNALLSTAT(set,active,active_sz);
172
+
173
+ /* In the dynamically allocated case (MAXN=0), each level of recursion
174
+ needs one set (tcell) to represent the target cell. This is
175
+ implemented by using a linked list of tcnode anchored at the root
176
+ of the search tree. Each node points to its child (if any) and to
177
+ the dynamically allocated tcell. Apart from the first node of
178
+ the list, each node always has a tcell good for m up to alloc_m.
179
+ tcnodes and tcells are kept between calls to nauty, except that
180
+ they are freed and reallocated if m gets bigger than alloc_m. */
181
+
182
+ static TLS_ATTR tcnode tcnode0 = {NULL,NULL};
183
+ static TLS_ATTR int alloc_m = 0;
184
+
185
+ #else
186
+ static TLS_ATTR set defltwork[2*MAXM]; /* workspace in case none provided */
187
+ static TLS_ATTR int workperm[MAXN]; /* various scratch uses */
188
+ static TLS_ATTR set fixedpts[MAXM]; /* points which were explicitly
189
+ fixed to get current node */
190
+ static TLS_ATTR int firstlab[MAXN], /* label from first leaf */
191
+ canonlab[MAXN]; /* label from bsf leaf */
192
+ static TLS_ATTR short firstcode[MAXN+2], /* codes for first leaf */
193
+ canoncode[MAXN+2]; /* codes for bsf leaf */
194
+ static TLS_ATTR int firsttc[MAXN+2]; /* index of target cell for left path */
195
+ static TLS_ATTR set active[MAXM]; /* used to contain index to cells now
196
+ active for refinement purposes */
197
+ #endif
198
+
199
+ static TLS_ATTR set *workspace,*worktop; /* first and just-after-last
200
+ addresses of work area to hold automorphism data */
201
+ static TLS_ATTR set *fmptr; /* pointer into workspace */
202
+
203
+ static TLS_ATTR schreier *gp; /* These two for Schreier computations */
204
+ static TLS_ATTR permnode *gens;
205
+
206
+ /*****************************************************************************
207
+ * *
208
+ * This procedure finds generators for the automorphism group of a *
209
+ * vertex-coloured graph and optionally finds a canonically labelled *
210
+ * isomorph. A description of the data structures can be found in *
211
+ * nauty.h and in the "nauty User's Guide". The Guide also gives *
212
+ * many more details about its use, and implementation notes. *
213
+ * *
214
+ * Parameters - <r> means read-only, <w> means write-only, <wr> means both: *
215
+ * g <r> - the graph *
216
+ * lab,ptn <rw> - used for the partition nest which defines the colouring *
217
+ * of g. The initial colouring will be set by the program, *
218
+ * using the same colour for every vertex, if *
219
+ * options->defaultptn!=FALSE. Otherwise, you must set it *
220
+ * yourself (see the Guide). If options->getcanon!=FALSE, *
221
+ * the contents of lab on return give the labelling of g *
222
+ * corresponding to canong. This does not change the *
223
+ * initial colouring of g as defined by (lab,ptn), since *
224
+ * the labelling is consistent with the colouring. *
225
+ * active <r> - If this is not NULL and options->defaultptn==FALSE, *
226
+ * it is a set indicating the initial set of active colours. *
227
+ * See the Guide for details. *
228
+ * orbits <w> - On return, orbits[i] contains the number of the *
229
+ * least-numbered vertex in the same orbit as i, for *
230
+ * i=0,1,...,n-1. *
231
+ * options <r> - A list of options. See nauty.h and/or the Guide *
232
+ * for details. *
233
+ * stats <w> - A list of statistics produced by the procedure. See *
234
+ * nauty.h and/or the Guide for details. *
235
+ * workspace <w> - A chunk of memory for working storage. *
236
+ * worksize <r> - The number of setwords in workspace. See the Guide *
237
+ * for guidance. *
238
+ * m <r> - The number of setwords in sets. This must be at *
239
+ * least ceil(n / WORDSIZE) and at most MAXM. *
240
+ * n <r> - The number of vertices. This must be at least 1 and *
241
+ * at most MAXN. *
242
+ * canong <w> - The canononically labelled isomorph of g. This is *
243
+ * only produced if options->getcanon!=FALSE, and can be *
244
+ * given as NULL otherwise. *
245
+ * *
246
+ * FUNCTIONS CALLED: firstpathnode(),updatecan() *
247
+ * *
248
+ *****************************************************************************/
249
+
250
+ void
251
+ nauty(graph *g_arg, int *lab, int *ptn, set *active_arg,
252
+ int *orbits_arg, optionblk *options, statsblk *stats_arg,
253
+ set *ws_arg, int worksize, int m_arg, int n_arg, graph *canong_arg)
254
+ {
255
+ int i;
256
+ int numcells;
257
+ int retval;
258
+ int initstatus;
259
+ #if !MAXN
260
+ tcnode *tcp,*tcq;
261
+ #endif
262
+
263
+ /* determine dispatch vector */
264
+
265
+ if (options->dispatch == NULL)
266
+ {
267
+ fprintf(ERRFILE,">E nauty: null dispatch vector\n");
268
+ fprintf(ERRFILE,"Maybe you need to recompile\n");
269
+ exit(1);
270
+ }
271
+ else
272
+ dispatch = *(options->dispatch);
273
+
274
+ if (options->userrefproc)
275
+ dispatch.refine = options->userrefproc;
276
+ else if (dispatch.refine1 && m_arg == 1)
277
+ dispatch.refine = dispatch.refine1;
278
+
279
+ if (dispatch.refine == NULL || dispatch.updatecan == NULL
280
+ || dispatch.targetcell == NULL || dispatch.cheapautom == NULL)
281
+ {
282
+ fprintf(ERRFILE,">E bad dispatch vector\n");
283
+ exit(1);
284
+ }
285
+
286
+ /* check for excessive sizes: */
287
+
288
+ #if !MAXN
289
+ if (m_arg > NAUTY_INFINITY/WORDSIZE+1)
290
+ {
291
+ stats_arg->errstatus = MTOOBIG;
292
+ fprintf(ERRFILE,"nauty: need m <= %d, but m=%d\n\n",
293
+ NAUTY_INFINITY/WORDSIZE+1,m_arg);
294
+ return;
295
+ }
296
+ if (n_arg > NAUTY_INFINITY-2 || n_arg > WORDSIZE * m_arg)
297
+ {
298
+ stats_arg->errstatus = NTOOBIG;
299
+ fprintf(ERRFILE,"nauty: need n <= min(%d,%d*m), but n=%d\n\n",
300
+ NAUTY_INFINITY-2,WORDSIZE,n_arg);
301
+ return;
302
+ }
303
+ #else
304
+ if (m_arg > MAXM)
305
+ {
306
+ stats_arg->errstatus = MTOOBIG;
307
+ fprintf(ERRFILE,"nauty: need m <= %d\n\n",MAXM);
308
+ return;
309
+ }
310
+ if (n_arg > MAXN || n_arg > WORDSIZE * m_arg)
311
+ {
312
+ stats_arg->errstatus = NTOOBIG;
313
+ fprintf(ERRFILE,
314
+ "nauty: need n <= min(%d,%d*m)\n\n",MAXM,WORDSIZE);
315
+ return;
316
+ }
317
+ #endif
318
+ if (n_arg == 0) /* Special code for zero-sized graph */
319
+ {
320
+ stats_arg->grpsize1 = 1.0;
321
+ stats_arg->grpsize2 = 0;
322
+ stats_arg->numorbits = 0;
323
+ stats_arg->numgenerators = 0;
324
+ stats_arg->errstatus = 0;
325
+ stats_arg->numnodes = 1;
326
+ stats_arg->numbadleaves = 0;
327
+ stats_arg->maxlevel = 1;
328
+ stats_arg->tctotal = 0;
329
+ stats_arg->canupdates = (options->getcanon != 0);
330
+ stats_arg->invapplics = 0;
331
+ stats_arg->invsuccesses = 0;
332
+ stats_arg->invarsuclevel = 0;
333
+
334
+ g = canong = NULL;
335
+ initstatus = 0;
336
+ OPTCALL(dispatch.init)(g_arg,&g,canong_arg,&canong,
337
+ lab,ptn,active,options,&initstatus,m,n);
338
+ if (initstatus) stats->errstatus = initstatus;
339
+
340
+ if (g == NULL) g = g_arg;
341
+ if (canong == NULL) canong = canong_arg;
342
+ OPTCALL(dispatch.cleanup)(g_arg,&g,canong_arg,&canong,
343
+ lab,ptn,options,stats_arg,m,n);
344
+ return;
345
+ }
346
+
347
+ /* take copies of some args, and options: */
348
+ m = m_arg;
349
+ n = n_arg;
350
+
351
+ nautil_check(WORDSIZE,m,n,NAUTYVERSIONID);
352
+ OPTCALL(dispatch.check)(WORDSIZE,m,n,NAUTYVERSIONID);
353
+
354
+ #if !MAXN
355
+ DYNALLOC1(set,defltwork,defltwork_sz,2*m,"nauty");
356
+ DYNALLOC1(set,fixedpts,fixedpts_sz,m,"nauty");
357
+ DYNALLOC1(set,active,active_sz,m,"nauty");
358
+ DYNALLOC1(int,workperm,workperm_sz,n,"nauty");
359
+ DYNALLOC1(int,firstlab,firstlab_sz,n,"nauty");
360
+ DYNALLOC1(int,canonlab,canonlab_sz,n,"nauty");
361
+ DYNALLOC1(short,firstcode,firstcode_sz,n+2,"nauty");
362
+ DYNALLOC1(short,canoncode,canoncode_sz,n+2,"nauty");
363
+ DYNALLOC1(int,firsttc,firsttc_sz,n+2,"nauty");
364
+ if (m > alloc_m)
365
+ {
366
+ tcp = tcnode0.next;
367
+ while (tcp != NULL)
368
+ {
369
+ tcq = tcp->next;
370
+ FREES(tcp->tcellptr);
371
+ FREES(tcp);
372
+ tcp = tcq;
373
+ }
374
+ alloc_m = m;
375
+ tcnode0.next = NULL;
376
+ }
377
+ #endif
378
+
379
+ /* OLD g = g_arg; */
380
+ orbits = orbits_arg;
381
+ stats = stats_arg;
382
+
383
+ getcanon = options->getcanon;
384
+ digraph = options->digraph;
385
+ writeautoms = options->writeautoms;
386
+ domarkers = options->writemarkers;
387
+ cartesian = options->cartesian;
388
+ doschreier = options->schreier;
389
+ if (doschreier) schreier_check(WORDSIZE,m,n,NAUTYVERSIONID);
390
+ linelength = options->linelength;
391
+ if (digraph) tc_level = 0;
392
+ else tc_level = options->tc_level;
393
+ outfile = (options->outfile == NULL ? stdout : options->outfile);
394
+ usernodeproc = options->usernodeproc;
395
+ userautomproc = options->userautomproc;
396
+ userlevelproc = options->userlevelproc;
397
+ usercanonproc = options->usercanonproc;
398
+
399
+ invarproc = options->invarproc;
400
+ if (options->mininvarlevel < 0 && options->getcanon)
401
+ mininvarlevel = -options->mininvarlevel;
402
+ else
403
+ mininvarlevel = options->mininvarlevel;
404
+ if (options->maxinvarlevel < 0 && options->getcanon)
405
+ maxinvarlevel = -options->maxinvarlevel;
406
+ else
407
+ maxinvarlevel = options->maxinvarlevel;
408
+ invararg = options->invararg;
409
+
410
+ if (getcanon)
411
+ if (canong_arg == NULL)
412
+ {
413
+ stats_arg->errstatus = CANONGNIL;
414
+ fprintf(ERRFILE,
415
+ "nauty: canong=NULL but options.getcanon=TRUE\n\n");
416
+ return;
417
+ }
418
+
419
+ /* initialize everything: */
420
+
421
+ if (options->defaultptn)
422
+ {
423
+ for (i = 0; i < n; ++i) /* give all verts same colour */
424
+ {
425
+ lab[i] = i;
426
+ ptn[i] = NAUTY_INFINITY;
427
+ }
428
+ ptn[n-1] = 0;
429
+ EMPTYSET(active,m);
430
+ ADDELEMENT(active,0);
431
+ numcells = 1;
432
+ }
433
+ else
434
+ {
435
+ ptn[n-1] = 0;
436
+ numcells = 0;
437
+ for (i = 0; i < n; ++i)
438
+ if (ptn[i] != 0) ptn[i] = NAUTY_INFINITY;
439
+ else ++numcells;
440
+ if (active_arg == NULL)
441
+ {
442
+ EMPTYSET(active,m);
443
+ for (i = 0; i < n; ++i)
444
+ {
445
+ ADDELEMENT(active,i);
446
+ while (ptn[i]) ++i;
447
+ }
448
+ }
449
+ else
450
+ for (i = 0; i < M; ++i) active[i] = active_arg[i];
451
+ }
452
+
453
+ g = canong = NULL;
454
+ initstatus = 0;
455
+ OPTCALL(dispatch.init)(g_arg,&g,canong_arg,&canong,
456
+ lab,ptn,active,options,&initstatus,m,n);
457
+ if (initstatus)
458
+ {
459
+ stats->errstatus = initstatus;
460
+ return;
461
+ }
462
+
463
+ if (g == NULL) g = g_arg;
464
+ if (canong == NULL) canong = canong_arg;
465
+
466
+ if (doschreier) newgroup(&gp,&gens,n);
467
+
468
+ for (i = 0; i < n; ++i) orbits[i] = i;
469
+ stats->grpsize1 = 1.0;
470
+ stats->grpsize2 = 0;
471
+ stats->numgenerators = 0;
472
+ stats->numnodes = 0;
473
+ stats->numbadleaves = 0;
474
+ stats->tctotal = 0;
475
+ stats->canupdates = 0;
476
+ stats->numorbits = n;
477
+ EMPTYSET(fixedpts,m);
478
+ noncheaplevel = 1;
479
+ eqlev_canon = -1; /* needed even if !getcanon */
480
+
481
+ if (worksize >= 2 * m)
482
+ workspace = ws_arg;
483
+ else
484
+ {
485
+ workspace = defltwork;
486
+ worksize = 2 * m;
487
+ }
488
+ worktop = workspace + (worksize - worksize % (2 * m));
489
+ fmptr = workspace;
490
+
491
+ /* here goes: */
492
+ stats->errstatus = 0;
493
+ needshortprune = FALSE;
494
+ invarsuclevel = NAUTY_INFINITY;
495
+ invapplics = invsuccesses = 0;
496
+
497
+ #if !MAXN
498
+ retval = firstpathnode0(lab,ptn,1,numcells,&tcnode0);
499
+ #else
500
+ retval = firstpathnode(lab,ptn,1,numcells);
501
+ #endif
502
+
503
+ if (retval == NAUTY_ABORTED)
504
+ stats->errstatus = NAUABORTED;
505
+ else if (retval == NAUTY_KILLED)
506
+ stats->errstatus = NAUKILLED;
507
+ else
508
+ {
509
+ if (getcanon)
510
+ {
511
+ (*dispatch.updatecan)(g,canong,canonlab,samerows,M,n);
512
+ for (i = 0; i < n; ++i) lab[i] = canonlab[i];
513
+ }
514
+ stats->invarsuclevel =
515
+ (invarsuclevel == NAUTY_INFINITY ? 0 : invarsuclevel);
516
+ stats->invapplics = invapplics;
517
+ stats->invsuccesses = invsuccesses;
518
+ }
519
+
520
+ #if !MAXN
521
+ #ifndef NAUTY_IN_MAGMA
522
+ if (n >= 320)
523
+ #endif
524
+ {
525
+ nautil_freedyn();
526
+ OPTCALL(dispatch.freedyn)();
527
+ nauty_freedyn();
528
+ }
529
+ #endif
530
+ OPTCALL(dispatch.cleanup)(g_arg,&g,canong_arg,&canong,
531
+ lab,ptn,options,stats,m,n);
532
+
533
+ if (doschreier)
534
+ {
535
+ freeschreier(&gp,&gens);
536
+ if (n >= 320) schreier_freedyn();
537
+ }
538
+ }
539
+
540
+ /*****************************************************************************
541
+ * *
542
+ * firstpathnode(lab,ptn,level,numcells) produces a node on the leftmost *
543
+ * path down the tree. The parameters describe the level and the current *
544
+ * colour partition. The set of active cells is taken from the global set *
545
+ * 'active'. If the refined partition is not discrete, the leftmost child *
546
+ * is produced by calling firstpathnode, and the other children by calling *
547
+ * othernode. *
548
+ * For MAXN=0 there is an extra parameter: the address of the parent tcell *
549
+ * structure. *
550
+ * The value returned is the level to return to. *
551
+ * *
552
+ * FUNCTIONS CALLED: (*usernodeproc)(),doref(),cheapautom(), *
553
+ * firstterminal(),nextelement(),breakout(), *
554
+ * firstpathnode(),othernode(),recover(),writestats(), *
555
+ * (*userlevelproc)(),(*tcellproc)(),shortprune() *
556
+ * *
557
+ *****************************************************************************/
558
+
559
+ static int
560
+ #if !MAXN
561
+ firstpathnode0(int *lab, int *ptn, int level, int numcells,
562
+ tcnode *tcnode_parent)
563
+ #else
564
+ firstpathnode(int *lab, int *ptn, int level, int numcells)
565
+ #endif
566
+ {
567
+ int tv;
568
+ int tv1,index,rtnlevel,tcellsize,tc,childcount,qinvar,refcode;
569
+ #if !MAXN
570
+ set *tcell;
571
+ tcnode *tcnode_this;
572
+
573
+ tcnode_this = tcnode_parent->next;
574
+ if (tcnode_this == NULL)
575
+ {
576
+ if ((tcnode_this = (tcnode*)ALLOCS(1,sizeof(tcnode))) == NULL ||
577
+ (tcnode_this->tcellptr
578
+ = (set*)ALLOCS(alloc_m,sizeof(set))) == NULL)
579
+ alloc_error("tcell");
580
+ tcnode_parent->next = tcnode_this;
581
+ tcnode_this->next = NULL;
582
+ }
583
+ tcell = tcnode_this->tcellptr;
584
+ #else
585
+ set tcell[MAXM];
586
+ #endif
587
+
588
+ ++stats->numnodes;
589
+
590
+ /* refine partition : */
591
+ doref(g,lab,ptn,level,&numcells,&qinvar,workperm,
592
+ active,&refcode,dispatch.refine,invarproc,
593
+ mininvarlevel,maxinvarlevel,invararg,digraph,M,n);
594
+ firstcode[level] = (short)refcode;
595
+ if (qinvar > 0)
596
+ {
597
+ ++invapplics;
598
+ if (qinvar == 2)
599
+ {
600
+ ++invsuccesses;
601
+ if (mininvarlevel < 0) mininvarlevel = level;
602
+ if (maxinvarlevel < 0) maxinvarlevel = level;
603
+ if (level < invarsuclevel) invarsuclevel = level;
604
+ }
605
+ }
606
+
607
+ tc = -1;
608
+ if (numcells != n)
609
+ {
610
+ /* locate new target cell, setting tc to its position in lab, tcell
611
+ to its contents, and tcellsize to its size: */
612
+ maketargetcell(g,lab,ptn,level,tcell,&tcellsize,
613
+ &tc,tc_level,digraph,-1,dispatch.targetcell,M,n);
614
+ stats->tctotal += tcellsize;
615
+ }
616
+ firsttc[level] = tc;
617
+
618
+ /* optionally call user-defined node examination procedure: */
619
+ OPTCALL(usernodeproc)
620
+ (g,lab,ptn,level,numcells,tc,(int)firstcode[level],M,n);
621
+
622
+ if (numcells == n) /* found first leaf? */
623
+ {
624
+ firstterminal(lab,level);
625
+ OPTCALL(userlevelproc)(lab,ptn,level,orbits,stats,0,1,1,n,0,n);
626
+ if (getcanon && usercanonproc != NULL)
627
+ {
628
+ (*dispatch.updatecan)(g,canong,canonlab,samerows,M,n);
629
+ samerows = n;
630
+ if ((*usercanonproc)(g,canonlab,canong,stats->canupdates,
631
+ (int)canoncode[level],M,n))
632
+ return NAUTY_ABORTED;
633
+ }
634
+ return level-1;
635
+ }
636
+
637
+ #ifdef NAUTY_IN_MAGMA
638
+ if (main_seen_interrupt) return NAUTY_KILLED;
639
+ #else
640
+ if (nauty_kill_request) return NAUTY_KILLED;
641
+ #endif
642
+
643
+ if (noncheaplevel >= level
644
+ && !(*dispatch.cheapautom)(ptn,level,digraph,n))
645
+ noncheaplevel = level + 1;
646
+
647
+ /* use the elements of the target cell to produce the children: */
648
+ index = 0;
649
+ childcount = 0;
650
+ for (tv1 = tv = nextelement(tcell,M,-1); tv >= 0;
651
+ tv = nextelement(tcell,M,tv))
652
+ {
653
+ if (orbits[tv] == tv) /* ie, not equiv to previous child */
654
+ {
655
+ breakout(lab,ptn,level+1,tc,tv,active,M);
656
+ ADDELEMENT(fixedpts,tv);
657
+ cosetindex = tv;
658
+ if (tv == tv1)
659
+ {
660
+ #if !MAXN
661
+ rtnlevel = firstpathnode0(lab,ptn,level+1,numcells+1,
662
+ tcnode_this);
663
+ #else
664
+ rtnlevel = firstpathnode(lab,ptn,level+1,numcells+1);
665
+ #endif
666
+ childcount = 1;
667
+ gca_first = level;
668
+ stabvertex = tv1;
669
+ }
670
+ else
671
+ {
672
+ #if !MAXN
673
+ rtnlevel = othernode0(lab,ptn,level+1,numcells+1,
674
+ tcnode_this);
675
+ #else
676
+ rtnlevel = othernode(lab,ptn,level+1,numcells+1);
677
+ #endif
678
+ ++childcount;
679
+ }
680
+ DELELEMENT(fixedpts,tv);
681
+ if (rtnlevel < level)
682
+ return rtnlevel;
683
+ if (needshortprune)
684
+ {
685
+ needshortprune = FALSE;
686
+ shortprune(tcell,fmptr-M,M);
687
+ }
688
+ recover(ptn,level);
689
+ }
690
+ if (orbits[tv] == tv1) /* ie, in same orbit as tv1 */
691
+ ++index;
692
+ }
693
+ MULTIPLY(stats->grpsize1,stats->grpsize2,index);
694
+
695
+ if (tcellsize == index && allsamelevel == level + 1)
696
+ --allsamelevel;
697
+
698
+ if (domarkers)
699
+ writemarker(level,tv1,index,tcellsize,stats->numorbits,numcells);
700
+ OPTCALL(userlevelproc)(lab,ptn,level,orbits,stats,tv1,index,tcellsize,
701
+ numcells,childcount,n);
702
+ return level-1;
703
+ }
704
+
705
+ /*****************************************************************************
706
+ * *
707
+ * othernode(lab,ptn,level,numcells) produces a node other than an ancestor *
708
+ * of the first leaf. The parameters describe the level and the colour *
709
+ * partition. The list of active cells is found in the global set 'active'. *
710
+ * The value returned is the level to return to. *
711
+ * *
712
+ * FUNCTIONS CALLED: (*usernodeproc)(),doref(),refine(),recover(), *
713
+ * processnode(),cheapautom(),(*tcellproc)(),shortprune(), *
714
+ * nextelement(),breakout(),othernode(),longprune() *
715
+ * *
716
+ *****************************************************************************/
717
+
718
+ static int
719
+ #if !MAXN
720
+ othernode0(int *lab, int *ptn, int level, int numcells,
721
+ tcnode *tcnode_parent)
722
+ #else
723
+ othernode(int *lab, int *ptn, int level, int numcells)
724
+ #endif
725
+ {
726
+ int tv;
727
+ int tv1,refcode,rtnlevel,tcellsize,tc,qinvar;
728
+ short code;
729
+ #if !MAXN
730
+ set *tcell;
731
+ tcnode *tcnode_this;
732
+
733
+ tcnode_this = tcnode_parent->next;
734
+ if (tcnode_this == NULL)
735
+ {
736
+ if ((tcnode_this = (tcnode*)ALLOCS(1,sizeof(tcnode))) == NULL ||
737
+ (tcnode_this->tcellptr
738
+ = (set*)ALLOCS(alloc_m,sizeof(set))) == NULL)
739
+ alloc_error("tcell");
740
+ tcnode_parent->next = tcnode_this;
741
+ tcnode_this->next = NULL;
742
+ }
743
+ tcell = tcnode_this->tcellptr;
744
+ #else
745
+ set tcell[MAXM];
746
+ #endif
747
+
748
+ #ifdef NAUTY_IN_MAGMA
749
+ if (main_seen_interrupt) return NAUTY_KILLED;
750
+ #else
751
+ if (nauty_kill_request) return NAUTY_KILLED;
752
+ #endif
753
+
754
+ ++stats->numnodes;
755
+
756
+ /* refine partition : */
757
+ doref(g,lab,ptn,level,&numcells,&qinvar,workperm,active,
758
+ &refcode,dispatch.refine,invarproc,mininvarlevel,maxinvarlevel,
759
+ invararg,digraph,M,n);
760
+ code = (short)refcode;
761
+ if (qinvar > 0)
762
+ {
763
+ ++invapplics;
764
+ if (qinvar == 2)
765
+ {
766
+ ++invsuccesses;
767
+ if (level < invarsuclevel) invarsuclevel = level;
768
+ }
769
+ }
770
+
771
+ if (eqlev_first == level - 1 && code == firstcode[level])
772
+ eqlev_first = level;
773
+ if (getcanon)
774
+ {
775
+ if (eqlev_canon == level - 1)
776
+ {
777
+ if (code < canoncode[level])
778
+ comp_canon = -1;
779
+ else if (code > canoncode[level])
780
+ comp_canon = 1;
781
+ else
782
+ {
783
+ comp_canon = 0;
784
+ eqlev_canon = level;
785
+ }
786
+ }
787
+ if (comp_canon > 0) canoncode[level] = code;
788
+ }
789
+
790
+ tc = -1;
791
+ /* If children will be required, find new target cell and set tc to its
792
+ position in lab, tcell to its contents, and tcellsize to its size: */
793
+
794
+ if (numcells < n && (eqlev_first == level ||
795
+ (getcanon && comp_canon >= 0)))
796
+ {
797
+ if (!getcanon || comp_canon < 0)
798
+ {
799
+ maketargetcell(g,lab,ptn,level,tcell,&tcellsize,&tc,
800
+ tc_level,digraph,firsttc[level],dispatch.targetcell,M,n);
801
+ if (tc != firsttc[level]) eqlev_first = level - 1;
802
+ }
803
+ else
804
+ maketargetcell(g,lab,ptn,level,tcell,&tcellsize,&tc,
805
+ tc_level,digraph,-1,dispatch.targetcell,M,n);
806
+ stats->tctotal += tcellsize;
807
+ }
808
+
809
+ /* optionally call user-defined node examination procedure: */
810
+ OPTCALL(usernodeproc)(g,lab,ptn,level,numcells,tc,(int)code,M,n);
811
+
812
+ /* call processnode to classify the type of this node: */
813
+
814
+ rtnlevel = processnode(lab,ptn,level,numcells);
815
+ if (rtnlevel < level) /* keep returning if necessary */
816
+ return rtnlevel;
817
+ if (needshortprune)
818
+ {
819
+ needshortprune = FALSE;
820
+ shortprune(tcell,fmptr-M,M);
821
+ }
822
+
823
+ if (!(*dispatch.cheapautom)(ptn,level,digraph,n))
824
+ noncheaplevel = level + 1;
825
+
826
+ /* use the elements of the target cell to produce the children: */
827
+ for (tv1 = tv = nextelement(tcell,M,-1); tv >= 0;
828
+ tv = nextelement(tcell,M,tv))
829
+ {
830
+ breakout(lab,ptn,level+1,tc,tv,active,M);
831
+ ADDELEMENT(fixedpts,tv);
832
+ #if !MAXN
833
+ rtnlevel = othernode0(lab,ptn,level+1,numcells+1,tcnode_this);
834
+ #else
835
+ rtnlevel = othernode(lab,ptn,level+1,numcells+1);
836
+ #endif
837
+ DELELEMENT(fixedpts,tv);
838
+
839
+ if (rtnlevel < level) return rtnlevel;
840
+ /* use stored automorphism data to prune target cell: */
841
+ if (needshortprune)
842
+ {
843
+ needshortprune = FALSE;
844
+ shortprune(tcell,fmptr-M,M);
845
+ }
846
+ if (tv == tv1)
847
+ {
848
+ longprune(tcell,fixedpts,workspace,fmptr,M);
849
+ if (doschreier) pruneset(fixedpts,gp,&gens,tcell,M,n);
850
+ }
851
+
852
+ recover(ptn,level);
853
+ }
854
+
855
+ return level-1;
856
+ }
857
+
858
+ /*****************************************************************************
859
+ * *
860
+ * Process the first leaf of the tree. *
861
+ * *
862
+ * FUNCTIONS CALLED: NONE *
863
+ * *
864
+ *****************************************************************************/
865
+
866
+ static void
867
+ firstterminal(int *lab, int level)
868
+ {
869
+ int i;
870
+
871
+ stats->maxlevel = level;
872
+ gca_first = allsamelevel = eqlev_first = level;
873
+ firstcode[level+1] = 077777;
874
+ firsttc[level+1] = -1;
875
+
876
+ for (i = 0; i < n; ++i) firstlab[i] = lab[i];
877
+
878
+ if (getcanon)
879
+ {
880
+ canonlevel = eqlev_canon = gca_canon = level;
881
+ comp_canon = 0;
882
+ samerows = 0;
883
+ for (i = 0; i < n; ++i) canonlab[i] = lab[i];
884
+ for (i = 0; i <= level; ++i) canoncode[i] = firstcode[i];
885
+ canoncode[level+1] = 077777;
886
+ stats->canupdates = 1;
887
+ }
888
+ }
889
+
890
+ /*****************************************************************************
891
+ * *
892
+ * Process a node other than the first leaf or its ancestors. It is first *
893
+ * classified into one of five types and then action is taken appropriate *
894
+ * to that type. The types are *
895
+ * *
896
+ * 0: Nothing unusual. This is just a node internal to the tree whose *
897
+ * children need to be generated sometime. *
898
+ * 1: This is a leaf equivalent to the first leaf. The mapping from *
899
+ * firstlab to lab is thus an automorphism. After processing the *
900
+ * automorphism, we can return all the way to the closest invocation *
901
+ * of firstpathnode. *
902
+ * 2: This is a leaf equivalent to the bsf leaf. Again, we have found an *
903
+ * automorphism, but it may or may not be as useful as one from a *
904
+ * type-1 node. Return as far up the tree as possible. *
905
+ * 3: This is a new bsf node, provably better than the previous bsf node. *
906
+ * After updating canonlab etc., treat it the same as type 4. *
907
+ * 4: This is a leaf for which we can prove that no descendant is *
908
+ * equivalent to the first or bsf leaf or better than the bsf leaf. *
909
+ * Return up the tree as far as possible, but this may only be by *
910
+ * one level. *
911
+ * *
912
+ * Types 2 and 3 can't occur if getcanon==FALSE. *
913
+ * The value returned is the level in the tree to return to, which can be *
914
+ * anywhere up to the closest invocation of firstpathnode. *
915
+ * *
916
+ * FUNCTIONS CALLED: isautom(),updatecan(),testcanlab(),fmperm(), *
917
+ * writeperm(),(*userautomproc)(),orbjoin(), *
918
+ * shortprune(),fmptn() *
919
+ * *
920
+ *****************************************************************************/
921
+
922
+ static int
923
+ processnode(int *lab, int *ptn, int level, int numcells)
924
+ {
925
+ int i,code,save,newlevel;
926
+ boolean ispruneok;
927
+ int sr;
928
+
929
+ code = 0;
930
+ if (eqlev_first != level && (!getcanon || comp_canon < 0))
931
+ code = 4;
932
+ else if (numcells == n)
933
+ {
934
+ if (eqlev_first == level)
935
+ {
936
+ for (i = 0; i < n; ++i) workperm[firstlab[i]] = lab[i];
937
+
938
+ if (gca_first >= noncheaplevel ||
939
+ (*dispatch.isautom)(g,workperm,digraph,M,n))
940
+ code = 1;
941
+ }
942
+ if (code == 0)
943
+ {
944
+ if (getcanon)
945
+ {
946
+ sr = 0;
947
+ if (comp_canon == 0)
948
+ {
949
+ if (level < canonlevel)
950
+ comp_canon = 1;
951
+ else
952
+ {
953
+ (*dispatch.updatecan)
954
+ (g,canong,canonlab,samerows,M,n);
955
+ samerows = n;
956
+ comp_canon
957
+ = (*dispatch.testcanlab)(g,canong,lab,&sr,M,n);
958
+ }
959
+ }
960
+ if (comp_canon == 0)
961
+ {
962
+ for (i = 0; i < n; ++i) workperm[canonlab[i]] = lab[i];
963
+ code = 2;
964
+ }
965
+ else if (comp_canon > 0)
966
+ code = 3;
967
+ else
968
+ code = 4;
969
+ }
970
+ else
971
+ code = 4;
972
+ }
973
+ }
974
+
975
+ if (code != 0 && level > stats->maxlevel) stats->maxlevel = level;
976
+
977
+ switch (code)
978
+ {
979
+ case 0: /* nothing unusual noticed */
980
+ return level;
981
+
982
+ case 1: /* lab is equivalent to firstlab */
983
+ if (fmptr == worktop) fmptr -= 2 * M;
984
+ fmperm(workperm,fmptr,fmptr+M,M,n);
985
+ fmptr += 2 * M;
986
+ if (writeautoms)
987
+ writeperm(outfile,workperm,cartesian,linelength,n);
988
+ stats->numorbits = orbjoin(orbits,workperm,n);
989
+ ++stats->numgenerators;
990
+ OPTCALL(userautomproc)(stats->numgenerators,workperm,orbits,
991
+ stats->numorbits,stabvertex,n);
992
+ if (doschreier) addgenerator(&gp,&gens,workperm,n);
993
+ return gca_first;
994
+
995
+ case 2: /* lab is equivalent to canonlab */
996
+ if (fmptr == worktop) fmptr -= 2 * M;
997
+ fmperm(workperm,fmptr,fmptr+M,M,n);
998
+ fmptr += 2 * M;
999
+ save = stats->numorbits;
1000
+ stats->numorbits = orbjoin(orbits,workperm,n);
1001
+ if (stats->numorbits == save)
1002
+ {
1003
+ if (gca_canon != gca_first) needshortprune = TRUE;
1004
+ return gca_canon;
1005
+ }
1006
+ if (writeautoms)
1007
+ writeperm(outfile,workperm,cartesian,linelength,n);
1008
+ ++stats->numgenerators;
1009
+ OPTCALL(userautomproc)(stats->numgenerators,workperm,orbits,
1010
+ stats->numorbits,stabvertex,n);
1011
+ if (doschreier) addgenerator(&gp,&gens,workperm,n);
1012
+ if (orbits[cosetindex] < cosetindex)
1013
+ return gca_first;
1014
+ if (gca_canon != gca_first)
1015
+ needshortprune = TRUE;
1016
+ return gca_canon;
1017
+
1018
+ case 3: /* lab is better than canonlab */
1019
+ ++stats->canupdates;
1020
+ for (i = 0; i < n; ++i) canonlab[i] = lab[i];
1021
+ canonlevel = eqlev_canon = gca_canon = level;
1022
+ comp_canon = 0;
1023
+ canoncode[level+1] = 077777;
1024
+ samerows = sr;
1025
+ if (getcanon && usercanonproc != NULL)
1026
+ {
1027
+ (*dispatch.updatecan)(g,canong,canonlab,samerows,M,n);
1028
+ samerows = n;
1029
+ if ((*usercanonproc)(g,canonlab,canong,stats->canupdates,
1030
+ (int)canoncode[level],M,n))
1031
+ return NAUTY_ABORTED;
1032
+ }
1033
+ break;
1034
+
1035
+ case 4: /* non-automorphism terminal node */
1036
+ ++stats->numbadleaves;
1037
+ break;
1038
+ } /* end of switch statement */
1039
+
1040
+ /* only cases 3 and 4 get this far: */
1041
+ if (level != noncheaplevel)
1042
+ {
1043
+ ispruneok = TRUE;
1044
+ if (fmptr == worktop) fmptr -= 2 * M;
1045
+ fmptn(lab,ptn,noncheaplevel,fmptr,fmptr+M,M,n);
1046
+ fmptr += 2 * M;
1047
+ }
1048
+ else
1049
+ ispruneok = FALSE;
1050
+
1051
+ save = (allsamelevel > eqlev_canon ? allsamelevel-1 : eqlev_canon);
1052
+ newlevel = (noncheaplevel <= save ? noncheaplevel-1 : save);
1053
+
1054
+ if (ispruneok && newlevel != gca_first) needshortprune = TRUE;
1055
+ return newlevel;
1056
+ }
1057
+
1058
+ /*****************************************************************************
1059
+ * *
1060
+ * Recover the partition nest at level 'level' and update various other *
1061
+ * parameters. *
1062
+ * *
1063
+ * FUNCTIONS CALLED: NONE *
1064
+ * *
1065
+ *****************************************************************************/
1066
+
1067
+ static void
1068
+ recover(int *ptn, int level)
1069
+ {
1070
+ int i;
1071
+
1072
+ for (i = 0; i < n; ++i)
1073
+ if (ptn[i] > level) ptn[i] = NAUTY_INFINITY;
1074
+
1075
+ if (level < noncheaplevel) noncheaplevel = level + 1;
1076
+ if (level < eqlev_first) eqlev_first = level;
1077
+ if (getcanon)
1078
+ {
1079
+ if (level < gca_canon) gca_canon = level;
1080
+ if (level <= eqlev_canon)
1081
+ {
1082
+ eqlev_canon = level;
1083
+ comp_canon = 0;
1084
+ }
1085
+ }
1086
+ }
1087
+
1088
+ /*****************************************************************************
1089
+ * *
1090
+ * Write statistics concerning an ancestor of the first leaf. *
1091
+ * *
1092
+ * level = its level *
1093
+ * tv = the vertex fixed to get the first child = the smallest-numbered *
1094
+ * vertex in the target cell *
1095
+ * cellsize = the size of the target cell *
1096
+ * index = the number of vertices in the target cell which were equivalent *
1097
+ * to tv = the index of the stabiliser of tv in the group *
1098
+ * fixing the colour partition at this level *
1099
+ * *
1100
+ * numorbits = the number of orbits of the group generated by all the *
1101
+ * automorphisms so far discovered *
1102
+ * *
1103
+ * numcells = the total number of cells in the equitable partition at this *
1104
+ * level *
1105
+ * *
1106
+ * FUNCTIONS CALLED: itos(),putstring() *
1107
+ * *
1108
+ *****************************************************************************/
1109
+
1110
+ static void
1111
+ writemarker(int level, int tv, int index, int tcellsize,
1112
+ int numorbits, int numcells)
1113
+ {
1114
+ char s[30];
1115
+
1116
+ #define PUTINT(i) itos(i,s); putstring(outfile,s)
1117
+ #define PUTSTR(x) putstring(outfile,x)
1118
+
1119
+ PUTSTR("level ");
1120
+ PUTINT(level);
1121
+ PUTSTR(": ");
1122
+ if (numcells != numorbits)
1123
+ {
1124
+ PUTINT(numcells);
1125
+ PUTSTR(" cell");
1126
+ if (numcells == 1) PUTSTR("; ");
1127
+ else PUTSTR("s; ");
1128
+ }
1129
+ PUTINT(numorbits);
1130
+ PUTSTR(" orbit");
1131
+ if (numorbits == 1) PUTSTR("; ");
1132
+ else PUTSTR("s; ");
1133
+ PUTINT(tv+labelorg);
1134
+ PUTSTR(" fixed; index ");
1135
+ PUTINT(index);
1136
+ if (tcellsize != index)
1137
+ {
1138
+ PUTSTR("/");
1139
+ PUTINT(tcellsize);
1140
+ }
1141
+ PUTSTR("\n");
1142
+ }
1143
+
1144
+ /*****************************************************************************
1145
+ * *
1146
+ * nauty_check() checks that this file is compiled compatibly with the *
1147
+ * given parameters. If not, call exit(1). *
1148
+ * *
1149
+ *****************************************************************************/
1150
+
1151
+ void
1152
+ nauty_check(int wordsize, int m, int n, int version)
1153
+ {
1154
+ if (wordsize != WORDSIZE)
1155
+ {
1156
+ fprintf(ERRFILE,"Error: WORDSIZE mismatch in nauty.c\n");
1157
+ exit(1);
1158
+ }
1159
+
1160
+ #if MAXN
1161
+ if (m > MAXM)
1162
+ {
1163
+ fprintf(ERRFILE,"Error: MAXM inadequate in nauty.c\n");
1164
+ exit(1);
1165
+ }
1166
+
1167
+ if (n > MAXN)
1168
+ {
1169
+ fprintf(ERRFILE,"Error: MAXN inadequate in nauty.c\n");
1170
+ exit(1);
1171
+ }
1172
+ #endif
1173
+
1174
+ if (version < NAUTYREQUIRED)
1175
+ {
1176
+ fprintf(ERRFILE,"Error: nauty.c version mismatch\n");
1177
+ exit(1);
1178
+ }
1179
+
1180
+ #if !HAVE_TLS
1181
+ if ((version & 1))
1182
+ {
1183
+ fprintf(ERRFILE,
1184
+ "*** Warning: program with TLS calling nauty without TLS ***\n");
1185
+ }
1186
+ #endif
1187
+ }
1188
+
1189
+ /*****************************************************************************
1190
+ * *
1191
+ * extra_autom(p,n) - add an extra automorphism, hard to do correctly *
1192
+ * *
1193
+ *****************************************************************************/
1194
+
1195
+ void
1196
+ extra_autom(int *p, int n)
1197
+ {
1198
+ if (writeautoms)
1199
+ writeperm(outfile,p,cartesian,linelength,n);
1200
+ stats->numorbits = orbjoin(orbits,p,n);
1201
+ ++stats->numgenerators;
1202
+ OPTCALL(userautomproc)(stats->numgenerators,p,orbits,
1203
+ stats->numorbits,stabvertex,n);
1204
+ }
1205
+
1206
+ /*****************************************************************************
1207
+ * *
1208
+ * extra_level(level,lab,ptn,numcells,tv1,index,tcellsize,childcount) *
1209
+ * creates an artificial level in the search. This is dangerous. *
1210
+ * *
1211
+ *****************************************************************************/
1212
+
1213
+ void
1214
+ extra_level(int level, int *lab, int *ptn, int numcells, int tv1, int index,
1215
+ int tcellsize, int childcount, int n)
1216
+ {
1217
+ MULTIPLY(stats->grpsize1,stats->grpsize2,index);
1218
+ if (domarkers)
1219
+ writemarker(level,tv1,index,tcellsize,stats->numorbits,numcells);
1220
+ OPTCALL(userlevelproc)(lab,ptn,level,orbits,stats,tv1,index,tcellsize,
1221
+ numcells,childcount,n);
1222
+ }
1223
+
1224
+ /*****************************************************************************
1225
+ * *
1226
+ * nauty_freedyn() frees all the dynamic memory used in this module. *
1227
+ * *
1228
+ *****************************************************************************/
1229
+
1230
+ void
1231
+ nauty_freedyn(void)
1232
+ {
1233
+ #if !MAXN
1234
+ tcnode *tcp,*tcq;
1235
+
1236
+ tcp = tcnode0.next;
1237
+ while (tcp != NULL)
1238
+ {
1239
+ tcq = tcp->next;
1240
+ FREES(tcp->tcellptr);
1241
+ FREES(tcp);
1242
+ tcp = tcq;
1243
+ }
1244
+ alloc_m = 0;
1245
+ tcnode0.next = NULL;
1246
+ DYNFREE(firsttc,firsttc_sz);
1247
+ DYNFREE(canoncode,canoncode_sz);
1248
+ DYNFREE(firstcode,firstcode_sz);
1249
+ DYNFREE(workperm,workperm_sz);
1250
+ DYNFREE(canonlab,canonlab_sz);
1251
+ DYNFREE(firstlab,firstlab_sz);
1252
+ DYNFREE(defltwork,defltwork_sz);
1253
+ DYNFREE(fixedpts,fixedpts_sz);
1254
+ DYNFREE(active,active_sz);
1255
+ #endif
1256
+ }