okstra 0.114.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 (326) hide show
  1. package/docs/kr/architecture.md +2 -2
  2. package/docs/kr/follow-ups/2026-07-10-final-report-option-3.md +51 -0
  3. package/package.json +1 -1
  4. package/runtime/BUILD.json +2 -2
  5. package/runtime/agents/workers/report-writer-worker.md +1 -0
  6. package/runtime/prompts/lead/okstra-lead-contract.md +1 -1
  7. package/runtime/python/okstra_ctl/implementation_stage.py +46 -39
  8. package/runtime/python/okstra_ctl/report_views.py +151 -12
  9. package/runtime/python/okstra_ctl/run.py +24 -24
  10. package/runtime/python/okstra_ctl/worktree.py +1 -1
  11. package/runtime/python/okstra_token_usage/claude.py +58 -19
  12. package/runtime/python/okstra_token_usage/collect.py +3 -1
  13. package/runtime/python/okstra_vendor/__init__.py +3 -0
  14. package/runtime/schemas/final-report-v1.0.schema.json +20 -0
  15. package/runtime/templates/reports/final-report.template.md +14 -0
  16. package/runtime/templates/reports/i18n/en.json +23 -12
  17. package/runtime/templates/reports/i18n/ko.json +23 -12
  18. package/runtime/templates/reports/report.css +55 -0
  19. package/runtime/templates/reports/report.js +53 -1
  20. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/__init__.py +0 -0
  21. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_approx_clust_coeff.py +0 -41
  22. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_clique.py +0 -112
  23. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_connectivity.py +0 -199
  24. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_density.py +0 -146
  25. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_distance_measures.py +0 -59
  26. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_dominating_set.py +0 -78
  27. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_kcomponents.py +0 -303
  28. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_matching.py +0 -8
  29. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_maxcut.py +0 -94
  30. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_ramsey.py +0 -31
  31. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_steinertree.py +0 -306
  32. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_traveling_salesman.py +0 -1014
  33. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_treewidth.py +0 -274
  34. package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_vertex_cover.py +0 -68
  35. package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/__init__.py +0 -0
  36. package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/base_test.py +0 -81
  37. package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_connectivity.py +0 -143
  38. package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_correlation.py +0 -122
  39. package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_mixing.py +0 -174
  40. package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_neighbor_degree.py +0 -107
  41. package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_pairs.py +0 -87
  42. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/__init__.py +0 -0
  43. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_basic.py +0 -125
  44. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_centrality.py +0 -192
  45. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_cluster.py +0 -84
  46. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_covering.py +0 -33
  47. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_edgelist.py +0 -240
  48. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_extendability.py +0 -334
  49. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_generators.py +0 -407
  50. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_link_analysis.py +0 -218
  51. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_matching.py +0 -327
  52. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_matrix.py +0 -138
  53. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_project.py +0 -409
  54. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_redundancy.py +0 -35
  55. package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_spectral_bipartivity.py +0 -80
  56. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/__init__.py +0 -0
  57. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_betweenness_centrality.py +0 -923
  58. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_betweenness_centrality_subset.py +0 -354
  59. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_closeness_centrality.py +0 -274
  60. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality.py +0 -259
  61. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality_subset.py +0 -147
  62. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_closeness.py +0 -43
  63. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_degree_centrality.py +0 -144
  64. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_dispersion.py +0 -73
  65. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_eigenvector_centrality.py +0 -186
  66. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_group.py +0 -277
  67. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_harmonic_centrality.py +0 -122
  68. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_katz_centrality.py +0 -345
  69. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_laplacian_centrality.py +0 -220
  70. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_load_centrality.py +0 -344
  71. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_percolation_centrality.py +0 -87
  72. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_reaching.py +0 -140
  73. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_second_order_centrality.py +0 -82
  74. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_subgraph.py +0 -110
  75. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_trophic.py +0 -302
  76. package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_voterank.py +0 -64
  77. package/runtime/python/okstra_vendor/networkx/algorithms/coloring/tests/__init__.py +0 -0
  78. package/runtime/python/okstra_vendor/networkx/algorithms/coloring/tests/test_coloring.py +0 -863
  79. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/__init__.py +0 -0
  80. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_asyn_fluid.py +0 -147
  81. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_bipartitions.py +0 -157
  82. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_centrality.py +0 -85
  83. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_divisive.py +0 -106
  84. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_kclique.py +0 -91
  85. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_label_propagation.py +0 -241
  86. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_leiden.py +0 -138
  87. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_local.py +0 -76
  88. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_louvain.py +0 -264
  89. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_lukes.py +0 -152
  90. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_modularity_max.py +0 -340
  91. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_quality.py +0 -139
  92. package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_utils.py +0 -26
  93. package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/__init__.py +0 -0
  94. package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_attracting.py +0 -70
  95. package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_biconnected.py +0 -248
  96. package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_connected.py +0 -138
  97. package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_semiconnected.py +0 -55
  98. package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_strongly_connected.py +0 -193
  99. package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_weakly_connected.py +0 -96
  100. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/__init__.py +0 -0
  101. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_connectivity.py +0 -421
  102. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_cuts.py +0 -309
  103. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_disjoint_paths.py +0 -249
  104. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_edge_augmentation.py +0 -502
  105. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_edge_kcomponents.py +0 -488
  106. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_kcomponents.py +0 -323
  107. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_kcutsets.py +0 -280
  108. package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_stoer_wagner.py +0 -102
  109. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/__init__.py +0 -0
  110. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/gl1.gpickle.bz2 +0 -0
  111. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/gw1.gpickle.bz2 +0 -0
  112. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/netgen-2.gpickle.bz2 +0 -0
  113. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_gomory_hu.py +0 -128
  114. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_maxflow.py +0 -573
  115. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_maxflow_large_graph.py +0 -155
  116. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_mincost.py +0 -475
  117. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_networksimplex.py +0 -481
  118. package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/wlm3.gpickle.bz2 +0 -0
  119. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/__init__.py +0 -0
  120. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/iso_r01_s80.A99 +0 -0
  121. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/iso_r01_s80.B99 +0 -0
  122. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/si2_b06_m200.A99 +0 -0
  123. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/si2_b06_m200.B99 +0 -0
  124. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_ismags.py +0 -719
  125. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_isomorphism.py +0 -103
  126. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_isomorphvf2.py +0 -490
  127. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_match_helpers.py +0 -64
  128. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_temporalisomorphvf2.py +0 -212
  129. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_tree_isomorphism.py +0 -202
  130. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2pp.py +0 -1655
  131. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2pp_helpers.py +0 -3118
  132. package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2userfunc.py +0 -196
  133. package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/__init__.py +0 -0
  134. package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/test_hits.py +0 -77
  135. package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/test_pagerank.py +0 -213
  136. package/runtime/python/okstra_vendor/networkx/algorithms/minors/tests/test_contraction.py +0 -544
  137. package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/__init__.py +0 -0
  138. package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_all.py +0 -328
  139. package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_binary.py +0 -451
  140. package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_product.py +0 -491
  141. package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_unary.py +0 -55
  142. package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/__init__.py +0 -0
  143. package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_astar.py +0 -254
  144. package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_dense.py +0 -212
  145. package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_dense_numpy.py +0 -88
  146. package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_generic.py +0 -511
  147. package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_unweighted.py +0 -149
  148. package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_weighted.py +0 -983
  149. package/runtime/python/okstra_vendor/networkx/algorithms/tests/__init__.py +0 -0
  150. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_asteroidal.py +0 -23
  151. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_boundary.py +0 -154
  152. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_bridges.py +0 -144
  153. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_broadcasting.py +0 -109
  154. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_chains.py +0 -136
  155. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_chordal.py +0 -129
  156. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_clique.py +0 -300
  157. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cluster.py +0 -678
  158. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_communicability.py +0 -80
  159. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_core.py +0 -266
  160. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_covering.py +0 -85
  161. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cuts.py +0 -171
  162. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cycles.py +0 -984
  163. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_d_separation.py +0 -340
  164. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dag.py +0 -835
  165. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_distance_measures.py +0 -831
  166. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_distance_regular.py +0 -85
  167. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dominance.py +0 -299
  168. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dominating.py +0 -115
  169. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_efficiency.py +0 -58
  170. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_euler.py +0 -314
  171. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_graph_hashing.py +0 -872
  172. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_graphical.py +0 -163
  173. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_hierarchy.py +0 -46
  174. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_hybrid.py +0 -24
  175. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_isolate.py +0 -26
  176. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_link_prediction.py +0 -615
  177. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_lowest_common_ancestors.py +0 -459
  178. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_matching.py +0 -556
  179. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_max_weight_clique.py +0 -179
  180. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_mis.py +0 -62
  181. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_moral.py +0 -15
  182. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_node_classification.py +0 -140
  183. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_non_randomness.py +0 -60
  184. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_perfect_graph.py +0 -27
  185. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_planar_drawing.py +0 -274
  186. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_planarity.py +0 -556
  187. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_polynomials.py +0 -57
  188. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_reciprocity.py +0 -37
  189. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_regular.py +0 -88
  190. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_richclub.py +0 -149
  191. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_similarity.py +0 -1158
  192. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_simple_paths.py +0 -803
  193. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_smallworld.py +0 -76
  194. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_smetric.py +0 -8
  195. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_sparsifiers.py +0 -138
  196. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_structuralholes.py +0 -191
  197. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_summarization.py +0 -642
  198. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_swap.py +0 -179
  199. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_threshold.py +0 -270
  200. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_time_dependent.py +0 -431
  201. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_tournament.py +0 -161
  202. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_triads.py +0 -248
  203. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_vitality.py +0 -41
  204. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_voronoi.py +0 -103
  205. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_walks.py +0 -54
  206. package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_wiener.py +0 -157
  207. package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/__init__.py +0 -0
  208. package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_beamsearch.py +0 -25
  209. package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_bfs.py +0 -203
  210. package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_dfs.py +0 -307
  211. package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_edgebfs.py +0 -147
  212. package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_edgedfs.py +0 -131
  213. package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/__init__.py +0 -0
  214. package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_branchings.py +0 -624
  215. package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_coding.py +0 -114
  216. package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_decomposition.py +0 -79
  217. package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_distance_measures.py +0 -99
  218. package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_mst.py +0 -934
  219. package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_operations.py +0 -53
  220. package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_recognition.py +0 -174
  221. package/runtime/python/okstra_vendor/networkx/classes/tests/__init__.py +0 -0
  222. package/runtime/python/okstra_vendor/networkx/classes/tests/dispatch_interface.py +0 -192
  223. package/runtime/python/okstra_vendor/networkx/classes/tests/historical_tests.py +0 -476
  224. package/runtime/python/okstra_vendor/networkx/classes/tests/test_coreviews.py +0 -362
  225. package/runtime/python/okstra_vendor/networkx/classes/tests/test_digraph.py +0 -331
  226. package/runtime/python/okstra_vendor/networkx/classes/tests/test_digraph_historical.py +0 -110
  227. package/runtime/python/okstra_vendor/networkx/classes/tests/test_filters.py +0 -177
  228. package/runtime/python/okstra_vendor/networkx/classes/tests/test_function.py +0 -1045
  229. package/runtime/python/okstra_vendor/networkx/classes/tests/test_graph.py +0 -950
  230. package/runtime/python/okstra_vendor/networkx/classes/tests/test_graph_historical.py +0 -12
  231. package/runtime/python/okstra_vendor/networkx/classes/tests/test_graphviews.py +0 -349
  232. package/runtime/python/okstra_vendor/networkx/classes/tests/test_multidigraph.py +0 -459
  233. package/runtime/python/okstra_vendor/networkx/classes/tests/test_multigraph.py +0 -528
  234. package/runtime/python/okstra_vendor/networkx/classes/tests/test_reportviews.py +0 -1421
  235. package/runtime/python/okstra_vendor/networkx/classes/tests/test_special.py +0 -131
  236. package/runtime/python/okstra_vendor/networkx/classes/tests/test_subgraphviews.py +0 -371
  237. package/runtime/python/okstra_vendor/networkx/conftest.py +0 -261
  238. package/runtime/python/okstra_vendor/networkx/drawing/tests/__init__.py +0 -0
  239. package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_complex.png +0 -0
  240. package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_empty_graph.png +0 -0
  241. package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_house_with_colors.png +0 -0
  242. package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_labels_and_colors.png +0 -0
  243. package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_shortest_path.png +0 -0
  244. package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_house_with_colors.png +0 -0
  245. package/runtime/python/okstra_vendor/networkx/drawing/tests/test_agraph.py +0 -237
  246. package/runtime/python/okstra_vendor/networkx/drawing/tests/test_image_comparison_pylab_mpl.py +0 -229
  247. package/runtime/python/okstra_vendor/networkx/drawing/tests/test_latex.py +0 -285
  248. package/runtime/python/okstra_vendor/networkx/drawing/tests/test_layout.py +0 -631
  249. package/runtime/python/okstra_vendor/networkx/drawing/tests/test_pydot.py +0 -146
  250. package/runtime/python/okstra_vendor/networkx/drawing/tests/test_pylab.py +0 -1582
  251. package/runtime/python/okstra_vendor/networkx/generators/tests/__init__.py +0 -0
  252. package/runtime/python/okstra_vendor/networkx/generators/tests/test_atlas.py +0 -75
  253. package/runtime/python/okstra_vendor/networkx/generators/tests/test_classic.py +0 -642
  254. package/runtime/python/okstra_vendor/networkx/generators/tests/test_cographs.py +0 -20
  255. package/runtime/python/okstra_vendor/networkx/generators/tests/test_community.py +0 -362
  256. package/runtime/python/okstra_vendor/networkx/generators/tests/test_degree_seq.py +0 -224
  257. package/runtime/python/okstra_vendor/networkx/generators/tests/test_directed.py +0 -189
  258. package/runtime/python/okstra_vendor/networkx/generators/tests/test_duplication.py +0 -103
  259. package/runtime/python/okstra_vendor/networkx/generators/tests/test_ego.py +0 -39
  260. package/runtime/python/okstra_vendor/networkx/generators/tests/test_expanders.py +0 -182
  261. package/runtime/python/okstra_vendor/networkx/generators/tests/test_geometric.py +0 -488
  262. package/runtime/python/okstra_vendor/networkx/generators/tests/test_harary_graph.py +0 -133
  263. package/runtime/python/okstra_vendor/networkx/generators/tests/test_internet_as_graphs.py +0 -221
  264. package/runtime/python/okstra_vendor/networkx/generators/tests/test_intersection.py +0 -28
  265. package/runtime/python/okstra_vendor/networkx/generators/tests/test_interval_graph.py +0 -144
  266. package/runtime/python/okstra_vendor/networkx/generators/tests/test_joint_degree_seq.py +0 -125
  267. package/runtime/python/okstra_vendor/networkx/generators/tests/test_lattice.py +0 -264
  268. package/runtime/python/okstra_vendor/networkx/generators/tests/test_line.py +0 -316
  269. package/runtime/python/okstra_vendor/networkx/generators/tests/test_mycielski.py +0 -30
  270. package/runtime/python/okstra_vendor/networkx/generators/tests/test_nonisomorphic_trees.py +0 -82
  271. package/runtime/python/okstra_vendor/networkx/generators/tests/test_random_clustered.py +0 -33
  272. package/runtime/python/okstra_vendor/networkx/generators/tests/test_random_graphs.py +0 -495
  273. package/runtime/python/okstra_vendor/networkx/generators/tests/test_small.py +0 -220
  274. package/runtime/python/okstra_vendor/networkx/generators/tests/test_spectral_graph_forge.py +0 -49
  275. package/runtime/python/okstra_vendor/networkx/generators/tests/test_stochastic.py +0 -72
  276. package/runtime/python/okstra_vendor/networkx/generators/tests/test_sudoku.py +0 -92
  277. package/runtime/python/okstra_vendor/networkx/generators/tests/test_time_series.py +0 -64
  278. package/runtime/python/okstra_vendor/networkx/generators/tests/test_trees.py +0 -195
  279. package/runtime/python/okstra_vendor/networkx/generators/tests/test_triads.py +0 -15
  280. package/runtime/python/okstra_vendor/networkx/linalg/tests/__init__.py +0 -0
  281. package/runtime/python/okstra_vendor/networkx/linalg/tests/test_algebraic_connectivity.py +0 -400
  282. package/runtime/python/okstra_vendor/networkx/linalg/tests/test_attrmatrix.py +0 -108
  283. package/runtime/python/okstra_vendor/networkx/linalg/tests/test_bethehessian.py +0 -40
  284. package/runtime/python/okstra_vendor/networkx/linalg/tests/test_graphmatrix.py +0 -275
  285. package/runtime/python/okstra_vendor/networkx/linalg/tests/test_laplacian.py +0 -334
  286. package/runtime/python/okstra_vendor/networkx/linalg/tests/test_modularity.py +0 -86
  287. package/runtime/python/okstra_vendor/networkx/linalg/tests/test_spectrum.py +0 -70
  288. package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/__init__.py +0 -0
  289. package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_adjacency.py +0 -78
  290. package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_cytoscape.py +0 -78
  291. package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_node_link.py +0 -109
  292. package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_tree.py +0 -48
  293. package/runtime/python/okstra_vendor/networkx/readwrite/tests/__init__.py +0 -0
  294. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_adjlist.py +0 -354
  295. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_edgelist.py +0 -318
  296. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_gexf.py +0 -612
  297. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_gml.py +0 -744
  298. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_graph6.py +0 -181
  299. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_graphml.py +0 -1531
  300. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_leda.py +0 -30
  301. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_p2g.py +0 -63
  302. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_pajek.py +0 -128
  303. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_sparse6.py +0 -166
  304. package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_text.py +0 -1742
  305. package/runtime/python/okstra_vendor/networkx/tests/__init__.py +0 -0
  306. package/runtime/python/okstra_vendor/networkx/tests/test_all_random_functions.py +0 -248
  307. package/runtime/python/okstra_vendor/networkx/tests/test_convert.py +0 -321
  308. package/runtime/python/okstra_vendor/networkx/tests/test_convert_numpy.py +0 -531
  309. package/runtime/python/okstra_vendor/networkx/tests/test_convert_pandas.py +0 -349
  310. package/runtime/python/okstra_vendor/networkx/tests/test_convert_scipy.py +0 -281
  311. package/runtime/python/okstra_vendor/networkx/tests/test_exceptions.py +0 -40
  312. package/runtime/python/okstra_vendor/networkx/tests/test_import.py +0 -11
  313. package/runtime/python/okstra_vendor/networkx/tests/test_lazy_imports.py +0 -96
  314. package/runtime/python/okstra_vendor/networkx/tests/test_relabel.py +0 -349
  315. package/runtime/python/okstra_vendor/networkx/tests/test_removed_functions_exception_messages.py +0 -8
  316. package/runtime/python/okstra_vendor/networkx/utils/tests/__init__.py +0 -0
  317. package/runtime/python/okstra_vendor/networkx/utils/tests/test__init.py +0 -11
  318. package/runtime/python/okstra_vendor/networkx/utils/tests/test_backends.py +0 -225
  319. package/runtime/python/okstra_vendor/networkx/utils/tests/test_config.py +0 -263
  320. package/runtime/python/okstra_vendor/networkx/utils/tests/test_decorators.py +0 -510
  321. package/runtime/python/okstra_vendor/networkx/utils/tests/test_heaps.py +0 -131
  322. package/runtime/python/okstra_vendor/networkx/utils/tests/test_mapped_queue.py +0 -268
  323. package/runtime/python/okstra_vendor/networkx/utils/tests/test_misc.py +0 -393
  324. package/runtime/python/okstra_vendor/networkx/utils/tests/test_random_sequence.py +0 -53
  325. package/runtime/python/okstra_vendor/networkx/utils/tests/test_rcm.py +0 -63
  326. package/runtime/python/okstra_vendor/networkx/utils/tests/test_unionfind.py +0 -55
@@ -1,556 +0,0 @@
1
- import math
2
- from itertools import permutations
3
-
4
- import pytest
5
-
6
- import networkx as nx
7
- from networkx.utils import edges_equal
8
-
9
-
10
- @pytest.mark.parametrize(
11
- "fn", (nx.is_matching, nx.is_maximal_matching, nx.is_perfect_matching)
12
- )
13
- @pytest.mark.parametrize(
14
- "edgeset",
15
- (
16
- {(0, 5)}, # Single edge, node not in G
17
- {(5, 0)}, # for both edge orders
18
- {(0, 5), (2, 3)}, # node not in G, but other edge is valid matching
19
- {(5, 5), (2, 3)}, # Self-loop hits node not in G validation first
20
- ),
21
- )
22
- def test_is_matching_node_not_in_G(fn, edgeset):
23
- """All is_*matching functions have consistent exception message for node
24
- not in G."""
25
- G = nx.path_graph(4)
26
- with pytest.raises(nx.NetworkXError, match="matching.*with node not in G"):
27
- fn(G, edgeset)
28
-
29
-
30
- @pytest.mark.parametrize(
31
- "fn", (nx.is_matching, nx.is_maximal_matching, nx.is_perfect_matching)
32
- )
33
- @pytest.mark.parametrize(
34
- "edgeset",
35
- (
36
- {(0, 1, 2), (2, 3)}, # 3-tuple
37
- {(0,), (2, 3)}, # 1-tuple
38
- ),
39
- )
40
- def test_is_matching_invalid_edge(fn, edgeset):
41
- """All is_*matching functions have consistent exception message for invalid
42
- edges in matching."""
43
- G = nx.path_graph(4)
44
- with pytest.raises(nx.NetworkXError, match=".*non-2-tuple edge.*"):
45
- fn(G, edgeset)
46
-
47
-
48
- @pytest.mark.parametrize("graph_type", (nx.MultiGraph, nx.DiGraph, nx.MultiDiGraph))
49
- @pytest.mark.parametrize(
50
- "fn", (nx.max_weight_matching, nx.min_weight_matching, nx.maximal_matching)
51
- )
52
- def test_wrong_graph_type(fn, graph_type):
53
- G = graph_type()
54
- with pytest.raises(nx.NetworkXNotImplemented):
55
- fn(G)
56
-
57
-
58
- class TestMaxWeightMatching:
59
- """Unit tests for the
60
- :func:`~networkx.algorithms.matching.max_weight_matching` function.
61
-
62
- """
63
-
64
- def test_trivial1(self):
65
- """Empty graph"""
66
- G = nx.Graph()
67
- assert nx.max_weight_matching(G) == set()
68
- assert nx.min_weight_matching(G) == set()
69
-
70
- def test_selfloop(self):
71
- G = nx.Graph()
72
- G.add_edge(0, 0, weight=100)
73
- assert nx.max_weight_matching(G) == set()
74
- assert nx.min_weight_matching(G) == set()
75
-
76
- def test_single_edge(self):
77
- G = nx.Graph()
78
- G.add_edge(0, 1)
79
- assert edges_equal(nx.max_weight_matching(G), {(0, 1)})
80
- assert edges_equal(nx.min_weight_matching(G), {(0, 1)})
81
-
82
- def test_two_path(self):
83
- G = nx.Graph()
84
- G.add_edge("one", "two", weight=10)
85
- G.add_edge("two", "three", weight=11)
86
- assert edges_equal(nx.max_weight_matching(G), {("two", "three")})
87
- assert edges_equal(nx.min_weight_matching(G), {("one", "two")})
88
-
89
- def test_path(self):
90
- G = nx.Graph()
91
- G.add_edge(1, 2, weight=5)
92
- G.add_edge(2, 3, weight=11)
93
- G.add_edge(3, 4, weight=5)
94
- assert edges_equal(nx.max_weight_matching(G), {(2, 3)})
95
- assert edges_equal(nx.max_weight_matching(G, weight=None), {(1, 2), (3, 4)})
96
- assert edges_equal(nx.min_weight_matching(G), {(1, 2), (3, 4)})
97
- assert edges_equal(nx.min_weight_matching(G, weight=None), {(1, 2), (3, 4)})
98
-
99
- def test_square(self):
100
- G = nx.Graph()
101
- G.add_edge(1, 4, weight=2)
102
- G.add_edge(2, 3, weight=2)
103
- G.add_edge(1, 2, weight=1)
104
- G.add_edge(3, 4, weight=4)
105
- assert edges_equal(nx.max_weight_matching(G), {(1, 2), (3, 4)})
106
- assert edges_equal(nx.min_weight_matching(G), {(1, 4), (2, 3)})
107
-
108
- def test_edge_attribute_name(self):
109
- G = nx.Graph()
110
- G.add_edge("one", "two", weight=10, abcd=11)
111
- G.add_edge("two", "three", weight=11, abcd=10)
112
- assert edges_equal(nx.max_weight_matching(G, weight="abcd"), {("one", "two")})
113
- assert edges_equal(nx.min_weight_matching(G, weight="abcd"), {("two", "three")})
114
-
115
- def test_floating_point_weights(self):
116
- G = nx.Graph()
117
- G.add_edge(1, 2, weight=math.pi)
118
- G.add_edge(2, 3, weight=math.exp(1))
119
- G.add_edge(1, 3, weight=3.0)
120
- G.add_edge(1, 4, weight=math.sqrt(2.0))
121
- assert edges_equal(nx.max_weight_matching(G), {(1, 4), (2, 3)})
122
- assert edges_equal(nx.min_weight_matching(G), {(1, 4), (2, 3)})
123
-
124
- def test_negative_weights(self):
125
- G = nx.Graph()
126
- G.add_edge(1, 2, weight=2)
127
- G.add_edge(1, 3, weight=-2)
128
- G.add_edge(2, 3, weight=1)
129
- G.add_edge(2, 4, weight=-1)
130
- G.add_edge(3, 4, weight=-6)
131
- assert edges_equal(nx.max_weight_matching(G), {(1, 2)})
132
- assert edges_equal(
133
- nx.max_weight_matching(G, maxcardinality=True), {(1, 3), (2, 4)}
134
- )
135
- assert edges_equal(nx.min_weight_matching(G), {(1, 2), (3, 4)})
136
-
137
- def test_s_blossom(self):
138
- """Create S-blossom and use it for augmentation:"""
139
- G = nx.Graph()
140
- G.add_weighted_edges_from([(1, 2, 8), (1, 3, 9), (2, 3, 10), (3, 4, 7)])
141
- answer = {(1, 2), (3, 4)}
142
- assert edges_equal(nx.max_weight_matching(G), answer)
143
- assert edges_equal(nx.min_weight_matching(G), answer)
144
-
145
- G.add_weighted_edges_from([(1, 6, 5), (4, 5, 6)])
146
- answer = {(1, 6), (2, 3), (4, 5)}
147
- assert edges_equal(nx.max_weight_matching(G), answer)
148
- assert edges_equal(nx.min_weight_matching(G), answer)
149
-
150
- def test_s_t_blossom(self):
151
- """Create S-blossom, relabel as T-blossom, use for augmentation:"""
152
- G = nx.Graph()
153
- G.add_weighted_edges_from(
154
- [(1, 2, 9), (1, 3, 8), (2, 3, 10), (1, 4, 5), (4, 5, 4), (1, 6, 3)]
155
- )
156
- answer = {(1, 6), (2, 3), (4, 5)}
157
- assert edges_equal(nx.max_weight_matching(G), answer)
158
- assert edges_equal(nx.min_weight_matching(G), answer)
159
-
160
- G.add_edge(4, 5, weight=3)
161
- G.add_edge(1, 6, weight=4)
162
- assert edges_equal(nx.max_weight_matching(G), answer)
163
- assert edges_equal(nx.min_weight_matching(G), answer)
164
-
165
- G.remove_edge(1, 6)
166
- G.add_edge(3, 6, weight=4)
167
- answer = {(1, 2), (3, 6), (4, 5)}
168
- assert edges_equal(nx.max_weight_matching(G), answer)
169
- assert edges_equal(nx.min_weight_matching(G), answer)
170
-
171
- def test_nested_s_blossom(self):
172
- """Create nested S-blossom, use for augmentation:"""
173
-
174
- G = nx.Graph()
175
- G.add_weighted_edges_from(
176
- [
177
- (1, 2, 9),
178
- (1, 3, 9),
179
- (2, 3, 10),
180
- (2, 4, 8),
181
- (3, 5, 8),
182
- (4, 5, 10),
183
- (5, 6, 6),
184
- ]
185
- )
186
- expected_edgeset = {(1, 3), (2, 4), (5, 6)}
187
- expected = {frozenset(e) for e in expected_edgeset}
188
- answer = {frozenset(e) for e in nx.max_weight_matching(G)}
189
- assert answer == expected
190
- answer = {frozenset(e) for e in nx.min_weight_matching(G)}
191
- assert answer == expected
192
-
193
- def test_nested_s_blossom_relabel(self):
194
- """Create S-blossom, relabel as S, include in nested S-blossom:"""
195
- G = nx.Graph()
196
- G.add_weighted_edges_from(
197
- [
198
- (1, 2, 10),
199
- (1, 7, 10),
200
- (2, 3, 12),
201
- (3, 4, 20),
202
- (3, 5, 20),
203
- (4, 5, 25),
204
- (5, 6, 10),
205
- (6, 7, 10),
206
- (7, 8, 8),
207
- ]
208
- )
209
- answer = {(1, 2), (3, 4), (5, 6), (7, 8)}
210
- assert edges_equal(nx.max_weight_matching(G), answer)
211
- assert edges_equal(nx.min_weight_matching(G), answer)
212
-
213
- def test_nested_s_blossom_expand(self):
214
- """Create nested S-blossom, augment, expand recursively:"""
215
- G = nx.Graph()
216
- G.add_weighted_edges_from(
217
- [
218
- (1, 2, 8),
219
- (1, 3, 8),
220
- (2, 3, 10),
221
- (2, 4, 12),
222
- (3, 5, 12),
223
- (4, 5, 14),
224
- (4, 6, 12),
225
- (5, 7, 12),
226
- (6, 7, 14),
227
- (7, 8, 12),
228
- ]
229
- )
230
- answer = {(1, 2), (3, 5), (4, 6), (7, 8)}
231
- assert edges_equal(nx.max_weight_matching(G), answer)
232
- assert edges_equal(nx.min_weight_matching(G), answer)
233
-
234
- def test_s_blossom_relabel_expand(self):
235
- """Create S-blossom, relabel as T, expand:"""
236
- G = nx.Graph()
237
- G.add_weighted_edges_from(
238
- [
239
- (1, 2, 23),
240
- (1, 5, 22),
241
- (1, 6, 15),
242
- (2, 3, 25),
243
- (3, 4, 22),
244
- (4, 5, 25),
245
- (4, 8, 14),
246
- (5, 7, 13),
247
- ]
248
- )
249
- answer = {(1, 6), (2, 3), (4, 8), (5, 7)}
250
- assert edges_equal(nx.max_weight_matching(G), answer)
251
- assert edges_equal(nx.min_weight_matching(G), answer)
252
-
253
- def test_nested_s_blossom_relabel_expand(self):
254
- """Create nested S-blossom, relabel as T, expand:"""
255
- G = nx.Graph()
256
- G.add_weighted_edges_from(
257
- [
258
- (1, 2, 19),
259
- (1, 3, 20),
260
- (1, 8, 8),
261
- (2, 3, 25),
262
- (2, 4, 18),
263
- (3, 5, 18),
264
- (4, 5, 13),
265
- (4, 7, 7),
266
- (5, 6, 7),
267
- ]
268
- )
269
- answer = {(1, 8), (2, 3), (4, 7), (5, 6)}
270
- assert edges_equal(nx.max_weight_matching(G), answer)
271
- assert edges_equal(nx.min_weight_matching(G), answer)
272
-
273
- def test_nasty_blossom1(self):
274
- """Create blossom, relabel as T in more than one way, expand,
275
- augment:
276
- """
277
- G = nx.Graph()
278
- G.add_weighted_edges_from(
279
- [
280
- (1, 2, 45),
281
- (1, 5, 45),
282
- (2, 3, 50),
283
- (3, 4, 45),
284
- (4, 5, 50),
285
- (1, 6, 30),
286
- (3, 9, 35),
287
- (4, 8, 35),
288
- (5, 7, 26),
289
- (9, 10, 5),
290
- ]
291
- )
292
- answer = {(1, 6), (2, 3), (4, 8), (5, 7), (9, 10)}
293
- assert edges_equal(nx.max_weight_matching(G), answer)
294
- assert edges_equal(nx.min_weight_matching(G), answer)
295
-
296
- def test_nasty_blossom2(self):
297
- """Again but slightly different:"""
298
- G = nx.Graph()
299
- G.add_weighted_edges_from(
300
- [
301
- (1, 2, 45),
302
- (1, 5, 45),
303
- (2, 3, 50),
304
- (3, 4, 45),
305
- (4, 5, 50),
306
- (1, 6, 30),
307
- (3, 9, 35),
308
- (4, 8, 26),
309
- (5, 7, 40),
310
- (9, 10, 5),
311
- ]
312
- )
313
- answer = {(1, 6), (2, 3), (4, 8), (5, 7), (9, 10)}
314
- assert edges_equal(nx.max_weight_matching(G), answer)
315
- assert edges_equal(nx.min_weight_matching(G), answer)
316
-
317
- def test_nasty_blossom_least_slack(self):
318
- """Create blossom, relabel as T, expand such that a new
319
- least-slack S-to-free dge is produced, augment:
320
- """
321
- G = nx.Graph()
322
- G.add_weighted_edges_from(
323
- [
324
- (1, 2, 45),
325
- (1, 5, 45),
326
- (2, 3, 50),
327
- (3, 4, 45),
328
- (4, 5, 50),
329
- (1, 6, 30),
330
- (3, 9, 35),
331
- (4, 8, 28),
332
- (5, 7, 26),
333
- (9, 10, 5),
334
- ]
335
- )
336
- answer = {(1, 6), (2, 3), (4, 8), (5, 7), (9, 10)}
337
- assert edges_equal(nx.max_weight_matching(G), answer)
338
- assert edges_equal(nx.min_weight_matching(G), answer)
339
-
340
- def test_nasty_blossom_augmenting(self):
341
- """Create nested blossom, relabel as T in more than one way"""
342
- # expand outer blossom such that inner blossom ends up on an
343
- # augmenting path:
344
- G = nx.Graph()
345
- G.add_weighted_edges_from(
346
- [
347
- (1, 2, 45),
348
- (1, 7, 45),
349
- (2, 3, 50),
350
- (3, 4, 45),
351
- (4, 5, 95),
352
- (4, 6, 94),
353
- (5, 6, 94),
354
- (6, 7, 50),
355
- (1, 8, 30),
356
- (3, 11, 35),
357
- (5, 9, 36),
358
- (7, 10, 26),
359
- (11, 12, 5),
360
- ]
361
- )
362
- answer = {(1, 8), (2, 3), (4, 6), (5, 9), (7, 10), (11, 12)}
363
- assert edges_equal(nx.max_weight_matching(G), answer)
364
- assert edges_equal(nx.min_weight_matching(G), answer)
365
-
366
- def test_nasty_blossom_expand_recursively(self):
367
- """Create nested S-blossom, relabel as S, expand recursively:"""
368
- G = nx.Graph()
369
- G.add_weighted_edges_from(
370
- [
371
- (1, 2, 40),
372
- (1, 3, 40),
373
- (2, 3, 60),
374
- (2, 4, 55),
375
- (3, 5, 55),
376
- (4, 5, 50),
377
- (1, 8, 15),
378
- (5, 7, 30),
379
- (7, 6, 10),
380
- (8, 10, 10),
381
- (4, 9, 30),
382
- ]
383
- )
384
- answer = {(1, 2), (3, 5), (4, 9), (6, 7), (8, 10)}
385
- assert edges_equal(nx.max_weight_matching(G), answer)
386
- assert edges_equal(nx.min_weight_matching(G), answer)
387
-
388
- def test_min_weight_matching_max_cardinality(self):
389
- G = nx.Graph()
390
- G.add_weighted_edges_from([(1, 2, 1000), (2, 3, 2), (3, 4, 3000)])
391
- # The minimum-weight maximal matching is {(2, 3)}; the minimum-weight
392
- # maximum-cardinality matching is {(1, 2), (3, 4)}. See gh-8062.
393
- answer = {(1, 2), (3, 4)}
394
- assert edges_equal(nx.min_weight_matching(G), answer)
395
-
396
-
397
- class TestIsMatching:
398
- """Unit tests for the
399
- :func:`~networkx.algorithms.matching.is_matching` function.
400
-
401
- """
402
-
403
- def test_dict(self):
404
- G = nx.path_graph(4)
405
- assert nx.is_matching(G, {0: 1, 1: 0, 2: 3, 3: 2})
406
-
407
- def test_empty_matching(self):
408
- G = nx.path_graph(4)
409
- assert nx.is_matching(G, set())
410
-
411
- def test_single_edge(self):
412
- G = nx.path_graph(4)
413
- assert nx.is_matching(G, {(1, 2)})
414
-
415
- def test_edge_order(self):
416
- G = nx.path_graph(4)
417
- assert nx.is_matching(G, {(0, 1), (2, 3)})
418
- assert nx.is_matching(G, {(1, 0), (2, 3)})
419
- assert nx.is_matching(G, {(0, 1), (3, 2)})
420
- assert nx.is_matching(G, {(1, 0), (3, 2)})
421
-
422
- def test_valid_matching(self):
423
- G = nx.path_graph(4)
424
- assert nx.is_matching(G, {(0, 1), (2, 3)})
425
-
426
- def test_selfloops(self):
427
- G = nx.path_graph(4)
428
- # selfloop edge not in G
429
- assert not nx.is_matching(G, {(0, 0), (1, 2), (2, 3)})
430
- # selfloop edge in G
431
- G.add_edge(0, 0)
432
- assert not nx.is_matching(G, {(0, 0), (1, 2)})
433
-
434
- def test_invalid_matching(self):
435
- G = nx.path_graph(4)
436
- assert not nx.is_matching(G, {(0, 1), (1, 2), (2, 3)})
437
-
438
- def test_invalid_edge(self):
439
- G = nx.path_graph(4)
440
- assert not nx.is_matching(G, {(0, 3), (1, 2)})
441
-
442
- G = nx.DiGraph(G.edges)
443
- assert nx.is_matching(G, {(0, 1)})
444
- assert not nx.is_matching(G, {(1, 0)})
445
-
446
-
447
- class TestIsMaximalMatching:
448
- """Unit tests for the
449
- :func:`~networkx.algorithms.matching.is_maximal_matching` function.
450
-
451
- """
452
-
453
- def test_dict(self):
454
- G = nx.path_graph(4)
455
- assert nx.is_maximal_matching(G, {0: 1, 1: 0, 2: 3, 3: 2})
456
-
457
- def test_valid(self):
458
- G = nx.path_graph(4)
459
- assert nx.is_maximal_matching(G, {(0, 1), (2, 3)})
460
-
461
- def test_not_matching(self):
462
- G = nx.path_graph(4)
463
- assert not nx.is_maximal_matching(G, {(0, 1), (1, 2), (2, 3)})
464
- assert not nx.is_maximal_matching(G, {(0, 3)})
465
- G.add_edge(0, 0)
466
- assert not nx.is_maximal_matching(G, {(0, 0)})
467
-
468
- def test_not_maximal(self):
469
- G = nx.path_graph(4)
470
- assert not nx.is_maximal_matching(G, {(0, 1)})
471
-
472
-
473
- class TestIsPerfectMatching:
474
- """Unit tests for the
475
- :func:`~networkx.algorithms.matching.is_perfect_matching` function.
476
-
477
- """
478
-
479
- def test_dict(self):
480
- G = nx.path_graph(4)
481
- assert nx.is_perfect_matching(G, {0: 1, 1: 0, 2: 3, 3: 2})
482
-
483
- def test_valid(self):
484
- G = nx.path_graph(4)
485
- assert nx.is_perfect_matching(G, {(0, 1), (2, 3)})
486
-
487
- def test_valid_not_path(self):
488
- G = nx.cycle_graph(4)
489
- G.add_edge(0, 4)
490
- G.add_edge(1, 4)
491
- G.add_edge(5, 2)
492
-
493
- assert nx.is_perfect_matching(G, {(1, 4), (0, 3), (5, 2)})
494
-
495
- def test_selfloops(self):
496
- G = nx.path_graph(4)
497
- # selfloop edge not in G
498
- assert not nx.is_perfect_matching(G, {(0, 0), (1, 2), (2, 3)})
499
- # selfloop edge in G
500
- G.add_edge(0, 0)
501
- assert not nx.is_perfect_matching(G, {(0, 0), (1, 2)})
502
-
503
- def test_not_matching(self):
504
- G = nx.path_graph(4)
505
- assert not nx.is_perfect_matching(G, {(0, 3)})
506
- assert not nx.is_perfect_matching(G, {(0, 1), (1, 2), (2, 3)})
507
-
508
- def test_maximal_but_not_perfect(self):
509
- G = nx.cycle_graph(4)
510
- G.add_edge(0, 4)
511
- G.add_edge(1, 4)
512
-
513
- assert not nx.is_perfect_matching(G, {(1, 4), (0, 3)})
514
-
515
-
516
- class TestMaximalMatching:
517
- """Unit tests for the
518
- :func:`~networkx.algorithms.matching.maximal_matching`.
519
-
520
- """
521
-
522
- def test_valid_matching(self):
523
- edges = [(1, 2), (1, 5), (2, 3), (2, 5), (3, 4), (3, 6), (5, 6)]
524
- G = nx.Graph(edges)
525
- matching = nx.maximal_matching(G)
526
- assert nx.is_maximal_matching(G, matching)
527
-
528
- def test_single_edge_matching(self):
529
- # In the star graph, any maximal matching has just one edge.
530
- G = nx.star_graph(5)
531
- matching = nx.maximal_matching(G)
532
- assert 1 == len(matching)
533
- assert nx.is_maximal_matching(G, matching)
534
-
535
- def test_self_loops(self):
536
- # Create the path graph with two self-loops.
537
- G = nx.path_graph(3)
538
- G.add_edges_from([(0, 0), (1, 1)])
539
- matching = nx.maximal_matching(G)
540
- assert len(matching) == 1
541
- # The matching should never include self-loops.
542
- assert not any(u == v for u, v in matching)
543
- assert nx.is_maximal_matching(G, matching)
544
-
545
- def test_ordering(self):
546
- """Tests that a maximal matching is computed correctly
547
- regardless of the order in which nodes are added to the graph.
548
-
549
- """
550
- for nodes in permutations(range(3)):
551
- G = nx.Graph()
552
- G.add_nodes_from(nodes)
553
- G.add_edges_from([(0, 1), (0, 2)])
554
- matching = nx.maximal_matching(G)
555
- assert len(matching) == 1
556
- assert nx.is_maximal_matching(G, matching)