okstra 0.113.0 → 0.115.0

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 (348) hide show
  1. package/README.kr.md +2 -2
  2. package/README.md +2 -2
  3. package/docs/for-ai/README.md +2 -2
  4. package/docs/for-ai/skills/{okstra-brief.md → okstra-brief-gen.md} +3 -3
  5. package/docs/for-ai/skills/okstra-inspect.md +1 -1
  6. package/docs/kr/architecture.md +11 -11
  7. package/docs/kr/cli.md +1 -1
  8. package/docs/kr/follow-ups/2026-07-10-final-report-option-3.md +51 -0
  9. package/docs/project-structure-overview.md +2 -2
  10. package/package.json +1 -1
  11. package/runtime/BUILD.json +2 -2
  12. package/runtime/agents/workers/report-writer-worker.md +1 -0
  13. package/runtime/prompts/lead/context-loader.md +2 -2
  14. package/runtime/prompts/lead/okstra-lead-contract.md +1 -1
  15. package/runtime/prompts/profiles/_common-contract.md +3 -3
  16. package/runtime/prompts/profiles/implementation-planning.md +1 -1
  17. package/runtime/prompts/profiles/requirements-discovery.md +2 -2
  18. package/runtime/python/okstra_ctl/fix_cycles.py +1 -1
  19. package/runtime/python/okstra_ctl/implementation_stage.py +46 -39
  20. package/runtime/python/okstra_ctl/report_views.py +151 -12
  21. package/runtime/python/okstra_ctl/run.py +24 -24
  22. package/runtime/python/okstra_ctl/wizard.py +3 -3
  23. package/runtime/python/okstra_ctl/worktree.py +1 -1
  24. package/runtime/python/okstra_token_usage/claude.py +58 -19
  25. package/runtime/python/okstra_token_usage/collect.py +3 -1
  26. package/runtime/python/okstra_vendor/__init__.py +3 -0
  27. package/runtime/schemas/final-report-v1.0.schema.json +20 -0
  28. package/runtime/skills/{okstra-brief → okstra-brief-gen}/SKILL.md +6 -6
  29. package/runtime/skills/{okstra-brief → okstra-brief-gen}/references/reporter-confirmations.md +1 -1
  30. package/runtime/skills/{okstra-brief → okstra-brief-gen}/references/tracker-recursion.md +1 -1
  31. package/runtime/skills/okstra-inspect/SKILL.md +2 -2
  32. package/runtime/templates/reports/brief.template.md +2 -2
  33. package/runtime/templates/reports/final-report.template.md +14 -0
  34. package/runtime/templates/reports/i18n/en.json +23 -12
  35. package/runtime/templates/reports/i18n/ko.json +23 -12
  36. package/runtime/templates/reports/report.css +55 -0
  37. package/runtime/templates/reports/report.js +53 -1
  38. package/runtime/validators/validate-brief.py +5 -5
  39. package/runtime/validators/validate-brief.sh +1 -1
  40. package/src/commands/lifecycle/uninstall.mjs +2 -1
  41. package/src/lib/skill-catalog.mjs +2 -1
  42. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/__init__.py +0 -0
  43. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_approx_clust_coeff.py +0 -41
  44. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_clique.py +0 -112
  45. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_connectivity.py +0 -199
  46. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_density.py +0 -146
  47. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_distance_measures.py +0 -59
  48. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_dominating_set.py +0 -78
  49. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_kcomponents.py +0 -303
  50. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_matching.py +0 -8
  51. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_maxcut.py +0 -94
  52. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_ramsey.py +0 -31
  53. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_steinertree.py +0 -306
  54. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_traveling_salesman.py +0 -1014
  55. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_treewidth.py +0 -274
  56. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_vertex_cover.py +0 -68
  57. package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/__init__.py +0 -0
  58. package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/base_test.py +0 -81
  59. package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_connectivity.py +0 -143
  60. package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_correlation.py +0 -122
  61. package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_mixing.py +0 -174
  62. package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_neighbor_degree.py +0 -107
  63. package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_pairs.py +0 -87
  64. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/__init__.py +0 -0
  65. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_basic.py +0 -125
  66. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_centrality.py +0 -192
  67. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_cluster.py +0 -84
  68. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_covering.py +0 -33
  69. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_edgelist.py +0 -240
  70. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_extendability.py +0 -334
  71. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_generators.py +0 -407
  72. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_link_analysis.py +0 -218
  73. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_matching.py +0 -327
  74. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_matrix.py +0 -138
  75. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_project.py +0 -409
  76. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_redundancy.py +0 -35
  77. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_spectral_bipartivity.py +0 -80
  78. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/__init__.py +0 -0
  79. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_betweenness_centrality.py +0 -923
  80. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_betweenness_centrality_subset.py +0 -354
  81. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_closeness_centrality.py +0 -274
  82. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality.py +0 -259
  83. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality_subset.py +0 -147
  84. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_closeness.py +0 -43
  85. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_degree_centrality.py +0 -144
  86. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_dispersion.py +0 -73
  87. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_eigenvector_centrality.py +0 -186
  88. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_group.py +0 -277
  89. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_harmonic_centrality.py +0 -122
  90. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_katz_centrality.py +0 -345
  91. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_laplacian_centrality.py +0 -220
  92. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_load_centrality.py +0 -344
  93. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_percolation_centrality.py +0 -87
  94. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_reaching.py +0 -140
  95. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_second_order_centrality.py +0 -82
  96. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_subgraph.py +0 -110
  97. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_trophic.py +0 -302
  98. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_voterank.py +0 -64
  99. package/runtime/python/okstra_vendor/networkx/algorithms/coloring/tests/__init__.py +0 -0
  100. package/runtime/python/okstra_vendor/networkx/algorithms/coloring/tests/test_coloring.py +0 -863
  101. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/__init__.py +0 -0
  102. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_asyn_fluid.py +0 -147
  103. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_bipartitions.py +0 -157
  104. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_centrality.py +0 -85
  105. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_divisive.py +0 -106
  106. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_kclique.py +0 -91
  107. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_label_propagation.py +0 -241
  108. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_leiden.py +0 -138
  109. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_local.py +0 -76
  110. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_louvain.py +0 -264
  111. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_lukes.py +0 -152
  112. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_modularity_max.py +0 -340
  113. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_quality.py +0 -139
  114. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_utils.py +0 -26
  115. package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/__init__.py +0 -0
  116. package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_attracting.py +0 -70
  117. package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_biconnected.py +0 -248
  118. package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_connected.py +0 -138
  119. package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_semiconnected.py +0 -55
  120. package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_strongly_connected.py +0 -193
  121. package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_weakly_connected.py +0 -96
  122. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/__init__.py +0 -0
  123. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_connectivity.py +0 -421
  124. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_cuts.py +0 -309
  125. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_disjoint_paths.py +0 -249
  126. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_edge_augmentation.py +0 -502
  127. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_edge_kcomponents.py +0 -488
  128. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_kcomponents.py +0 -323
  129. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_kcutsets.py +0 -280
  130. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_stoer_wagner.py +0 -102
  131. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/__init__.py +0 -0
  132. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/gl1.gpickle.bz2 +0 -0
  133. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/gw1.gpickle.bz2 +0 -0
  134. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/netgen-2.gpickle.bz2 +0 -0
  135. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_gomory_hu.py +0 -128
  136. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_maxflow.py +0 -573
  137. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_maxflow_large_graph.py +0 -155
  138. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_mincost.py +0 -475
  139. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_networksimplex.py +0 -481
  140. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/wlm3.gpickle.bz2 +0 -0
  141. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/__init__.py +0 -0
  142. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/iso_r01_s80.A99 +0 -0
  143. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/iso_r01_s80.B99 +0 -0
  144. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/si2_b06_m200.A99 +0 -0
  145. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/si2_b06_m200.B99 +0 -0
  146. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_ismags.py +0 -719
  147. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_isomorphism.py +0 -103
  148. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_isomorphvf2.py +0 -490
  149. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_match_helpers.py +0 -64
  150. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_temporalisomorphvf2.py +0 -212
  151. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_tree_isomorphism.py +0 -202
  152. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2pp.py +0 -1655
  153. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2pp_helpers.py +0 -3118
  154. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2userfunc.py +0 -196
  155. package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/__init__.py +0 -0
  156. package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/test_hits.py +0 -77
  157. package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/test_pagerank.py +0 -213
  158. package/runtime/python/okstra_vendor/networkx/algorithms/minors/tests/test_contraction.py +0 -544
  159. package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/__init__.py +0 -0
  160. package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_all.py +0 -328
  161. package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_binary.py +0 -451
  162. package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_product.py +0 -491
  163. package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_unary.py +0 -55
  164. package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/__init__.py +0 -0
  165. package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_astar.py +0 -254
  166. package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_dense.py +0 -212
  167. package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_dense_numpy.py +0 -88
  168. package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_generic.py +0 -511
  169. package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_unweighted.py +0 -149
  170. package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_weighted.py +0 -983
  171. package/runtime/python/okstra_vendor/networkx/algorithms/tests/__init__.py +0 -0
  172. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_asteroidal.py +0 -23
  173. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_boundary.py +0 -154
  174. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_bridges.py +0 -144
  175. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_broadcasting.py +0 -109
  176. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_chains.py +0 -136
  177. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_chordal.py +0 -129
  178. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_clique.py +0 -300
  179. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cluster.py +0 -678
  180. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_communicability.py +0 -80
  181. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_core.py +0 -266
  182. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_covering.py +0 -85
  183. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cuts.py +0 -171
  184. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cycles.py +0 -984
  185. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_d_separation.py +0 -340
  186. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dag.py +0 -835
  187. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_distance_measures.py +0 -831
  188. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_distance_regular.py +0 -85
  189. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dominance.py +0 -299
  190. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dominating.py +0 -115
  191. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_efficiency.py +0 -58
  192. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_euler.py +0 -314
  193. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_graph_hashing.py +0 -872
  194. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_graphical.py +0 -163
  195. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_hierarchy.py +0 -46
  196. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_hybrid.py +0 -24
  197. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_isolate.py +0 -26
  198. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_link_prediction.py +0 -615
  199. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_lowest_common_ancestors.py +0 -459
  200. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_matching.py +0 -556
  201. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_max_weight_clique.py +0 -179
  202. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_mis.py +0 -62
  203. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_moral.py +0 -15
  204. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_node_classification.py +0 -140
  205. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_non_randomness.py +0 -60
  206. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_perfect_graph.py +0 -27
  207. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_planar_drawing.py +0 -274
  208. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_planarity.py +0 -556
  209. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_polynomials.py +0 -57
  210. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_reciprocity.py +0 -37
  211. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_regular.py +0 -88
  212. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_richclub.py +0 -149
  213. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_similarity.py +0 -1158
  214. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_simple_paths.py +0 -803
  215. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_smallworld.py +0 -76
  216. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_smetric.py +0 -8
  217. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_sparsifiers.py +0 -138
  218. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_structuralholes.py +0 -191
  219. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_summarization.py +0 -642
  220. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_swap.py +0 -179
  221. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_threshold.py +0 -270
  222. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_time_dependent.py +0 -431
  223. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_tournament.py +0 -161
  224. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_triads.py +0 -248
  225. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_vitality.py +0 -41
  226. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_voronoi.py +0 -103
  227. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_walks.py +0 -54
  228. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_wiener.py +0 -157
  229. package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/__init__.py +0 -0
  230. package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_beamsearch.py +0 -25
  231. package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_bfs.py +0 -203
  232. package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_dfs.py +0 -307
  233. package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_edgebfs.py +0 -147
  234. package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_edgedfs.py +0 -131
  235. package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/__init__.py +0 -0
  236. package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_branchings.py +0 -624
  237. package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_coding.py +0 -114
  238. package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_decomposition.py +0 -79
  239. package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_distance_measures.py +0 -99
  240. package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_mst.py +0 -934
  241. package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_operations.py +0 -53
  242. package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_recognition.py +0 -174
  243. package/runtime/python/okstra_vendor/networkx/classes/tests/__init__.py +0 -0
  244. package/runtime/python/okstra_vendor/networkx/classes/tests/dispatch_interface.py +0 -192
  245. package/runtime/python/okstra_vendor/networkx/classes/tests/historical_tests.py +0 -476
  246. package/runtime/python/okstra_vendor/networkx/classes/tests/test_coreviews.py +0 -362
  247. package/runtime/python/okstra_vendor/networkx/classes/tests/test_digraph.py +0 -331
  248. package/runtime/python/okstra_vendor/networkx/classes/tests/test_digraph_historical.py +0 -110
  249. package/runtime/python/okstra_vendor/networkx/classes/tests/test_filters.py +0 -177
  250. package/runtime/python/okstra_vendor/networkx/classes/tests/test_function.py +0 -1045
  251. package/runtime/python/okstra_vendor/networkx/classes/tests/test_graph.py +0 -950
  252. package/runtime/python/okstra_vendor/networkx/classes/tests/test_graph_historical.py +0 -12
  253. package/runtime/python/okstra_vendor/networkx/classes/tests/test_graphviews.py +0 -349
  254. package/runtime/python/okstra_vendor/networkx/classes/tests/test_multidigraph.py +0 -459
  255. package/runtime/python/okstra_vendor/networkx/classes/tests/test_multigraph.py +0 -528
  256. package/runtime/python/okstra_vendor/networkx/classes/tests/test_reportviews.py +0 -1421
  257. package/runtime/python/okstra_vendor/networkx/classes/tests/test_special.py +0 -131
  258. package/runtime/python/okstra_vendor/networkx/classes/tests/test_subgraphviews.py +0 -371
  259. package/runtime/python/okstra_vendor/networkx/conftest.py +0 -261
  260. package/runtime/python/okstra_vendor/networkx/drawing/tests/__init__.py +0 -0
  261. package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_complex.png +0 -0
  262. package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_empty_graph.png +0 -0
  263. package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_house_with_colors.png +0 -0
  264. package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_labels_and_colors.png +0 -0
  265. package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_shortest_path.png +0 -0
  266. package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_house_with_colors.png +0 -0
  267. package/runtime/python/okstra_vendor/networkx/drawing/tests/test_agraph.py +0 -237
  268. package/runtime/python/okstra_vendor/networkx/drawing/tests/test_image_comparison_pylab_mpl.py +0 -229
  269. package/runtime/python/okstra_vendor/networkx/drawing/tests/test_latex.py +0 -285
  270. package/runtime/python/okstra_vendor/networkx/drawing/tests/test_layout.py +0 -631
  271. package/runtime/python/okstra_vendor/networkx/drawing/tests/test_pydot.py +0 -146
  272. package/runtime/python/okstra_vendor/networkx/drawing/tests/test_pylab.py +0 -1582
  273. package/runtime/python/okstra_vendor/networkx/generators/tests/__init__.py +0 -0
  274. package/runtime/python/okstra_vendor/networkx/generators/tests/test_atlas.py +0 -75
  275. package/runtime/python/okstra_vendor/networkx/generators/tests/test_classic.py +0 -642
  276. package/runtime/python/okstra_vendor/networkx/generators/tests/test_cographs.py +0 -20
  277. package/runtime/python/okstra_vendor/networkx/generators/tests/test_community.py +0 -362
  278. package/runtime/python/okstra_vendor/networkx/generators/tests/test_degree_seq.py +0 -224
  279. package/runtime/python/okstra_vendor/networkx/generators/tests/test_directed.py +0 -189
  280. package/runtime/python/okstra_vendor/networkx/generators/tests/test_duplication.py +0 -103
  281. package/runtime/python/okstra_vendor/networkx/generators/tests/test_ego.py +0 -39
  282. package/runtime/python/okstra_vendor/networkx/generators/tests/test_expanders.py +0 -182
  283. package/runtime/python/okstra_vendor/networkx/generators/tests/test_geometric.py +0 -488
  284. package/runtime/python/okstra_vendor/networkx/generators/tests/test_harary_graph.py +0 -133
  285. package/runtime/python/okstra_vendor/networkx/generators/tests/test_internet_as_graphs.py +0 -221
  286. package/runtime/python/okstra_vendor/networkx/generators/tests/test_intersection.py +0 -28
  287. package/runtime/python/okstra_vendor/networkx/generators/tests/test_interval_graph.py +0 -144
  288. package/runtime/python/okstra_vendor/networkx/generators/tests/test_joint_degree_seq.py +0 -125
  289. package/runtime/python/okstra_vendor/networkx/generators/tests/test_lattice.py +0 -264
  290. package/runtime/python/okstra_vendor/networkx/generators/tests/test_line.py +0 -316
  291. package/runtime/python/okstra_vendor/networkx/generators/tests/test_mycielski.py +0 -30
  292. package/runtime/python/okstra_vendor/networkx/generators/tests/test_nonisomorphic_trees.py +0 -82
  293. package/runtime/python/okstra_vendor/networkx/generators/tests/test_random_clustered.py +0 -33
  294. package/runtime/python/okstra_vendor/networkx/generators/tests/test_random_graphs.py +0 -495
  295. package/runtime/python/okstra_vendor/networkx/generators/tests/test_small.py +0 -220
  296. package/runtime/python/okstra_vendor/networkx/generators/tests/test_spectral_graph_forge.py +0 -49
  297. package/runtime/python/okstra_vendor/networkx/generators/tests/test_stochastic.py +0 -72
  298. package/runtime/python/okstra_vendor/networkx/generators/tests/test_sudoku.py +0 -92
  299. package/runtime/python/okstra_vendor/networkx/generators/tests/test_time_series.py +0 -64
  300. package/runtime/python/okstra_vendor/networkx/generators/tests/test_trees.py +0 -195
  301. package/runtime/python/okstra_vendor/networkx/generators/tests/test_triads.py +0 -15
  302. package/runtime/python/okstra_vendor/networkx/linalg/tests/__init__.py +0 -0
  303. package/runtime/python/okstra_vendor/networkx/linalg/tests/test_algebraic_connectivity.py +0 -400
  304. package/runtime/python/okstra_vendor/networkx/linalg/tests/test_attrmatrix.py +0 -108
  305. package/runtime/python/okstra_vendor/networkx/linalg/tests/test_bethehessian.py +0 -40
  306. package/runtime/python/okstra_vendor/networkx/linalg/tests/test_graphmatrix.py +0 -275
  307. package/runtime/python/okstra_vendor/networkx/linalg/tests/test_laplacian.py +0 -334
  308. package/runtime/python/okstra_vendor/networkx/linalg/tests/test_modularity.py +0 -86
  309. package/runtime/python/okstra_vendor/networkx/linalg/tests/test_spectrum.py +0 -70
  310. package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/__init__.py +0 -0
  311. package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_adjacency.py +0 -78
  312. package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_cytoscape.py +0 -78
  313. package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_node_link.py +0 -109
  314. package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_tree.py +0 -48
  315. package/runtime/python/okstra_vendor/networkx/readwrite/tests/__init__.py +0 -0
  316. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_adjlist.py +0 -354
  317. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_edgelist.py +0 -318
  318. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_gexf.py +0 -612
  319. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_gml.py +0 -744
  320. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_graph6.py +0 -181
  321. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_graphml.py +0 -1531
  322. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_leda.py +0 -30
  323. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_p2g.py +0 -63
  324. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_pajek.py +0 -128
  325. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_sparse6.py +0 -166
  326. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_text.py +0 -1742
  327. package/runtime/python/okstra_vendor/networkx/tests/__init__.py +0 -0
  328. package/runtime/python/okstra_vendor/networkx/tests/test_all_random_functions.py +0 -248
  329. package/runtime/python/okstra_vendor/networkx/tests/test_convert.py +0 -321
  330. package/runtime/python/okstra_vendor/networkx/tests/test_convert_numpy.py +0 -531
  331. package/runtime/python/okstra_vendor/networkx/tests/test_convert_pandas.py +0 -349
  332. package/runtime/python/okstra_vendor/networkx/tests/test_convert_scipy.py +0 -281
  333. package/runtime/python/okstra_vendor/networkx/tests/test_exceptions.py +0 -40
  334. package/runtime/python/okstra_vendor/networkx/tests/test_import.py +0 -11
  335. package/runtime/python/okstra_vendor/networkx/tests/test_lazy_imports.py +0 -96
  336. package/runtime/python/okstra_vendor/networkx/tests/test_relabel.py +0 -349
  337. package/runtime/python/okstra_vendor/networkx/tests/test_removed_functions_exception_messages.py +0 -8
  338. package/runtime/python/okstra_vendor/networkx/utils/tests/__init__.py +0 -0
  339. package/runtime/python/okstra_vendor/networkx/utils/tests/test__init.py +0 -11
  340. package/runtime/python/okstra_vendor/networkx/utils/tests/test_backends.py +0 -225
  341. package/runtime/python/okstra_vendor/networkx/utils/tests/test_config.py +0 -263
  342. package/runtime/python/okstra_vendor/networkx/utils/tests/test_decorators.py +0 -510
  343. package/runtime/python/okstra_vendor/networkx/utils/tests/test_heaps.py +0 -131
  344. package/runtime/python/okstra_vendor/networkx/utils/tests/test_mapped_queue.py +0 -268
  345. package/runtime/python/okstra_vendor/networkx/utils/tests/test_misc.py +0 -393
  346. package/runtime/python/okstra_vendor/networkx/utils/tests/test_random_sequence.py +0 -53
  347. package/runtime/python/okstra_vendor/networkx/utils/tests/test_rcm.py +0 -63
  348. package/runtime/python/okstra_vendor/networkx/utils/tests/test_unionfind.py +0 -55
@@ -1,103 +0,0 @@
1
- from functools import partial
2
-
3
- import pytest
4
-
5
- import networkx as nx
6
- from networkx.algorithms import isomorphism as iso
7
-
8
- # Convenience functions for testing that the behavior of `could_be_isomorphic`
9
- # with the "properties" kwarg is equivalent to the corresponding function (i.e.
10
- # nx.fast_could_be_isomorphic or nx.faster_could_be_isomorphic)
11
- fast_cbi = partial(nx.could_be_isomorphic, properties="dt")
12
- faster_cbi = partial(nx.could_be_isomorphic, properties="d")
13
-
14
-
15
- def test_graph_could_be_isomorphic_variants_deprecated():
16
- G1 = nx.Graph([(1, 2), (1, 3), (1, 5), (2, 3)])
17
- G2 = nx.Graph([(10, 20), (20, 30), (10, 30), (10, 50)])
18
- with pytest.deprecated_call(): # graph_could_be_isomorphic
19
- result = nx.isomorphism.isomorph.graph_could_be_isomorphic(G1, G2)
20
- assert nx.could_be_isomorphic(G1, G2) == result
21
- with pytest.deprecated_call(): # fast_graph_could_be_isomorphic
22
- result = nx.isomorphism.isomorph.fast_graph_could_be_isomorphic(G1, G2)
23
- assert nx.fast_could_be_isomorphic(G1, G2) == result
24
- with pytest.deprecated_call():
25
- result = nx.isomorphism.isomorph.faster_graph_could_be_isomorphic(G1, G2)
26
- assert nx.faster_could_be_isomorphic(G1, G2) == result
27
-
28
-
29
- @pytest.mark.parametrize("atlas_ids", [(699, 706), (864, 870)])
30
- def test_could_be_isomorphic_combined_properties(atlas_ids):
31
- """There are two pairs of graphs from the graph atlas that have the same
32
- combined degree-triangle distribution, but a different maximal clique
33
- distribution. See gh-7852."""
34
- G, H = (nx.graph_atlas(idx) for idx in atlas_ids)
35
-
36
- assert not nx.is_isomorphic(G, H)
37
-
38
- # Degree only
39
- assert nx.faster_could_be_isomorphic(G, H)
40
- assert nx.could_be_isomorphic(G, H, properties="d")
41
- # Degrees & triangles
42
- assert nx.fast_could_be_isomorphic(G, H)
43
- assert nx.could_be_isomorphic(G, H, properties="dt")
44
- # Full properties table (degrees, triangles, cliques)
45
- assert not nx.could_be_isomorphic(G, H)
46
- assert not nx.could_be_isomorphic(G, H, properties="dtc")
47
- # For these two cases, the clique distribution alone is enough to verify
48
- # the graphs can't be isomorphic
49
- assert not nx.could_be_isomorphic(G, H, properties="c")
50
-
51
-
52
- def test_could_be_isomorphic_individual_vs_combined_dt():
53
- """A test case where G and H have identical degree and triangle distributions,
54
- but are different when compared together"""
55
- G = nx.Graph([(0, 1), (0, 2), (0, 3), (0, 4), (1, 2), (3, 4), (4, 5), (4, 6)])
56
- H = G.copy()
57
- # Modify graphs to produce different clique distributions
58
- G.add_edge(0, 7)
59
- H.add_edge(4, 7)
60
- assert nx.could_be_isomorphic(G, H, properties="d")
61
- assert nx.could_be_isomorphic(G, H, properties="t")
62
- assert not nx.could_be_isomorphic(G, H, properties="dt")
63
- assert not nx.could_be_isomorphic(G, H, properties="c")
64
-
65
-
66
- class TestIsomorph:
67
- @classmethod
68
- def setup_class(cls):
69
- cls.G1 = nx.Graph([[1, 2], [1, 3], [1, 5], [2, 3]])
70
- cls.G2 = nx.Graph([[10, 20], [20, 30], [10, 30], [10, 50]])
71
- cls.G3 = nx.Graph([[1, 2], [1, 3], [1, 5], [2, 5]])
72
- cls.G4 = nx.Graph([[1, 2], [1, 3], [1, 5], [2, 4]])
73
- cls.G5 = nx.Graph([[1, 2], [1, 3]])
74
- cls.G6 = nx.Graph([[10, 20], [20, 30], [10, 30], [10, 50], [20, 50]])
75
-
76
- def test_could_be_isomorphic(self):
77
- assert iso.could_be_isomorphic(self.G1, self.G2)
78
- assert iso.could_be_isomorphic(self.G1, self.G3)
79
- assert not iso.could_be_isomorphic(self.G1, self.G4)
80
- assert iso.could_be_isomorphic(self.G3, self.G2)
81
- assert not iso.could_be_isomorphic(self.G1, self.G6)
82
-
83
- @pytest.mark.parametrize("fn", (iso.fast_could_be_isomorphic, fast_cbi))
84
- def test_fast_could_be_isomorphic(self, fn):
85
- assert fn(self.G3, self.G2)
86
- assert not fn(self.G3, self.G5)
87
- assert not fn(self.G1, self.G6)
88
-
89
- @pytest.mark.parametrize("fn", (iso.faster_could_be_isomorphic, faster_cbi))
90
- def test_faster_could_be_isomorphic(self, fn):
91
- assert fn(self.G3, self.G2)
92
- assert not fn(self.G3, self.G5)
93
- assert not fn(self.G1, self.G6)
94
-
95
- def test_is_isomorphic(self):
96
- assert iso.is_isomorphic(self.G1, self.G2)
97
- assert not iso.is_isomorphic(self.G1, self.G4)
98
- assert iso.is_isomorphic(self.G1.to_directed(), self.G2.to_directed())
99
- assert not iso.is_isomorphic(self.G1.to_directed(), self.G4.to_directed())
100
- with pytest.raises(
101
- nx.NetworkXError, match="Graphs G1 and G2 are not of the same type."
102
- ):
103
- iso.is_isomorphic(self.G1.to_directed(), self.G1)
@@ -1,490 +0,0 @@
1
- """
2
- Tests for VF2 isomorphism algorithm.
3
- """
4
-
5
- import importlib.resources
6
- import random
7
- import struct
8
-
9
- import pytest
10
-
11
- import networkx as nx
12
- from networkx.algorithms import isomorphism as iso
13
-
14
-
15
- class TestWikipediaExample:
16
- # Source: https://en.wikipedia.org/wiki/Graph_isomorphism
17
-
18
- # Nodes 'a', 'b', 'c' and 'd' form a column.
19
- # Nodes 'g', 'h', 'i' and 'j' form a column.
20
- # isomorphism: {'a': 1, 'g': 2, 'b': 3, 'c': 6, 'h': 4, 'i': 5, 'j': 7, 'd': 8}
21
- g1edges = [
22
- ["a", "g"],
23
- ["a", "h"],
24
- ["a", "i"],
25
- ["b", "g"],
26
- ["b", "h"],
27
- ["b", "j"],
28
- ["c", "g"],
29
- ["c", "i"],
30
- ["c", "j"],
31
- ["d", "h"],
32
- ["d", "i"],
33
- ["d", "j"],
34
- ]
35
-
36
- # Nodes 1,2,3,4 form the clockwise corners of a large square.
37
- # Nodes 5,6,7,8 form the clockwise corners of a small square
38
- g2edges = [
39
- [1, 2],
40
- [3, 2],
41
- [3, 4],
42
- [1, 4],
43
- [6, 5],
44
- [6, 7],
45
- [8, 7],
46
- [8, 5],
47
- [1, 5],
48
- [6, 2],
49
- [3, 7],
50
- [8, 4],
51
- ]
52
-
53
- @pytest.mark.parametrize(
54
- ["graph_class", "numb_maps"], [(nx.Graph, 48), (nx.DiGraph, 24)]
55
- )
56
- def test_morphic_and_number_of_mappings(self, graph_class, numb_maps):
57
- g1 = graph_class(self.g1edges)
58
- g2 = graph_class(self.g2edges)
59
- Matcher = iso.DiGraphMatcher if g1.is_directed() else iso.GraphMatcher
60
- gm = Matcher(g1, g2)
61
- assert gm.is_isomorphic()
62
- assert gm.subgraph_is_monomorphic()
63
- assert gm.subgraph_is_isomorphic()
64
-
65
- mapping = list(gm.mapping.items())
66
- # this mapping is only one of the 48 possibilities
67
- all_mappings = list(gm.isomorphisms_iter())
68
- assert len(all_mappings) == numb_maps
69
- assert dict(mapping) in all_mappings
70
-
71
- @pytest.mark.parametrize("graph_class", [nx.Graph, nx.DiGraph])
72
- def test_subgraph(self, graph_class):
73
- g1 = graph_class(self.g1edges)
74
- g2 = graph_class(self.g2edges)
75
- g3 = g2.subgraph([1, 2, 3, 4])
76
- Matcher = iso.DiGraphMatcher if g1.is_directed() else iso.GraphMatcher
77
- gm = Matcher(g1, g3)
78
- assert not gm.is_isomorphic()
79
- assert gm.subgraph_is_isomorphic()
80
- assert gm.subgraph_is_monomorphic()
81
-
82
- @pytest.mark.parametrize("graph_class", [nx.Graph, nx.DiGraph])
83
- def test_subgraph_mono(self, graph_class):
84
- g1 = graph_class(self.g1edges)
85
- g2 = graph_class(["ag", "cg", "ci", "di", "bg"])
86
- Matcher = iso.DiGraphMatcher if g1.is_directed() else iso.GraphMatcher
87
- gm = Matcher(g1, g2)
88
- assert not gm.is_isomorphic()
89
- assert not gm.subgraph_is_isomorphic()
90
- assert gm.subgraph_is_monomorphic()
91
-
92
- # note: this shows need to recreate the matcher for each graph change
93
- # Also checking not monomorphic
94
- g2.add_edge("c", "a")
95
- gm = Matcher(g1, g2)
96
- assert not gm.subgraph_is_monomorphic()
97
-
98
-
99
- class TestVF2GraphDB:
100
- # https://web.archive.org/web/20090303210205/http://amalfi.dis.unina.it/graph/db/
101
-
102
- @staticmethod
103
- def create_graph(filename):
104
- """Creates a Graph instance from the filename."""
105
-
106
- # The file is assumed to be in the format from the VF2 graph database.
107
- # Each file is composed of 16-bit numbers (unsigned short int).
108
- # So we will want to read 2 bytes at a time.
109
-
110
- # We can read the number as follows:
111
- # number = struct.unpack('<H', file.read(2))
112
- # This says, expect the data in little-endian encoding
113
- # as an unsigned short int and unpack 2 bytes from the file.
114
-
115
- fh = open(filename, mode="rb")
116
-
117
- # Grab the number of nodes.
118
- # Node numeration is 0-based, so the first node has index 0.
119
- nodes = struct.unpack("<H", fh.read(2))[0]
120
-
121
- graph = nx.Graph()
122
- for from_node in range(nodes):
123
- # Get the number of edges.
124
- edges = struct.unpack("<H", fh.read(2))[0]
125
- for edge in range(edges):
126
- # Get the terminal node.
127
- to_node = struct.unpack("<H", fh.read(2))[0]
128
- graph.add_edge(from_node, to_node)
129
-
130
- fh.close()
131
- return graph
132
-
133
- def test_graph(self):
134
- head = importlib.resources.files("networkx.algorithms.isomorphism.tests")
135
- g1 = self.create_graph(head / "iso_r01_s80.A99")
136
- g2 = self.create_graph(head / "iso_r01_s80.B99")
137
- gm = iso.GraphMatcher(g1, g2)
138
- assert gm.is_isomorphic()
139
-
140
- def test_subgraph(self):
141
- # A is the subgraph
142
- # B is the full graph
143
- head = importlib.resources.files("networkx.algorithms.isomorphism.tests")
144
- subgraph = self.create_graph(head / "si2_b06_m200.A99")
145
- graph = self.create_graph(head / "si2_b06_m200.B99")
146
- gm = iso.GraphMatcher(graph, subgraph)
147
- assert not gm.is_isomorphic()
148
- assert gm.subgraph_is_isomorphic()
149
- assert gm.subgraph_is_monomorphic()
150
-
151
- def test_subgraph_monomorphic(self):
152
- # A is the subgraph
153
- # B is the full graph
154
- head = importlib.resources.files("networkx.algorithms.isomorphism.tests")
155
- subgraph = self.create_graph(head / "si2_b06_m200.A99")
156
- graph = self.create_graph(head / "si2_b06_m200.B99")
157
- subgraph.remove_edge(29, 28)
158
- gm = iso.GraphMatcher(graph, subgraph)
159
- assert not gm.is_isomorphic()
160
- assert not gm.subgraph_is_isomorphic()
161
- assert gm.subgraph_is_monomorphic()
162
-
163
- # now add new edge to make sg no longer monomorphic
164
- subgraph.add_edge(29, 2)
165
- assert not gm.subgraph_is_monomorphic()
166
-
167
-
168
- class TestAtlas:
169
- @classmethod
170
- def setup_class(cls):
171
- global atlas
172
- from networkx.generators import atlas
173
-
174
- cls.GAG = atlas.graph_atlas_g()
175
-
176
- def test_graph_atlas(self):
177
- rng = random.Random(42)
178
- # Atlas = nx.graph_atlas_g()[0:208] # 208, 6 nodes or less
179
- Atlas = self.GAG[0:100]
180
- alphabet = list(range(26))
181
- for graph in Atlas:
182
- nlist = list(graph)
183
- labels = alphabet[: len(nlist)]
184
- for _ in range(10):
185
- rng.shuffle(labels)
186
- d = dict(zip(nlist, labels))
187
- relabel = nx.relabel_nodes(graph, d)
188
- gm = iso.GraphMatcher(graph, relabel)
189
- assert gm.is_isomorphic()
190
-
191
-
192
- def test_multiedge():
193
- # Simple test for multigraphs
194
- # Need something much more rigorous
195
- edges = [
196
- (0, 1),
197
- (1, 2),
198
- (2, 3),
199
- (3, 4),
200
- (4, 5),
201
- (5, 6),
202
- (6, 7),
203
- (7, 8),
204
- (8, 9),
205
- (9, 10),
206
- (10, 11),
207
- (10, 11),
208
- (11, 12),
209
- (11, 12),
210
- (12, 13),
211
- (12, 13),
212
- (13, 14),
213
- (13, 14),
214
- (14, 15),
215
- (14, 15),
216
- (15, 16),
217
- (15, 16),
218
- (16, 17),
219
- (16, 17),
220
- (17, 18),
221
- (17, 18),
222
- (18, 19),
223
- (18, 19),
224
- (19, 0),
225
- (19, 0),
226
- ]
227
- nodes = list(range(20))
228
-
229
- rng = random.Random(42)
230
-
231
- for g1 in [nx.MultiGraph(), nx.MultiDiGraph()]:
232
- g1.add_edges_from(edges)
233
- for _ in range(10):
234
- new_nodes = list(nodes)
235
- rng.shuffle(new_nodes)
236
- d = dict(zip(nodes, new_nodes))
237
- g2 = nx.relabel_nodes(g1, d)
238
- if not g1.is_directed():
239
- gm = iso.GraphMatcher(g1, g2)
240
- else:
241
- gm = iso.DiGraphMatcher(g1, g2)
242
- assert gm.is_isomorphic()
243
- # Testing if monomorphism works in multigraphs
244
- assert gm.subgraph_is_monomorphic()
245
-
246
-
247
- @pytest.mark.parametrize("G1", [nx.Graph(), nx.MultiGraph()])
248
- @pytest.mark.parametrize("G2", [nx.Graph(), nx.MultiGraph()])
249
- def test_matcher_raises(G1, G2):
250
- undirected_matchers = [iso.GraphMatcher, iso.MultiGraphMatcher]
251
- directed_matchers = [iso.DiGraphMatcher, iso.MultiDiGraphMatcher]
252
-
253
- for matcher in undirected_matchers:
254
- matcher(G1, G2)
255
-
256
- msg = r"\(Multi-\)GraphMatcher\(\) not defined for directed graphs"
257
- with pytest.raises(nx.NetworkXError, match=msg):
258
- matcher(G1.to_directed(), G2.to_directed())
259
-
260
- for matcher in directed_matchers:
261
- matcher(G1.to_directed(), G2.to_directed())
262
-
263
- msg = r"\(Multi-\)DiGraphMatcher\(\) not defined for undirected graphs"
264
- with pytest.raises(nx.NetworkXError, match=msg):
265
- matcher(G1, G2)
266
-
267
- for matcher in undirected_matchers + directed_matchers:
268
- msg = r"G1 and G2 must have the same directedness"
269
- with pytest.raises(nx.NetworkXError, match=msg):
270
- matcher(G1, G2.to_directed())
271
- with pytest.raises(nx.NetworkXError, match=msg):
272
- matcher(G1.to_directed(), G2)
273
-
274
-
275
- def test_selfloop():
276
- # Simple test for graphs with selfloops
277
- edges = [
278
- (0, 1),
279
- (0, 2),
280
- (1, 2),
281
- (1, 3),
282
- (2, 2),
283
- (2, 4),
284
- (3, 1),
285
- (3, 2),
286
- (4, 2),
287
- (4, 5),
288
- (5, 4),
289
- ]
290
- nodes = list(range(6))
291
-
292
- rng = random.Random(42)
293
-
294
- for g1 in [nx.Graph(), nx.DiGraph()]:
295
- g1.add_edges_from(edges)
296
- for _ in range(100):
297
- new_nodes = list(nodes)
298
- rng.shuffle(new_nodes)
299
- d = dict(zip(nodes, new_nodes))
300
- g2 = nx.relabel_nodes(g1, d)
301
- if not g1.is_directed():
302
- gm = iso.GraphMatcher(g1, g2)
303
- else:
304
- gm = iso.DiGraphMatcher(g1, g2)
305
- assert gm.is_isomorphic()
306
-
307
-
308
- def test_selfloop_mono():
309
- # Simple test for graphs with selfloops
310
- edges0 = [
311
- (0, 1),
312
- (0, 2),
313
- (1, 2),
314
- (1, 3),
315
- (2, 4),
316
- (3, 1),
317
- (3, 2),
318
- (4, 2),
319
- (4, 5),
320
- (5, 4),
321
- ]
322
- edges = edges0 + [(2, 2)]
323
- nodes = list(range(6))
324
-
325
- rng = random.Random(42)
326
-
327
- for g1 in [nx.Graph(), nx.DiGraph()]:
328
- g1.add_edges_from(edges)
329
- for _ in range(100):
330
- new_nodes = list(nodes)
331
- rng.shuffle(new_nodes)
332
- d = dict(zip(nodes, new_nodes))
333
- g2 = nx.relabel_nodes(g1, d)
334
- g2.remove_edges_from(nx.selfloop_edges(g2))
335
- if not g1.is_directed():
336
- gm = iso.GraphMatcher(g2, g1)
337
- else:
338
- gm = iso.DiGraphMatcher(g2, g1)
339
- assert not gm.subgraph_is_monomorphic()
340
-
341
-
342
- def test_isomorphism_iter1():
343
- # As described in:
344
- # http://groups.google.com/group/networkx-discuss/browse_thread/thread/2ff65c67f5e3b99f/d674544ebea359bb?fwc=1
345
- g1 = nx.DiGraph(["AB", "BC"])
346
- g2 = nx.DiGraph(["YZ"])
347
- g3 = nx.DiGraph(["ZY"])
348
- gm12 = iso.DiGraphMatcher(g1, g2)
349
- gm13 = iso.DiGraphMatcher(g1, g3)
350
- x = list(gm12.subgraph_isomorphisms_iter())
351
- y = list(gm13.subgraph_isomorphisms_iter())
352
- assert {"A": "Y", "B": "Z"} in x
353
- assert {"B": "Y", "C": "Z"} in x
354
- assert {"A": "Z", "B": "Y"} in y
355
- assert {"B": "Z", "C": "Y"} in y
356
- assert len(x) == len(y)
357
- assert len(x) == 2
358
-
359
-
360
- def test_monomorphism_iter1():
361
- g1 = nx.DiGraph(["AB", "BC", "CA"])
362
- g2 = nx.DiGraph(["XY", "YZ"])
363
- gm12 = iso.DiGraphMatcher(g1, g2)
364
- x = list(gm12.subgraph_monomorphisms_iter())
365
- assert {"A": "X", "B": "Y", "C": "Z"} in x
366
- assert {"A": "Y", "B": "Z", "C": "X"} in x
367
- assert {"A": "Z", "B": "X", "C": "Y"} in x
368
- assert len(x) == 3
369
- gm21 = iso.DiGraphMatcher(g2, g1)
370
- # Check if StopIteration exception returns False
371
- assert not gm21.subgraph_is_monomorphic()
372
-
373
-
374
- def test_isomorphism_iter2():
375
- # Path
376
- for L in range(2, 10):
377
- g1 = nx.path_graph(L)
378
- gm = iso.GraphMatcher(g1, g1)
379
- s = len(list(gm.isomorphisms_iter()))
380
- assert s == 2
381
- # Cycle
382
- for L in range(3, 10):
383
- g1 = nx.cycle_graph(L)
384
- gm = iso.GraphMatcher(g1, g1)
385
- s = len(list(gm.isomorphisms_iter()))
386
- assert s == 2 * L
387
-
388
-
389
- def test_multiple():
390
- # Verify that we can use the graph matcher multiple times
391
- edges = [("A", "B"), ("B", "A"), ("B", "C")]
392
- for g1, g2 in [(nx.Graph(), nx.Graph()), (nx.DiGraph(), nx.DiGraph())]:
393
- g1.add_edges_from(edges)
394
- g2.add_edges_from(edges)
395
- g3 = nx.subgraph(g2, ["A", "B"])
396
- if not g1.is_directed():
397
- gmA = iso.GraphMatcher(g1, g2)
398
- gmB = iso.GraphMatcher(g1, g3)
399
- else:
400
- gmA = iso.DiGraphMatcher(g1, g2)
401
- gmB = iso.DiGraphMatcher(g1, g3)
402
- assert gmA.is_isomorphic()
403
-
404
- g2.remove_node("C")
405
- if not g1.is_directed():
406
- gmA = iso.GraphMatcher(g1, g2)
407
- else:
408
- gmA = iso.DiGraphMatcher(g1, g2)
409
- assert gmA.subgraph_is_isomorphic()
410
- assert gmB.subgraph_is_isomorphic()
411
- assert gmA.subgraph_is_monomorphic()
412
- assert gmB.subgraph_is_monomorphic()
413
-
414
-
415
- def test_noncomparable_nodes():
416
- node1 = object()
417
- node2 = object()
418
- node3 = object()
419
-
420
- # Graph
421
- G = nx.path_graph([node1, node2, node3])
422
- gm = iso.GraphMatcher(G, G)
423
- assert gm.is_isomorphic()
424
- assert gm.subgraph_is_monomorphic()
425
-
426
- # DiGraph
427
- G = nx.path_graph([node1, node2, node3], create_using=nx.DiGraph)
428
- H = nx.path_graph([node3, node2, node1], create_using=nx.DiGraph)
429
- dgm = iso.DiGraphMatcher(G, H)
430
- assert dgm.is_isomorphic()
431
- assert dgm.subgraph_is_monomorphic()
432
-
433
-
434
- def test_monomorphism_edge_match():
435
- G = nx.DiGraph()
436
- G.add_node(1)
437
- G.add_node(2)
438
- G.add_edge(1, 2, label="A")
439
- G.add_edge(2, 1, label="B")
440
- G.add_edge(2, 2, label="C")
441
-
442
- SG = nx.DiGraph()
443
- SG.add_node(5)
444
- SG.add_node(6)
445
- SG.add_edge(5, 6, label="A")
446
-
447
- gm = iso.DiGraphMatcher(G, SG, edge_match=iso.categorical_edge_match("label", None))
448
- assert gm.subgraph_is_monomorphic()
449
- G.edges[1, 2]["label"] = None
450
- assert not gm.subgraph_is_monomorphic()
451
-
452
-
453
- @pytest.mark.parametrize(
454
- ("e1", "e2", "isomorphic", "subgraph_is_isomorphic"),
455
- [
456
- ([(0, 1), (0, 2)], [(0, 1), (0, 2), (1, 2)], False, False),
457
- ([(0, 1), (0, 2)], [(0, 1), (0, 2), (2, 1)], False, False),
458
- ([(0, 1), (1, 2)], [(0, 1), (1, 2), (2, 0)], False, False),
459
- ([(0, 1)], [(0, 1), (1, 2), (2, 0)], False, False),
460
- ([(0, 1), (1, 2), (2, 0)], [(0, 1)], False, True),
461
- ([(0, 1), (1, 2)], [(0, 1), (2, 0), (2, 1)], False, False),
462
- ([(0, 1), (0, 2), (1, 2)], [(0, 1), (0, 2), (2, 1)], True, True),
463
- ([(0, 1), (0, 2), (1, 2)], [(0, 1), (1, 2), (2, 0)], False, False),
464
- (
465
- [(0, 0), (0, 1), (1, 2), (2, 1)],
466
- [(0, 1), (1, 0), (1, 2), (2, 0)],
467
- False,
468
- False,
469
- ),
470
- (
471
- [(0, 0), (1, 0), (1, 2), (2, 1)],
472
- [(0, 1), (0, 2), (1, 0), (1, 2)],
473
- False,
474
- False,
475
- ),
476
- (
477
- [(0, 0), (0, 1), (0, 2), (1, 0), (1, 2), (2, 0), (2, 1), (2, 2)],
478
- [(0, 0), (0, 1), (0, 2), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)],
479
- False,
480
- False,
481
- ),
482
- ],
483
- )
484
- def test_three_node(e1, e2, isomorphic, subgraph_is_isomorphic):
485
- """Test some edge cases distilled from arbitrary search of the input space."""
486
- G1 = nx.DiGraph(e1)
487
- G2 = nx.DiGraph(e2)
488
- gm = iso.DiGraphMatcher(G1, G2)
489
- assert gm.is_isomorphic() == isomorphic
490
- assert gm.subgraph_is_isomorphic() == subgraph_is_isomorphic
@@ -1,64 +0,0 @@
1
- from operator import eq
2
-
3
- import networkx as nx
4
- from networkx.algorithms import isomorphism as iso
5
-
6
-
7
- def test_categorical_node_match():
8
- nm = iso.categorical_node_match(["x", "y", "z"], [None] * 3)
9
- assert nm({"x": 1, "y": 2, "z": 3}, {"x": 1, "y": 2, "z": 3})
10
- assert not nm({"x": 1, "y": 2, "z": 2}, {"x": 1, "y": 2, "z": 1})
11
-
12
-
13
- class TestGenericMultiEdgeMatch:
14
- def setup_method(self):
15
- self.G1 = nx.MultiDiGraph()
16
- self.G2 = nx.MultiDiGraph()
17
- self.G3 = nx.MultiDiGraph()
18
- self.G4 = nx.MultiDiGraph()
19
- attr_dict1 = {"id": "edge1", "minFlow": 0, "maxFlow": 10}
20
- attr_dict2 = {"id": "edge2", "minFlow": -3, "maxFlow": 7}
21
- attr_dict3 = {"id": "edge3", "minFlow": 13, "maxFlow": 117}
22
- attr_dict4 = {"id": "edge4", "minFlow": 13, "maxFlow": 117}
23
- attr_dict5 = {"id": "edge5", "minFlow": 8, "maxFlow": 12}
24
- attr_dict6 = {"id": "edge6", "minFlow": 8, "maxFlow": 12}
25
- for attr_dict in [
26
- attr_dict1,
27
- attr_dict2,
28
- attr_dict3,
29
- attr_dict4,
30
- attr_dict5,
31
- attr_dict6,
32
- ]:
33
- self.G1.add_edge(1, 2, **attr_dict)
34
- for attr_dict in [
35
- attr_dict5,
36
- attr_dict3,
37
- attr_dict6,
38
- attr_dict1,
39
- attr_dict4,
40
- attr_dict2,
41
- ]:
42
- self.G2.add_edge(2, 3, **attr_dict)
43
- for attr_dict in [attr_dict3, attr_dict5]:
44
- self.G3.add_edge(3, 4, **attr_dict)
45
- for attr_dict in [attr_dict6, attr_dict4]:
46
- self.G4.add_edge(4, 5, **attr_dict)
47
-
48
- def test_generic_multiedge_match(self):
49
- full_match = iso.generic_multiedge_match(
50
- ["id", "flowMin", "flowMax"], [None] * 3, [eq] * 3
51
- )
52
- flow_match = iso.generic_multiedge_match(
53
- ["flowMin", "flowMax"], [None] * 2, [eq] * 2
54
- )
55
- min_flow_match = iso.generic_multiedge_match("flowMin", None, eq)
56
- id_match = iso.generic_multiedge_match("id", None, eq)
57
- assert flow_match(self.G1[1][2], self.G2[2][3])
58
- assert min_flow_match(self.G1[1][2], self.G2[2][3])
59
- assert id_match(self.G1[1][2], self.G2[2][3])
60
- assert full_match(self.G1[1][2], self.G2[2][3])
61
- assert flow_match(self.G3[3][4], self.G4[4][5])
62
- assert min_flow_match(self.G3[3][4], self.G4[4][5])
63
- assert not id_match(self.G3[3][4], self.G4[4][5])
64
- assert not full_match(self.G3[3][4], self.G4[4][5])