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.
- package/README.kr.md +2 -2
- package/README.md +2 -2
- package/docs/for-ai/README.md +2 -2
- package/docs/for-ai/skills/{okstra-brief.md → okstra-brief-gen.md} +3 -3
- package/docs/for-ai/skills/okstra-inspect.md +1 -1
- package/docs/kr/architecture.md +11 -11
- package/docs/kr/cli.md +1 -1
- package/docs/kr/follow-ups/2026-07-10-final-report-option-3.md +51 -0
- package/docs/project-structure-overview.md +2 -2
- package/package.json +1 -1
- package/runtime/BUILD.json +2 -2
- package/runtime/agents/workers/report-writer-worker.md +1 -0
- package/runtime/prompts/lead/context-loader.md +2 -2
- package/runtime/prompts/lead/okstra-lead-contract.md +1 -1
- package/runtime/prompts/profiles/_common-contract.md +3 -3
- package/runtime/prompts/profiles/implementation-planning.md +1 -1
- package/runtime/prompts/profiles/requirements-discovery.md +2 -2
- package/runtime/python/okstra_ctl/fix_cycles.py +1 -1
- package/runtime/python/okstra_ctl/implementation_stage.py +46 -39
- package/runtime/python/okstra_ctl/report_views.py +151 -12
- package/runtime/python/okstra_ctl/run.py +24 -24
- package/runtime/python/okstra_ctl/wizard.py +3 -3
- package/runtime/python/okstra_ctl/worktree.py +1 -1
- package/runtime/python/okstra_token_usage/claude.py +58 -19
- package/runtime/python/okstra_token_usage/collect.py +3 -1
- package/runtime/python/okstra_vendor/__init__.py +3 -0
- package/runtime/schemas/final-report-v1.0.schema.json +20 -0
- package/runtime/skills/{okstra-brief → okstra-brief-gen}/SKILL.md +6 -6
- package/runtime/skills/{okstra-brief → okstra-brief-gen}/references/reporter-confirmations.md +1 -1
- package/runtime/skills/{okstra-brief → okstra-brief-gen}/references/tracker-recursion.md +1 -1
- package/runtime/skills/okstra-inspect/SKILL.md +2 -2
- package/runtime/templates/reports/brief.template.md +2 -2
- package/runtime/templates/reports/final-report.template.md +14 -0
- package/runtime/templates/reports/i18n/en.json +23 -12
- package/runtime/templates/reports/i18n/ko.json +23 -12
- package/runtime/templates/reports/report.css +55 -0
- package/runtime/templates/reports/report.js +53 -1
- package/runtime/validators/validate-brief.py +5 -5
- package/runtime/validators/validate-brief.sh +1 -1
- package/src/commands/lifecycle/uninstall.mjs +2 -1
- package/src/lib/skill-catalog.mjs +2 -1
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_approx_clust_coeff.py +0 -41
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_clique.py +0 -112
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_connectivity.py +0 -199
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_density.py +0 -146
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_distance_measures.py +0 -59
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_dominating_set.py +0 -78
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_kcomponents.py +0 -303
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_matching.py +0 -8
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_maxcut.py +0 -94
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_ramsey.py +0 -31
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_steinertree.py +0 -306
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_traveling_salesman.py +0 -1014
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_treewidth.py +0 -274
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_vertex_cover.py +0 -68
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/base_test.py +0 -81
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_connectivity.py +0 -143
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_correlation.py +0 -122
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_mixing.py +0 -174
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_neighbor_degree.py +0 -107
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_pairs.py +0 -87
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_basic.py +0 -125
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_centrality.py +0 -192
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_cluster.py +0 -84
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_covering.py +0 -33
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_edgelist.py +0 -240
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_extendability.py +0 -334
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_generators.py +0 -407
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_link_analysis.py +0 -218
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_matching.py +0 -327
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_matrix.py +0 -138
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_project.py +0 -409
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_redundancy.py +0 -35
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_spectral_bipartivity.py +0 -80
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_betweenness_centrality.py +0 -923
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_betweenness_centrality_subset.py +0 -354
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_closeness_centrality.py +0 -274
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality.py +0 -259
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality_subset.py +0 -147
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_closeness.py +0 -43
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_degree_centrality.py +0 -144
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_dispersion.py +0 -73
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_eigenvector_centrality.py +0 -186
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_group.py +0 -277
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_harmonic_centrality.py +0 -122
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_katz_centrality.py +0 -345
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_laplacian_centrality.py +0 -220
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_load_centrality.py +0 -344
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_percolation_centrality.py +0 -87
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_reaching.py +0 -140
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_second_order_centrality.py +0 -82
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_subgraph.py +0 -110
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_trophic.py +0 -302
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_voterank.py +0 -64
- package/runtime/python/okstra_vendor/networkx/algorithms/coloring/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/coloring/tests/test_coloring.py +0 -863
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_asyn_fluid.py +0 -147
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_bipartitions.py +0 -157
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_centrality.py +0 -85
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_divisive.py +0 -106
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_kclique.py +0 -91
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_label_propagation.py +0 -241
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_leiden.py +0 -138
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_local.py +0 -76
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_louvain.py +0 -264
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_lukes.py +0 -152
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_modularity_max.py +0 -340
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_quality.py +0 -139
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_utils.py +0 -26
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_attracting.py +0 -70
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_biconnected.py +0 -248
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_connected.py +0 -138
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_semiconnected.py +0 -55
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_strongly_connected.py +0 -193
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_weakly_connected.py +0 -96
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_connectivity.py +0 -421
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_cuts.py +0 -309
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_disjoint_paths.py +0 -249
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_edge_augmentation.py +0 -502
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_edge_kcomponents.py +0 -488
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_kcomponents.py +0 -323
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_kcutsets.py +0 -280
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_stoer_wagner.py +0 -102
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/gl1.gpickle.bz2 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/gw1.gpickle.bz2 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/netgen-2.gpickle.bz2 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_gomory_hu.py +0 -128
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_maxflow.py +0 -573
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_maxflow_large_graph.py +0 -155
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_mincost.py +0 -475
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_networksimplex.py +0 -481
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/wlm3.gpickle.bz2 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/iso_r01_s80.A99 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/iso_r01_s80.B99 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/si2_b06_m200.A99 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/si2_b06_m200.B99 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_ismags.py +0 -719
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_isomorphism.py +0 -103
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_isomorphvf2.py +0 -490
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_match_helpers.py +0 -64
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_temporalisomorphvf2.py +0 -212
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_tree_isomorphism.py +0 -202
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2pp.py +0 -1655
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2pp_helpers.py +0 -3118
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2userfunc.py +0 -196
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/test_hits.py +0 -77
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/test_pagerank.py +0 -213
- package/runtime/python/okstra_vendor/networkx/algorithms/minors/tests/test_contraction.py +0 -544
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_all.py +0 -328
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_binary.py +0 -451
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_product.py +0 -491
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_unary.py +0 -55
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_astar.py +0 -254
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_dense.py +0 -212
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_dense_numpy.py +0 -88
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_generic.py +0 -511
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_unweighted.py +0 -149
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_weighted.py +0 -983
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_asteroidal.py +0 -23
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_boundary.py +0 -154
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_bridges.py +0 -144
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_broadcasting.py +0 -109
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_chains.py +0 -136
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_chordal.py +0 -129
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_clique.py +0 -300
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cluster.py +0 -678
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_communicability.py +0 -80
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_core.py +0 -266
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_covering.py +0 -85
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cuts.py +0 -171
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cycles.py +0 -984
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_d_separation.py +0 -340
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dag.py +0 -835
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_distance_measures.py +0 -831
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_distance_regular.py +0 -85
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dominance.py +0 -299
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dominating.py +0 -115
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_efficiency.py +0 -58
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_euler.py +0 -314
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_graph_hashing.py +0 -872
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_graphical.py +0 -163
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_hierarchy.py +0 -46
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_hybrid.py +0 -24
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_isolate.py +0 -26
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_link_prediction.py +0 -615
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_lowest_common_ancestors.py +0 -459
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_matching.py +0 -556
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_max_weight_clique.py +0 -179
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_mis.py +0 -62
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_moral.py +0 -15
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_node_classification.py +0 -140
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_non_randomness.py +0 -60
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_perfect_graph.py +0 -27
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_planar_drawing.py +0 -274
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_planarity.py +0 -556
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_polynomials.py +0 -57
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_reciprocity.py +0 -37
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_regular.py +0 -88
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_richclub.py +0 -149
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_similarity.py +0 -1158
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_simple_paths.py +0 -803
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_smallworld.py +0 -76
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_smetric.py +0 -8
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_sparsifiers.py +0 -138
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_structuralholes.py +0 -191
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_summarization.py +0 -642
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_swap.py +0 -179
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_threshold.py +0 -270
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_time_dependent.py +0 -431
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_tournament.py +0 -161
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_triads.py +0 -248
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_vitality.py +0 -41
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_voronoi.py +0 -103
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_walks.py +0 -54
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_wiener.py +0 -157
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_beamsearch.py +0 -25
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_bfs.py +0 -203
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_dfs.py +0 -307
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_edgebfs.py +0 -147
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_edgedfs.py +0 -131
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_branchings.py +0 -624
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_coding.py +0 -114
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_decomposition.py +0 -79
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_distance_measures.py +0 -99
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_mst.py +0 -934
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_operations.py +0 -53
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_recognition.py +0 -174
- package/runtime/python/okstra_vendor/networkx/classes/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/dispatch_interface.py +0 -192
- package/runtime/python/okstra_vendor/networkx/classes/tests/historical_tests.py +0 -476
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_coreviews.py +0 -362
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_digraph.py +0 -331
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_digraph_historical.py +0 -110
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_filters.py +0 -177
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_function.py +0 -1045
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_graph.py +0 -950
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_graph_historical.py +0 -12
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_graphviews.py +0 -349
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_multidigraph.py +0 -459
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_multigraph.py +0 -528
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_reportviews.py +0 -1421
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_special.py +0 -131
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_subgraphviews.py +0 -371
- package/runtime/python/okstra_vendor/networkx/conftest.py +0 -261
- package/runtime/python/okstra_vendor/networkx/drawing/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_complex.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_empty_graph.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_house_with_colors.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_labels_and_colors.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_shortest_path.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_house_with_colors.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_agraph.py +0 -237
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_image_comparison_pylab_mpl.py +0 -229
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_latex.py +0 -285
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_layout.py +0 -631
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_pydot.py +0 -146
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_pylab.py +0 -1582
- package/runtime/python/okstra_vendor/networkx/generators/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_atlas.py +0 -75
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_classic.py +0 -642
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_cographs.py +0 -20
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_community.py +0 -362
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_degree_seq.py +0 -224
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_directed.py +0 -189
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_duplication.py +0 -103
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_ego.py +0 -39
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_expanders.py +0 -182
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_geometric.py +0 -488
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_harary_graph.py +0 -133
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_internet_as_graphs.py +0 -221
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_intersection.py +0 -28
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_interval_graph.py +0 -144
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_joint_degree_seq.py +0 -125
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_lattice.py +0 -264
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_line.py +0 -316
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_mycielski.py +0 -30
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_nonisomorphic_trees.py +0 -82
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_random_clustered.py +0 -33
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_random_graphs.py +0 -495
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_small.py +0 -220
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_spectral_graph_forge.py +0 -49
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_stochastic.py +0 -72
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_sudoku.py +0 -92
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_time_series.py +0 -64
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_trees.py +0 -195
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_triads.py +0 -15
- package/runtime/python/okstra_vendor/networkx/linalg/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_algebraic_connectivity.py +0 -400
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_attrmatrix.py +0 -108
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_bethehessian.py +0 -40
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_graphmatrix.py +0 -275
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_laplacian.py +0 -334
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_modularity.py +0 -86
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_spectrum.py +0 -70
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_adjacency.py +0 -78
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_cytoscape.py +0 -78
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_node_link.py +0 -109
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_tree.py +0 -48
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_adjlist.py +0 -354
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_edgelist.py +0 -318
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_gexf.py +0 -612
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_gml.py +0 -744
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_graph6.py +0 -181
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_graphml.py +0 -1531
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_leda.py +0 -30
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_p2g.py +0 -63
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_pajek.py +0 -128
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_sparse6.py +0 -166
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_text.py +0 -1742
- package/runtime/python/okstra_vendor/networkx/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_all_random_functions.py +0 -248
- package/runtime/python/okstra_vendor/networkx/tests/test_convert.py +0 -321
- package/runtime/python/okstra_vendor/networkx/tests/test_convert_numpy.py +0 -531
- package/runtime/python/okstra_vendor/networkx/tests/test_convert_pandas.py +0 -349
- package/runtime/python/okstra_vendor/networkx/tests/test_convert_scipy.py +0 -281
- package/runtime/python/okstra_vendor/networkx/tests/test_exceptions.py +0 -40
- package/runtime/python/okstra_vendor/networkx/tests/test_import.py +0 -11
- package/runtime/python/okstra_vendor/networkx/tests/test_lazy_imports.py +0 -96
- package/runtime/python/okstra_vendor/networkx/tests/test_relabel.py +0 -349
- package/runtime/python/okstra_vendor/networkx/tests/test_removed_functions_exception_messages.py +0 -8
- package/runtime/python/okstra_vendor/networkx/utils/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test__init.py +0 -11
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_backends.py +0 -225
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_config.py +0 -263
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_decorators.py +0 -510
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_heaps.py +0 -131
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_mapped_queue.py +0 -268
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_misc.py +0 -393
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_random_sequence.py +0 -53
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_rcm.py +0 -63
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_unionfind.py +0 -55
|
@@ -1,481 +0,0 @@
|
|
|
1
|
-
import bz2
|
|
2
|
-
import importlib.resources
|
|
3
|
-
import pickle
|
|
4
|
-
|
|
5
|
-
import pytest
|
|
6
|
-
|
|
7
|
-
import networkx as nx
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@pytest.fixture
|
|
11
|
-
def simple_flow_graph():
|
|
12
|
-
G = nx.DiGraph()
|
|
13
|
-
G.add_node("a", demand=0)
|
|
14
|
-
G.add_node("b", demand=-5)
|
|
15
|
-
G.add_node("c", demand=50000000)
|
|
16
|
-
G.add_node("d", demand=-49999995)
|
|
17
|
-
G.add_edge("a", "b", weight=3, capacity=4)
|
|
18
|
-
G.add_edge("a", "c", weight=6, capacity=10)
|
|
19
|
-
G.add_edge("b", "d", weight=1, capacity=9)
|
|
20
|
-
G.add_edge("c", "d", weight=2, capacity=5)
|
|
21
|
-
return G
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@pytest.fixture
|
|
25
|
-
def simple_no_flow_graph():
|
|
26
|
-
G = nx.DiGraph()
|
|
27
|
-
G.add_node("s", demand=-5)
|
|
28
|
-
G.add_node("t", demand=5)
|
|
29
|
-
G.add_edge("s", "a", weight=1, capacity=3)
|
|
30
|
-
G.add_edge("a", "b", weight=3)
|
|
31
|
-
G.add_edge("a", "c", weight=-6)
|
|
32
|
-
G.add_edge("b", "d", weight=1)
|
|
33
|
-
G.add_edge("c", "d", weight=-2)
|
|
34
|
-
G.add_edge("d", "t", weight=1, capacity=3)
|
|
35
|
-
return G
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def get_flowcost_from_flowdict(G, flowDict):
|
|
39
|
-
"""Returns flow cost calculated from flow dictionary"""
|
|
40
|
-
flowCost = 0
|
|
41
|
-
for u in flowDict:
|
|
42
|
-
for v in flowDict[u]:
|
|
43
|
-
flowCost += flowDict[u][v] * G[u][v]["weight"]
|
|
44
|
-
return flowCost
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
def test_infinite_demand_raise(simple_flow_graph):
|
|
48
|
-
G = simple_flow_graph
|
|
49
|
-
inf = float("inf")
|
|
50
|
-
node_name = "a"
|
|
51
|
-
nx.set_node_attributes(G, {node_name: {"demand": inf}})
|
|
52
|
-
with pytest.raises(
|
|
53
|
-
nx.NetworkXError,
|
|
54
|
-
match=f"node '{node_name}' has infinite demand",
|
|
55
|
-
):
|
|
56
|
-
nx.network_simplex(G)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def test_neg_infinite_demand_raise(simple_flow_graph):
|
|
60
|
-
G = simple_flow_graph
|
|
61
|
-
inf = float("inf")
|
|
62
|
-
node_name = "a"
|
|
63
|
-
nx.set_node_attributes(G, {node_name: {"demand": -inf}})
|
|
64
|
-
with pytest.raises(
|
|
65
|
-
nx.NetworkXError,
|
|
66
|
-
match=f"node '{node_name}' has infinite demand",
|
|
67
|
-
):
|
|
68
|
-
nx.network_simplex(G)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
def test_infinite_weight_raise(simple_flow_graph):
|
|
72
|
-
G = simple_flow_graph
|
|
73
|
-
inf = float("inf")
|
|
74
|
-
nx.set_edge_attributes(
|
|
75
|
-
G, {("a", "b"): {"weight": inf}, ("b", "d"): {"weight": inf}}
|
|
76
|
-
)
|
|
77
|
-
with pytest.raises(
|
|
78
|
-
nx.NetworkXError,
|
|
79
|
-
match=r"edge .* has infinite weight",
|
|
80
|
-
):
|
|
81
|
-
nx.network_simplex(G)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
def test_nonzero_net_demand_raise(simple_flow_graph):
|
|
85
|
-
G = simple_flow_graph
|
|
86
|
-
nx.set_node_attributes(G, {"b": {"demand": -4}})
|
|
87
|
-
with pytest.raises(
|
|
88
|
-
nx.NetworkXUnfeasible,
|
|
89
|
-
match="total node demand is not zero",
|
|
90
|
-
):
|
|
91
|
-
nx.network_simplex(G)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
def test_negative_capacity_raise(simple_flow_graph):
|
|
95
|
-
G = simple_flow_graph
|
|
96
|
-
nx.set_edge_attributes(G, {("a", "b"): {"weight": 1}, ("b", "d"): {"capacity": -9}})
|
|
97
|
-
with pytest.raises(
|
|
98
|
-
nx.NetworkXUnfeasible,
|
|
99
|
-
match=r"edge .* has negative capacity",
|
|
100
|
-
):
|
|
101
|
-
nx.network_simplex(G)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
def test_no_flow_satisfying_demands(simple_no_flow_graph):
|
|
105
|
-
G = simple_no_flow_graph
|
|
106
|
-
with pytest.raises(
|
|
107
|
-
nx.NetworkXUnfeasible,
|
|
108
|
-
match="no flow satisfies all node demands",
|
|
109
|
-
):
|
|
110
|
-
nx.network_simplex(G)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
def test_sum_demands_not_zero(simple_no_flow_graph):
|
|
114
|
-
G = simple_no_flow_graph
|
|
115
|
-
nx.set_node_attributes(G, {"t": {"demand": 4}})
|
|
116
|
-
with pytest.raises(
|
|
117
|
-
nx.NetworkXUnfeasible,
|
|
118
|
-
match="total node demand is not zero",
|
|
119
|
-
):
|
|
120
|
-
nx.network_simplex(G)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
def test_google_or_tools_example():
|
|
124
|
-
"""
|
|
125
|
-
https://developers.google.com/optimization/flow/mincostflow
|
|
126
|
-
"""
|
|
127
|
-
G = nx.DiGraph()
|
|
128
|
-
start_nodes = [0, 0, 1, 1, 1, 2, 2, 3, 4]
|
|
129
|
-
end_nodes = [1, 2, 2, 3, 4, 3, 4, 4, 2]
|
|
130
|
-
capacities = [15, 8, 20, 4, 10, 15, 4, 20, 5]
|
|
131
|
-
unit_costs = [4, 4, 2, 2, 6, 1, 3, 2, 3]
|
|
132
|
-
supplies = [20, 0, 0, -5, -15]
|
|
133
|
-
answer = 150
|
|
134
|
-
|
|
135
|
-
for i in range(len(supplies)):
|
|
136
|
-
G.add_node(i, demand=(-1) * supplies[i]) # supplies are negative of demand
|
|
137
|
-
|
|
138
|
-
for i in range(len(start_nodes)):
|
|
139
|
-
G.add_edge(
|
|
140
|
-
start_nodes[i], end_nodes[i], weight=unit_costs[i], capacity=capacities[i]
|
|
141
|
-
)
|
|
142
|
-
|
|
143
|
-
flowCost, flowDict = nx.network_simplex(G)
|
|
144
|
-
assert flowCost == answer
|
|
145
|
-
assert flowCost == get_flowcost_from_flowdict(G, flowDict)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
def test_google_or_tools_example2():
|
|
149
|
-
"""
|
|
150
|
-
https://developers.google.com/optimization/flow/mincostflow
|
|
151
|
-
"""
|
|
152
|
-
G = nx.DiGraph()
|
|
153
|
-
start_nodes = [0, 0, 1, 1, 1, 2, 2, 3, 4, 3]
|
|
154
|
-
end_nodes = [1, 2, 2, 3, 4, 3, 4, 4, 2, 5]
|
|
155
|
-
capacities = [15, 8, 20, 4, 10, 15, 4, 20, 5, 10]
|
|
156
|
-
unit_costs = [4, 4, 2, 2, 6, 1, 3, 2, 3, 4]
|
|
157
|
-
supplies = [23, 0, 0, -5, -15, -3]
|
|
158
|
-
answer = 183
|
|
159
|
-
|
|
160
|
-
for i in range(len(supplies)):
|
|
161
|
-
G.add_node(i, demand=(-1) * supplies[i]) # supplies are negative of demand
|
|
162
|
-
|
|
163
|
-
for i in range(len(start_nodes)):
|
|
164
|
-
G.add_edge(
|
|
165
|
-
start_nodes[i], end_nodes[i], weight=unit_costs[i], capacity=capacities[i]
|
|
166
|
-
)
|
|
167
|
-
|
|
168
|
-
flowCost, flowDict = nx.network_simplex(G)
|
|
169
|
-
assert flowCost == answer
|
|
170
|
-
assert flowCost == get_flowcost_from_flowdict(G, flowDict)
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
def test_large():
|
|
174
|
-
fname = (
|
|
175
|
-
importlib.resources.files("networkx.algorithms.flow.tests")
|
|
176
|
-
/ "netgen-2.gpickle.bz2"
|
|
177
|
-
)
|
|
178
|
-
|
|
179
|
-
with bz2.BZ2File(fname, "rb") as f:
|
|
180
|
-
G = pickle.load(f)
|
|
181
|
-
flowCost, flowDict = nx.network_simplex(G)
|
|
182
|
-
assert 6749969302 == flowCost
|
|
183
|
-
assert 6749969302 == nx.cost_of_flow(G, flowDict)
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
def test_simple_digraph():
|
|
187
|
-
G = nx.DiGraph()
|
|
188
|
-
G.add_node("a", demand=-5)
|
|
189
|
-
G.add_node("d", demand=5)
|
|
190
|
-
G.add_edge("a", "b", weight=3, capacity=4)
|
|
191
|
-
G.add_edge("a", "c", weight=6, capacity=10)
|
|
192
|
-
G.add_edge("b", "d", weight=1, capacity=9)
|
|
193
|
-
G.add_edge("c", "d", weight=2, capacity=5)
|
|
194
|
-
flowCost, H = nx.network_simplex(G)
|
|
195
|
-
soln = {"a": {"b": 4, "c": 1}, "b": {"d": 4}, "c": {"d": 1}, "d": {}}
|
|
196
|
-
assert flowCost == 24
|
|
197
|
-
assert nx.min_cost_flow_cost(G) == 24
|
|
198
|
-
assert H == soln
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
def test_negcycle_infcap():
|
|
202
|
-
G = nx.DiGraph()
|
|
203
|
-
G.add_node("s", demand=-5)
|
|
204
|
-
G.add_node("t", demand=5)
|
|
205
|
-
G.add_edge("s", "a", weight=1, capacity=3)
|
|
206
|
-
G.add_edge("a", "b", weight=3)
|
|
207
|
-
G.add_edge("c", "a", weight=-6)
|
|
208
|
-
G.add_edge("b", "d", weight=1)
|
|
209
|
-
G.add_edge("d", "c", weight=-2)
|
|
210
|
-
G.add_edge("d", "t", weight=1, capacity=3)
|
|
211
|
-
pytest.raises(nx.NetworkXUnfeasible, nx.network_simplex, G)
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
def test_transshipment():
|
|
215
|
-
G = nx.DiGraph()
|
|
216
|
-
G.add_node("a", demand=1)
|
|
217
|
-
G.add_node("b", demand=-2)
|
|
218
|
-
G.add_node("c", demand=-2)
|
|
219
|
-
G.add_node("d", demand=3)
|
|
220
|
-
G.add_node("e", demand=-4)
|
|
221
|
-
G.add_node("f", demand=-4)
|
|
222
|
-
G.add_node("g", demand=3)
|
|
223
|
-
G.add_node("h", demand=2)
|
|
224
|
-
G.add_node("r", demand=3)
|
|
225
|
-
G.add_edge("a", "c", weight=3)
|
|
226
|
-
G.add_edge("r", "a", weight=2)
|
|
227
|
-
G.add_edge("b", "a", weight=9)
|
|
228
|
-
G.add_edge("r", "c", weight=0)
|
|
229
|
-
G.add_edge("b", "r", weight=-6)
|
|
230
|
-
G.add_edge("c", "d", weight=5)
|
|
231
|
-
G.add_edge("e", "r", weight=4)
|
|
232
|
-
G.add_edge("e", "f", weight=3)
|
|
233
|
-
G.add_edge("h", "b", weight=4)
|
|
234
|
-
G.add_edge("f", "d", weight=7)
|
|
235
|
-
G.add_edge("f", "h", weight=12)
|
|
236
|
-
G.add_edge("g", "d", weight=12)
|
|
237
|
-
G.add_edge("f", "g", weight=-1)
|
|
238
|
-
G.add_edge("h", "g", weight=-10)
|
|
239
|
-
flowCost, H = nx.network_simplex(G)
|
|
240
|
-
soln = {
|
|
241
|
-
"a": {"c": 0},
|
|
242
|
-
"b": {"a": 0, "r": 2},
|
|
243
|
-
"c": {"d": 3},
|
|
244
|
-
"d": {},
|
|
245
|
-
"e": {"r": 3, "f": 1},
|
|
246
|
-
"f": {"d": 0, "g": 3, "h": 2},
|
|
247
|
-
"g": {"d": 0},
|
|
248
|
-
"h": {"b": 0, "g": 0},
|
|
249
|
-
"r": {"a": 1, "c": 1},
|
|
250
|
-
}
|
|
251
|
-
assert flowCost == 41
|
|
252
|
-
assert H == soln
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
def test_digraph1():
|
|
256
|
-
# From Bradley, S. P., Hax, A. C. and Magnanti, T. L. Applied
|
|
257
|
-
# Mathematical Programming. Addison-Wesley, 1977.
|
|
258
|
-
G = nx.DiGraph()
|
|
259
|
-
G.add_node(1, demand=-20)
|
|
260
|
-
G.add_node(4, demand=5)
|
|
261
|
-
G.add_node(5, demand=15)
|
|
262
|
-
G.add_edges_from(
|
|
263
|
-
[
|
|
264
|
-
(1, 2, {"capacity": 15, "weight": 4}),
|
|
265
|
-
(1, 3, {"capacity": 8, "weight": 4}),
|
|
266
|
-
(2, 3, {"weight": 2}),
|
|
267
|
-
(2, 4, {"capacity": 4, "weight": 2}),
|
|
268
|
-
(2, 5, {"capacity": 10, "weight": 6}),
|
|
269
|
-
(3, 4, {"capacity": 15, "weight": 1}),
|
|
270
|
-
(3, 5, {"capacity": 5, "weight": 3}),
|
|
271
|
-
(4, 5, {"weight": 2}),
|
|
272
|
-
(5, 3, {"capacity": 4, "weight": 1}),
|
|
273
|
-
]
|
|
274
|
-
)
|
|
275
|
-
flowCost, H = nx.network_simplex(G)
|
|
276
|
-
soln = {
|
|
277
|
-
1: {2: 12, 3: 8},
|
|
278
|
-
2: {3: 8, 4: 4, 5: 0},
|
|
279
|
-
3: {4: 11, 5: 5},
|
|
280
|
-
4: {5: 10},
|
|
281
|
-
5: {3: 0},
|
|
282
|
-
}
|
|
283
|
-
assert flowCost == 150
|
|
284
|
-
assert nx.min_cost_flow_cost(G) == 150
|
|
285
|
-
assert H == soln
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
def test_zero_capacity_edges():
|
|
289
|
-
"""Address issue raised in ticket #617 by arv."""
|
|
290
|
-
G = nx.DiGraph()
|
|
291
|
-
G.add_edges_from(
|
|
292
|
-
[
|
|
293
|
-
(1, 2, {"capacity": 1, "weight": 1}),
|
|
294
|
-
(1, 5, {"capacity": 1, "weight": 1}),
|
|
295
|
-
(2, 3, {"capacity": 0, "weight": 1}),
|
|
296
|
-
(2, 5, {"capacity": 1, "weight": 1}),
|
|
297
|
-
(5, 3, {"capacity": 2, "weight": 1}),
|
|
298
|
-
(5, 4, {"capacity": 0, "weight": 1}),
|
|
299
|
-
(3, 4, {"capacity": 2, "weight": 1}),
|
|
300
|
-
]
|
|
301
|
-
)
|
|
302
|
-
G.nodes[1]["demand"] = -1
|
|
303
|
-
G.nodes[2]["demand"] = -1
|
|
304
|
-
G.nodes[4]["demand"] = 2
|
|
305
|
-
|
|
306
|
-
flowCost, H = nx.network_simplex(G)
|
|
307
|
-
soln = {1: {2: 0, 5: 1}, 2: {3: 0, 5: 1}, 3: {4: 2}, 4: {}, 5: {3: 2, 4: 0}}
|
|
308
|
-
assert flowCost == 6
|
|
309
|
-
assert nx.min_cost_flow_cost(G) == 6
|
|
310
|
-
assert H == soln
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
def test_digon():
|
|
314
|
-
"""Check if digons are handled properly. Taken from ticket
|
|
315
|
-
#618 by arv."""
|
|
316
|
-
nodes = [(1, {}), (2, {"demand": -4}), (3, {"demand": 4})]
|
|
317
|
-
edges = [
|
|
318
|
-
(1, 2, {"capacity": 3, "weight": 600000}),
|
|
319
|
-
(2, 1, {"capacity": 2, "weight": 0}),
|
|
320
|
-
(2, 3, {"capacity": 5, "weight": 714285}),
|
|
321
|
-
(3, 2, {"capacity": 2, "weight": 0}),
|
|
322
|
-
]
|
|
323
|
-
G = nx.DiGraph(edges)
|
|
324
|
-
G.add_nodes_from(nodes)
|
|
325
|
-
flowCost, H = nx.network_simplex(G)
|
|
326
|
-
soln = {1: {2: 0}, 2: {1: 0, 3: 4}, 3: {2: 0}}
|
|
327
|
-
assert flowCost == 2857140
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
def test_deadend():
|
|
331
|
-
"""Check if one-node cycles are handled properly. Taken from ticket
|
|
332
|
-
#2906 from @sshraven."""
|
|
333
|
-
G = nx.DiGraph()
|
|
334
|
-
|
|
335
|
-
G.add_nodes_from(range(5), demand=0)
|
|
336
|
-
G.nodes[4]["demand"] = -13
|
|
337
|
-
G.nodes[3]["demand"] = 13
|
|
338
|
-
|
|
339
|
-
G.add_edges_from([(0, 2), (0, 3), (2, 1)], capacity=20, weight=0.1)
|
|
340
|
-
pytest.raises(nx.NetworkXUnfeasible, nx.network_simplex, G)
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
def test_infinite_capacity_neg_digon():
|
|
344
|
-
"""An infinite capacity negative cost digon results in an unbounded
|
|
345
|
-
instance."""
|
|
346
|
-
nodes = [(1, {}), (2, {"demand": -4}), (3, {"demand": 4})]
|
|
347
|
-
edges = [
|
|
348
|
-
(1, 2, {"weight": -600}),
|
|
349
|
-
(2, 1, {"weight": 0}),
|
|
350
|
-
(2, 3, {"capacity": 5, "weight": 714285}),
|
|
351
|
-
(3, 2, {"capacity": 2, "weight": 0}),
|
|
352
|
-
]
|
|
353
|
-
G = nx.DiGraph(edges)
|
|
354
|
-
G.add_nodes_from(nodes)
|
|
355
|
-
pytest.raises(nx.NetworkXUnbounded, nx.network_simplex, G)
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
def test_multidigraph():
|
|
359
|
-
"""Multidigraphs are acceptable."""
|
|
360
|
-
G = nx.MultiDiGraph()
|
|
361
|
-
G.add_weighted_edges_from([(1, 2, 1), (2, 3, 2)], weight="capacity")
|
|
362
|
-
flowCost, H = nx.network_simplex(G)
|
|
363
|
-
assert flowCost == 0
|
|
364
|
-
assert H == {1: {2: {0: 0}}, 2: {3: {0: 0}}, 3: {}}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
def test_negative_selfloops():
|
|
368
|
-
"""Negative selfloops should cause an exception if uncapacitated and
|
|
369
|
-
always be saturated otherwise.
|
|
370
|
-
"""
|
|
371
|
-
G = nx.DiGraph()
|
|
372
|
-
G.add_edge(1, 1, weight=-1)
|
|
373
|
-
pytest.raises(nx.NetworkXUnbounded, nx.network_simplex, G)
|
|
374
|
-
|
|
375
|
-
G[1][1]["capacity"] = 2
|
|
376
|
-
flowCost, H = nx.network_simplex(G)
|
|
377
|
-
assert flowCost == -2
|
|
378
|
-
assert H == {1: {1: 2}}
|
|
379
|
-
|
|
380
|
-
G = nx.MultiDiGraph()
|
|
381
|
-
G.add_edge(1, 1, "x", weight=-1)
|
|
382
|
-
G.add_edge(1, 1, "y", weight=1)
|
|
383
|
-
pytest.raises(nx.NetworkXUnbounded, nx.network_simplex, G)
|
|
384
|
-
|
|
385
|
-
G[1][1]["x"]["capacity"] = 2
|
|
386
|
-
flowCost, H = nx.network_simplex(G)
|
|
387
|
-
assert flowCost == -2
|
|
388
|
-
assert H == {1: {1: {"x": 2, "y": 0}}}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
def test_bone_shaped():
|
|
392
|
-
# From #1283
|
|
393
|
-
G = nx.DiGraph()
|
|
394
|
-
G.add_node(0, demand=-4)
|
|
395
|
-
G.add_node(1, demand=2)
|
|
396
|
-
G.add_node(2, demand=2)
|
|
397
|
-
G.add_node(3, demand=4)
|
|
398
|
-
G.add_node(4, demand=-2)
|
|
399
|
-
G.add_node(5, demand=-2)
|
|
400
|
-
G.add_edge(0, 1, capacity=4)
|
|
401
|
-
G.add_edge(0, 2, capacity=4)
|
|
402
|
-
G.add_edge(4, 3, capacity=4)
|
|
403
|
-
G.add_edge(5, 3, capacity=4)
|
|
404
|
-
G.add_edge(0, 3, capacity=0)
|
|
405
|
-
flowCost, H = nx.network_simplex(G)
|
|
406
|
-
assert flowCost == 0
|
|
407
|
-
assert H == {0: {1: 2, 2: 2, 3: 0}, 1: {}, 2: {}, 3: {}, 4: {3: 2}, 5: {3: 2}}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
def test_graphs_type_exceptions():
|
|
411
|
-
G = nx.Graph()
|
|
412
|
-
pytest.raises(nx.NetworkXNotImplemented, nx.network_simplex, G)
|
|
413
|
-
G = nx.MultiGraph()
|
|
414
|
-
pytest.raises(nx.NetworkXNotImplemented, nx.network_simplex, G)
|
|
415
|
-
G = nx.DiGraph()
|
|
416
|
-
pytest.raises(nx.NetworkXError, nx.network_simplex, G)
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
@pytest.fixture()
|
|
420
|
-
def faux_inf_example():
|
|
421
|
-
"""Base test graph for probing faux_infinity bound. See gh-7562"""
|
|
422
|
-
G = nx.DiGraph()
|
|
423
|
-
|
|
424
|
-
# Add nodes with demands
|
|
425
|
-
G.add_node("s0", demand=-4)
|
|
426
|
-
G.add_node("s1", demand=-4)
|
|
427
|
-
G.add_node("ns", demand=0)
|
|
428
|
-
G.add_node("nc", demand=0)
|
|
429
|
-
G.add_node("c0", demand=4)
|
|
430
|
-
G.add_node("c1", demand=4)
|
|
431
|
-
|
|
432
|
-
# Uniformly weighted edges
|
|
433
|
-
G.add_edge("s0", "ns", weight=1)
|
|
434
|
-
G.add_edge("s1", "ns", weight=1)
|
|
435
|
-
G.add_edge("ns", "nc", weight=1)
|
|
436
|
-
G.add_edge("nc", "c0", weight=1)
|
|
437
|
-
G.add_edge("nc", "c1", weight=1)
|
|
438
|
-
|
|
439
|
-
return G
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
@pytest.mark.parametrize("large_capacity", [True, False])
|
|
443
|
-
@pytest.mark.parametrize("large_demand", [True, False])
|
|
444
|
-
@pytest.mark.parametrize("large_weight", [True, False])
|
|
445
|
-
def test_network_simplex_faux_infinity(
|
|
446
|
-
faux_inf_example, large_capacity, large_demand, large_weight
|
|
447
|
-
):
|
|
448
|
-
"""network_simplex should not raise an exception as a result of faux_infinity
|
|
449
|
-
for these cases. See gh-7562"""
|
|
450
|
-
G = faux_inf_example
|
|
451
|
-
lv = 1_000_000_000
|
|
452
|
-
|
|
453
|
-
# Modify the base graph with combinations of large values for capacity,
|
|
454
|
-
# demand, and weight to probe faux_inifity
|
|
455
|
-
if large_capacity:
|
|
456
|
-
G["s0"]["ns"]["capacity"] = lv
|
|
457
|
-
if large_demand:
|
|
458
|
-
G.nodes["s0"]["demand"] = -lv
|
|
459
|
-
G.nodes["c1"]["demand"] = lv
|
|
460
|
-
if large_weight:
|
|
461
|
-
G["s1"]["ns"]["weight"] = lv
|
|
462
|
-
|
|
463
|
-
# Execute without raising
|
|
464
|
-
fc, fd = nx.network_simplex(G)
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
def test_network_simplex_unbounded_flow():
|
|
468
|
-
G = nx.DiGraph()
|
|
469
|
-
# Add nodes
|
|
470
|
-
G.add_node("A")
|
|
471
|
-
G.add_node("B")
|
|
472
|
-
G.add_node("C")
|
|
473
|
-
|
|
474
|
-
# Add edges forming a negative cycle
|
|
475
|
-
G.add_weighted_edges_from([("A", "B", -5), ("B", "C", -5), ("C", "A", -5)])
|
|
476
|
-
|
|
477
|
-
with pytest.raises(
|
|
478
|
-
nx.NetworkXUnbounded,
|
|
479
|
-
match="negative cycle with infinite capacity found",
|
|
480
|
-
):
|
|
481
|
-
nx.network_simplex(G)
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|