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
package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_maxflow_large_graph.py
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
"""Maximum flow algorithms test suite on large graphs."""
|
|
2
|
-
|
|
3
|
-
import bz2
|
|
4
|
-
import importlib.resources
|
|
5
|
-
import pickle
|
|
6
|
-
|
|
7
|
-
import pytest
|
|
8
|
-
|
|
9
|
-
import networkx as nx
|
|
10
|
-
from networkx.algorithms.flow import (
|
|
11
|
-
boykov_kolmogorov,
|
|
12
|
-
build_flow_dict,
|
|
13
|
-
build_residual_network,
|
|
14
|
-
dinitz,
|
|
15
|
-
edmonds_karp,
|
|
16
|
-
preflow_push,
|
|
17
|
-
shortest_augmenting_path,
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
flow_funcs = [
|
|
21
|
-
boykov_kolmogorov,
|
|
22
|
-
dinitz,
|
|
23
|
-
edmonds_karp,
|
|
24
|
-
preflow_push,
|
|
25
|
-
shortest_augmenting_path,
|
|
26
|
-
]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def gen_pyramid(N):
|
|
30
|
-
# This graph admits a flow of value 1 for which every arc is at
|
|
31
|
-
# capacity (except the arcs incident to the sink which have
|
|
32
|
-
# infinite capacity).
|
|
33
|
-
G = nx.DiGraph()
|
|
34
|
-
|
|
35
|
-
for i in range(N - 1):
|
|
36
|
-
cap = 1.0 / (i + 2)
|
|
37
|
-
for j in range(i + 1):
|
|
38
|
-
G.add_edge((i, j), (i + 1, j), capacity=cap)
|
|
39
|
-
cap = 1.0 / (i + 1) - cap
|
|
40
|
-
G.add_edge((i, j), (i + 1, j + 1), capacity=cap)
|
|
41
|
-
cap = 1.0 / (i + 2) - cap
|
|
42
|
-
|
|
43
|
-
for j in range(N):
|
|
44
|
-
G.add_edge((N - 1, j), "t")
|
|
45
|
-
|
|
46
|
-
return G
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def read_graph(name):
|
|
50
|
-
fname = (
|
|
51
|
-
importlib.resources.files("networkx.algorithms.flow.tests")
|
|
52
|
-
/ f"{name}.gpickle.bz2"
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
with bz2.BZ2File(fname, "rb") as f:
|
|
56
|
-
G = pickle.load(f)
|
|
57
|
-
return G
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
def validate_flows(G, s, t, soln_value, R, flow_func):
|
|
61
|
-
flow_value = R.graph["flow_value"]
|
|
62
|
-
flow_dict = build_flow_dict(G, R)
|
|
63
|
-
errmsg = f"Assertion failed in function: {flow_func.__name__}"
|
|
64
|
-
assert soln_value == flow_value, errmsg
|
|
65
|
-
assert set(G) == set(flow_dict), errmsg
|
|
66
|
-
for u in G:
|
|
67
|
-
assert set(G[u]) == set(flow_dict[u]), errmsg
|
|
68
|
-
excess = {u: 0 for u in flow_dict}
|
|
69
|
-
for u in flow_dict:
|
|
70
|
-
for v, flow in flow_dict[u].items():
|
|
71
|
-
assert flow <= G[u][v].get("capacity", float("inf")), errmsg
|
|
72
|
-
assert flow >= 0, errmsg
|
|
73
|
-
excess[u] -= flow
|
|
74
|
-
excess[v] += flow
|
|
75
|
-
for u, exc in excess.items():
|
|
76
|
-
if u == s:
|
|
77
|
-
assert exc == -soln_value, errmsg
|
|
78
|
-
elif u == t:
|
|
79
|
-
assert exc == soln_value, errmsg
|
|
80
|
-
else:
|
|
81
|
-
assert exc == 0, errmsg
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
class TestMaxflowLargeGraph:
|
|
85
|
-
def test_complete_graph(self):
|
|
86
|
-
N = 50
|
|
87
|
-
G = nx.complete_graph(N)
|
|
88
|
-
nx.set_edge_attributes(G, 5, "capacity")
|
|
89
|
-
R = build_residual_network(G, "capacity")
|
|
90
|
-
kwargs = {"residual": R}
|
|
91
|
-
|
|
92
|
-
for flow_func in flow_funcs:
|
|
93
|
-
kwargs["flow_func"] = flow_func
|
|
94
|
-
errmsg = f"Assertion failed in function: {flow_func.__name__}"
|
|
95
|
-
flow_value = nx.maximum_flow_value(G, 1, 2, **kwargs)
|
|
96
|
-
assert flow_value == 5 * (N - 1), errmsg
|
|
97
|
-
|
|
98
|
-
def test_pyramid(self):
|
|
99
|
-
N = 10
|
|
100
|
-
# N = 100 # this gives a graph with 5051 nodes
|
|
101
|
-
G = gen_pyramid(N)
|
|
102
|
-
R = build_residual_network(G, "capacity")
|
|
103
|
-
kwargs = {"residual": R}
|
|
104
|
-
|
|
105
|
-
for flow_func in flow_funcs:
|
|
106
|
-
kwargs["flow_func"] = flow_func
|
|
107
|
-
errmsg = f"Assertion failed in function: {flow_func.__name__}"
|
|
108
|
-
flow_value = nx.maximum_flow_value(G, (0, 0), "t", **kwargs)
|
|
109
|
-
assert flow_value == pytest.approx(1.0, abs=1e-7)
|
|
110
|
-
|
|
111
|
-
def test_gl1(self):
|
|
112
|
-
G = read_graph("gl1")
|
|
113
|
-
s = 1
|
|
114
|
-
t = len(G)
|
|
115
|
-
R = build_residual_network(G, "capacity")
|
|
116
|
-
kwargs = {"residual": R}
|
|
117
|
-
|
|
118
|
-
# do one flow_func to save time
|
|
119
|
-
flow_func = flow_funcs[0]
|
|
120
|
-
validate_flows(G, s, t, 156545, flow_func(G, s, t, **kwargs), flow_func)
|
|
121
|
-
|
|
122
|
-
# for flow_func in flow_funcs:
|
|
123
|
-
# validate_flows(G, s, t, 156545, flow_func(G, s, t, **kwargs),
|
|
124
|
-
# flow_func)
|
|
125
|
-
|
|
126
|
-
@pytest.mark.slow
|
|
127
|
-
def test_gw1(self):
|
|
128
|
-
G = read_graph("gw1")
|
|
129
|
-
s = 1
|
|
130
|
-
t = len(G)
|
|
131
|
-
R = build_residual_network(G, "capacity")
|
|
132
|
-
kwargs = {"residual": R}
|
|
133
|
-
|
|
134
|
-
for flow_func in flow_funcs:
|
|
135
|
-
validate_flows(G, s, t, 1202018, flow_func(G, s, t, **kwargs), flow_func)
|
|
136
|
-
|
|
137
|
-
def test_wlm3(self):
|
|
138
|
-
G = read_graph("wlm3")
|
|
139
|
-
s = 1
|
|
140
|
-
t = len(G)
|
|
141
|
-
R = build_residual_network(G, "capacity")
|
|
142
|
-
kwargs = {"residual": R}
|
|
143
|
-
|
|
144
|
-
# do one flow_func to save time
|
|
145
|
-
flow_func = flow_funcs[0]
|
|
146
|
-
validate_flows(G, s, t, 11875108, flow_func(G, s, t, **kwargs), flow_func)
|
|
147
|
-
|
|
148
|
-
# for flow_func in flow_funcs:
|
|
149
|
-
# validate_flows(G, s, t, 11875108, flow_func(G, s, t, **kwargs),
|
|
150
|
-
# flow_func)
|
|
151
|
-
|
|
152
|
-
def test_preflow_push_global_relabel(self):
|
|
153
|
-
G = read_graph("gw1")
|
|
154
|
-
R = preflow_push(G, 1, len(G), global_relabel_freq=50)
|
|
155
|
-
assert R.graph["flow_value"] == 1202018
|
|
@@ -1,475 +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
|
-
class TestMinCostFlow:
|
|
11
|
-
def test_simple_digraph(self):
|
|
12
|
-
G = nx.DiGraph()
|
|
13
|
-
G.add_node("a", demand=-5)
|
|
14
|
-
G.add_node("d", demand=5)
|
|
15
|
-
G.add_edge("a", "b", weight=3, capacity=4)
|
|
16
|
-
G.add_edge("a", "c", weight=6, capacity=10)
|
|
17
|
-
G.add_edge("b", "d", weight=1, capacity=9)
|
|
18
|
-
G.add_edge("c", "d", weight=2, capacity=5)
|
|
19
|
-
flowCost, H = nx.network_simplex(G)
|
|
20
|
-
soln = {"a": {"b": 4, "c": 1}, "b": {"d": 4}, "c": {"d": 1}, "d": {}}
|
|
21
|
-
assert flowCost == 24
|
|
22
|
-
assert nx.min_cost_flow_cost(G) == 24
|
|
23
|
-
assert H == soln
|
|
24
|
-
assert nx.min_cost_flow(G) == soln
|
|
25
|
-
assert nx.cost_of_flow(G, H) == 24
|
|
26
|
-
|
|
27
|
-
flowCost, H = nx.capacity_scaling(G)
|
|
28
|
-
assert flowCost == 24
|
|
29
|
-
assert nx.cost_of_flow(G, H) == 24
|
|
30
|
-
assert H == soln
|
|
31
|
-
|
|
32
|
-
def test_negcycle_infcap(self):
|
|
33
|
-
G = nx.DiGraph()
|
|
34
|
-
G.add_node("s", demand=-5)
|
|
35
|
-
G.add_node("t", demand=5)
|
|
36
|
-
G.add_edge("s", "a", weight=1, capacity=3)
|
|
37
|
-
G.add_edge("a", "b", weight=3)
|
|
38
|
-
G.add_edge("c", "a", weight=-6)
|
|
39
|
-
G.add_edge("b", "d", weight=1)
|
|
40
|
-
G.add_edge("d", "c", weight=-2)
|
|
41
|
-
G.add_edge("d", "t", weight=1, capacity=3)
|
|
42
|
-
pytest.raises(nx.NetworkXUnfeasible, nx.network_simplex, G)
|
|
43
|
-
pytest.raises(nx.NetworkXUnbounded, nx.capacity_scaling, G)
|
|
44
|
-
|
|
45
|
-
def test_sum_demands_not_zero(self):
|
|
46
|
-
G = nx.DiGraph()
|
|
47
|
-
G.add_node("s", demand=-5)
|
|
48
|
-
G.add_node("t", demand=4)
|
|
49
|
-
G.add_edge("s", "a", weight=1, capacity=3)
|
|
50
|
-
G.add_edge("a", "b", weight=3)
|
|
51
|
-
G.add_edge("a", "c", weight=-6)
|
|
52
|
-
G.add_edge("b", "d", weight=1)
|
|
53
|
-
G.add_edge("c", "d", weight=-2)
|
|
54
|
-
G.add_edge("d", "t", weight=1, capacity=3)
|
|
55
|
-
pytest.raises(nx.NetworkXUnfeasible, nx.network_simplex, G)
|
|
56
|
-
pytest.raises(nx.NetworkXUnfeasible, nx.capacity_scaling, G)
|
|
57
|
-
|
|
58
|
-
def test_no_flow_satisfying_demands(self):
|
|
59
|
-
G = nx.DiGraph()
|
|
60
|
-
G.add_node("s", demand=-5)
|
|
61
|
-
G.add_node("t", demand=5)
|
|
62
|
-
G.add_edge("s", "a", weight=1, capacity=3)
|
|
63
|
-
G.add_edge("a", "b", weight=3)
|
|
64
|
-
G.add_edge("a", "c", weight=-6)
|
|
65
|
-
G.add_edge("b", "d", weight=1)
|
|
66
|
-
G.add_edge("c", "d", weight=-2)
|
|
67
|
-
G.add_edge("d", "t", weight=1, capacity=3)
|
|
68
|
-
pytest.raises(nx.NetworkXUnfeasible, nx.network_simplex, G)
|
|
69
|
-
pytest.raises(nx.NetworkXUnfeasible, nx.capacity_scaling, G)
|
|
70
|
-
|
|
71
|
-
def test_transshipment(self):
|
|
72
|
-
G = nx.DiGraph()
|
|
73
|
-
G.add_node("a", demand=1)
|
|
74
|
-
G.add_node("b", demand=-2)
|
|
75
|
-
G.add_node("c", demand=-2)
|
|
76
|
-
G.add_node("d", demand=3)
|
|
77
|
-
G.add_node("e", demand=-4)
|
|
78
|
-
G.add_node("f", demand=-4)
|
|
79
|
-
G.add_node("g", demand=3)
|
|
80
|
-
G.add_node("h", demand=2)
|
|
81
|
-
G.add_node("r", demand=3)
|
|
82
|
-
G.add_edge("a", "c", weight=3)
|
|
83
|
-
G.add_edge("r", "a", weight=2)
|
|
84
|
-
G.add_edge("b", "a", weight=9)
|
|
85
|
-
G.add_edge("r", "c", weight=0)
|
|
86
|
-
G.add_edge("b", "r", weight=-6)
|
|
87
|
-
G.add_edge("c", "d", weight=5)
|
|
88
|
-
G.add_edge("e", "r", weight=4)
|
|
89
|
-
G.add_edge("e", "f", weight=3)
|
|
90
|
-
G.add_edge("h", "b", weight=4)
|
|
91
|
-
G.add_edge("f", "d", weight=7)
|
|
92
|
-
G.add_edge("f", "h", weight=12)
|
|
93
|
-
G.add_edge("g", "d", weight=12)
|
|
94
|
-
G.add_edge("f", "g", weight=-1)
|
|
95
|
-
G.add_edge("h", "g", weight=-10)
|
|
96
|
-
flowCost, H = nx.network_simplex(G)
|
|
97
|
-
soln = {
|
|
98
|
-
"a": {"c": 0},
|
|
99
|
-
"b": {"a": 0, "r": 2},
|
|
100
|
-
"c": {"d": 3},
|
|
101
|
-
"d": {},
|
|
102
|
-
"e": {"r": 3, "f": 1},
|
|
103
|
-
"f": {"d": 0, "g": 3, "h": 2},
|
|
104
|
-
"g": {"d": 0},
|
|
105
|
-
"h": {"b": 0, "g": 0},
|
|
106
|
-
"r": {"a": 1, "c": 1},
|
|
107
|
-
}
|
|
108
|
-
assert flowCost == 41
|
|
109
|
-
assert nx.min_cost_flow_cost(G) == 41
|
|
110
|
-
assert H == soln
|
|
111
|
-
assert nx.min_cost_flow(G) == soln
|
|
112
|
-
assert nx.cost_of_flow(G, H) == 41
|
|
113
|
-
|
|
114
|
-
flowCost, H = nx.capacity_scaling(G)
|
|
115
|
-
assert flowCost == 41
|
|
116
|
-
assert nx.cost_of_flow(G, H) == 41
|
|
117
|
-
assert H == soln
|
|
118
|
-
|
|
119
|
-
def test_max_flow_min_cost(self):
|
|
120
|
-
G = nx.DiGraph()
|
|
121
|
-
G.add_edge("s", "a", bandwidth=6)
|
|
122
|
-
G.add_edge("s", "c", bandwidth=10, cost=10)
|
|
123
|
-
G.add_edge("a", "b", cost=6)
|
|
124
|
-
G.add_edge("b", "d", bandwidth=8, cost=7)
|
|
125
|
-
G.add_edge("c", "d", cost=10)
|
|
126
|
-
G.add_edge("d", "t", bandwidth=5, cost=5)
|
|
127
|
-
soln = {
|
|
128
|
-
"s": {"a": 5, "c": 0},
|
|
129
|
-
"a": {"b": 5},
|
|
130
|
-
"b": {"d": 5},
|
|
131
|
-
"c": {"d": 0},
|
|
132
|
-
"d": {"t": 5},
|
|
133
|
-
"t": {},
|
|
134
|
-
}
|
|
135
|
-
flow = nx.max_flow_min_cost(G, "s", "t", capacity="bandwidth", weight="cost")
|
|
136
|
-
assert flow == soln
|
|
137
|
-
assert nx.cost_of_flow(G, flow, weight="cost") == 90
|
|
138
|
-
|
|
139
|
-
G.add_edge("t", "s", cost=-100)
|
|
140
|
-
flowCost, flow = nx.capacity_scaling(G, capacity="bandwidth", weight="cost")
|
|
141
|
-
G.remove_edge("t", "s")
|
|
142
|
-
assert flowCost == -410
|
|
143
|
-
assert flow["t"]["s"] == 5
|
|
144
|
-
del flow["t"]["s"]
|
|
145
|
-
assert flow == soln
|
|
146
|
-
assert nx.cost_of_flow(G, flow, weight="cost") == 90
|
|
147
|
-
|
|
148
|
-
def test_digraph1(self):
|
|
149
|
-
# From Bradley, S. P., Hax, A. C. and Magnanti, T. L. Applied
|
|
150
|
-
# Mathematical Programming. Addison-Wesley, 1977.
|
|
151
|
-
G = nx.DiGraph()
|
|
152
|
-
G.add_node(1, demand=-20)
|
|
153
|
-
G.add_node(4, demand=5)
|
|
154
|
-
G.add_node(5, demand=15)
|
|
155
|
-
G.add_edges_from(
|
|
156
|
-
[
|
|
157
|
-
(1, 2, {"capacity": 15, "weight": 4}),
|
|
158
|
-
(1, 3, {"capacity": 8, "weight": 4}),
|
|
159
|
-
(2, 3, {"weight": 2}),
|
|
160
|
-
(2, 4, {"capacity": 4, "weight": 2}),
|
|
161
|
-
(2, 5, {"capacity": 10, "weight": 6}),
|
|
162
|
-
(3, 4, {"capacity": 15, "weight": 1}),
|
|
163
|
-
(3, 5, {"capacity": 5, "weight": 3}),
|
|
164
|
-
(4, 5, {"weight": 2}),
|
|
165
|
-
(5, 3, {"capacity": 4, "weight": 1}),
|
|
166
|
-
]
|
|
167
|
-
)
|
|
168
|
-
flowCost, H = nx.network_simplex(G)
|
|
169
|
-
soln = {
|
|
170
|
-
1: {2: 12, 3: 8},
|
|
171
|
-
2: {3: 8, 4: 4, 5: 0},
|
|
172
|
-
3: {4: 11, 5: 5},
|
|
173
|
-
4: {5: 10},
|
|
174
|
-
5: {3: 0},
|
|
175
|
-
}
|
|
176
|
-
assert flowCost == 150
|
|
177
|
-
assert nx.min_cost_flow_cost(G) == 150
|
|
178
|
-
assert H == soln
|
|
179
|
-
assert nx.min_cost_flow(G) == soln
|
|
180
|
-
assert nx.cost_of_flow(G, H) == 150
|
|
181
|
-
|
|
182
|
-
flowCost, H = nx.capacity_scaling(G)
|
|
183
|
-
assert flowCost == 150
|
|
184
|
-
assert H == soln
|
|
185
|
-
assert nx.cost_of_flow(G, H) == 150
|
|
186
|
-
|
|
187
|
-
def test_digraph2(self):
|
|
188
|
-
# Example from ticket #430 from mfrasca. Original source:
|
|
189
|
-
# http://www.cs.princeton.edu/courses/archive/spr03/cs226/lectures/mincost.4up.pdf, slide 11.
|
|
190
|
-
G = nx.DiGraph()
|
|
191
|
-
G.add_edge("s", 1, capacity=12)
|
|
192
|
-
G.add_edge("s", 2, capacity=6)
|
|
193
|
-
G.add_edge("s", 3, capacity=14)
|
|
194
|
-
G.add_edge(1, 2, capacity=11, weight=4)
|
|
195
|
-
G.add_edge(2, 3, capacity=9, weight=6)
|
|
196
|
-
G.add_edge(1, 4, capacity=5, weight=5)
|
|
197
|
-
G.add_edge(1, 5, capacity=2, weight=12)
|
|
198
|
-
G.add_edge(2, 5, capacity=4, weight=4)
|
|
199
|
-
G.add_edge(2, 6, capacity=2, weight=6)
|
|
200
|
-
G.add_edge(3, 6, capacity=31, weight=3)
|
|
201
|
-
G.add_edge(4, 5, capacity=18, weight=4)
|
|
202
|
-
G.add_edge(5, 6, capacity=9, weight=5)
|
|
203
|
-
G.add_edge(4, "t", capacity=3)
|
|
204
|
-
G.add_edge(5, "t", capacity=7)
|
|
205
|
-
G.add_edge(6, "t", capacity=22)
|
|
206
|
-
flow = nx.max_flow_min_cost(G, "s", "t")
|
|
207
|
-
soln = {
|
|
208
|
-
1: {2: 6, 4: 5, 5: 1},
|
|
209
|
-
2: {3: 6, 5: 4, 6: 2},
|
|
210
|
-
3: {6: 20},
|
|
211
|
-
4: {5: 2, "t": 3},
|
|
212
|
-
5: {6: 0, "t": 7},
|
|
213
|
-
6: {"t": 22},
|
|
214
|
-
"s": {1: 12, 2: 6, 3: 14},
|
|
215
|
-
"t": {},
|
|
216
|
-
}
|
|
217
|
-
assert flow == soln
|
|
218
|
-
|
|
219
|
-
G.add_edge("t", "s", weight=-100)
|
|
220
|
-
flowCost, flow = nx.capacity_scaling(G)
|
|
221
|
-
G.remove_edge("t", "s")
|
|
222
|
-
assert flow["t"]["s"] == 32
|
|
223
|
-
assert flowCost == -3007
|
|
224
|
-
del flow["t"]["s"]
|
|
225
|
-
assert flow == soln
|
|
226
|
-
assert nx.cost_of_flow(G, flow) == 193
|
|
227
|
-
|
|
228
|
-
def test_digraph3(self):
|
|
229
|
-
"""Combinatorial Optimization: Algorithms and Complexity,
|
|
230
|
-
Papadimitriou Steiglitz at page 140 has an example, 7.1, but that
|
|
231
|
-
admits multiple solutions, so I alter it a bit. From ticket #430
|
|
232
|
-
by mfrasca."""
|
|
233
|
-
|
|
234
|
-
G = nx.DiGraph()
|
|
235
|
-
G.add_edge("s", "a")
|
|
236
|
-
G["s"]["a"].update({0: 2, 1: 4})
|
|
237
|
-
G.add_edge("s", "b")
|
|
238
|
-
G["s"]["b"].update({0: 2, 1: 1})
|
|
239
|
-
G.add_edge("a", "b")
|
|
240
|
-
G["a"]["b"].update({0: 5, 1: 2})
|
|
241
|
-
G.add_edge("a", "t")
|
|
242
|
-
G["a"]["t"].update({0: 1, 1: 5})
|
|
243
|
-
G.add_edge("b", "a")
|
|
244
|
-
G["b"]["a"].update({0: 1, 1: 3})
|
|
245
|
-
G.add_edge("b", "t")
|
|
246
|
-
G["b"]["t"].update({0: 3, 1: 2})
|
|
247
|
-
|
|
248
|
-
"PS.ex.7.1: testing main function"
|
|
249
|
-
sol = nx.max_flow_min_cost(G, "s", "t", capacity=0, weight=1)
|
|
250
|
-
flow = sum(v for v in sol["s"].values())
|
|
251
|
-
assert 4 == flow
|
|
252
|
-
assert 23 == nx.cost_of_flow(G, sol, weight=1)
|
|
253
|
-
assert sol["s"] == {"a": 2, "b": 2}
|
|
254
|
-
assert sol["a"] == {"b": 1, "t": 1}
|
|
255
|
-
assert sol["b"] == {"a": 0, "t": 3}
|
|
256
|
-
assert sol["t"] == {}
|
|
257
|
-
|
|
258
|
-
G.add_edge("t", "s")
|
|
259
|
-
G["t"]["s"].update({1: -100})
|
|
260
|
-
flowCost, sol = nx.capacity_scaling(G, capacity=0, weight=1)
|
|
261
|
-
G.remove_edge("t", "s")
|
|
262
|
-
flow = sum(v for v in sol["s"].values())
|
|
263
|
-
assert 4 == flow
|
|
264
|
-
assert sol["t"]["s"] == 4
|
|
265
|
-
assert flowCost == -377
|
|
266
|
-
del sol["t"]["s"]
|
|
267
|
-
assert sol["s"] == {"a": 2, "b": 2}
|
|
268
|
-
assert sol["a"] == {"b": 1, "t": 1}
|
|
269
|
-
assert sol["b"] == {"a": 0, "t": 3}
|
|
270
|
-
assert sol["t"] == {}
|
|
271
|
-
assert nx.cost_of_flow(G, sol, weight=1) == 23
|
|
272
|
-
|
|
273
|
-
def test_zero_capacity_edges(self):
|
|
274
|
-
"""Address issue raised in ticket #617 by arv."""
|
|
275
|
-
G = nx.DiGraph()
|
|
276
|
-
G.add_edges_from(
|
|
277
|
-
[
|
|
278
|
-
(1, 2, {"capacity": 1, "weight": 1}),
|
|
279
|
-
(1, 5, {"capacity": 1, "weight": 1}),
|
|
280
|
-
(2, 3, {"capacity": 0, "weight": 1}),
|
|
281
|
-
(2, 5, {"capacity": 1, "weight": 1}),
|
|
282
|
-
(5, 3, {"capacity": 2, "weight": 1}),
|
|
283
|
-
(5, 4, {"capacity": 0, "weight": 1}),
|
|
284
|
-
(3, 4, {"capacity": 2, "weight": 1}),
|
|
285
|
-
]
|
|
286
|
-
)
|
|
287
|
-
G.nodes[1]["demand"] = -1
|
|
288
|
-
G.nodes[2]["demand"] = -1
|
|
289
|
-
G.nodes[4]["demand"] = 2
|
|
290
|
-
|
|
291
|
-
flowCost, H = nx.network_simplex(G)
|
|
292
|
-
soln = {1: {2: 0, 5: 1}, 2: {3: 0, 5: 1}, 3: {4: 2}, 4: {}, 5: {3: 2, 4: 0}}
|
|
293
|
-
assert flowCost == 6
|
|
294
|
-
assert nx.min_cost_flow_cost(G) == 6
|
|
295
|
-
assert H == soln
|
|
296
|
-
assert nx.min_cost_flow(G) == soln
|
|
297
|
-
assert nx.cost_of_flow(G, H) == 6
|
|
298
|
-
|
|
299
|
-
flowCost, H = nx.capacity_scaling(G)
|
|
300
|
-
assert flowCost == 6
|
|
301
|
-
assert H == soln
|
|
302
|
-
assert nx.cost_of_flow(G, H) == 6
|
|
303
|
-
|
|
304
|
-
def test_digon(self):
|
|
305
|
-
"""Check if digons are handled properly. Taken from ticket
|
|
306
|
-
#618 by arv."""
|
|
307
|
-
nodes = [(1, {}), (2, {"demand": -4}), (3, {"demand": 4})]
|
|
308
|
-
edges = [
|
|
309
|
-
(1, 2, {"capacity": 3, "weight": 600000}),
|
|
310
|
-
(2, 1, {"capacity": 2, "weight": 0}),
|
|
311
|
-
(2, 3, {"capacity": 5, "weight": 714285}),
|
|
312
|
-
(3, 2, {"capacity": 2, "weight": 0}),
|
|
313
|
-
]
|
|
314
|
-
G = nx.DiGraph(edges)
|
|
315
|
-
G.add_nodes_from(nodes)
|
|
316
|
-
flowCost, H = nx.network_simplex(G)
|
|
317
|
-
soln = {1: {2: 0}, 2: {1: 0, 3: 4}, 3: {2: 0}}
|
|
318
|
-
assert flowCost == 2857140
|
|
319
|
-
assert nx.min_cost_flow_cost(G) == 2857140
|
|
320
|
-
assert H == soln
|
|
321
|
-
assert nx.min_cost_flow(G) == soln
|
|
322
|
-
assert nx.cost_of_flow(G, H) == 2857140
|
|
323
|
-
|
|
324
|
-
flowCost, H = nx.capacity_scaling(G)
|
|
325
|
-
assert flowCost == 2857140
|
|
326
|
-
assert H == soln
|
|
327
|
-
assert nx.cost_of_flow(G, H) == 2857140
|
|
328
|
-
|
|
329
|
-
def test_deadend(self):
|
|
330
|
-
"""Check if one-node cycles are handled properly. Taken from ticket
|
|
331
|
-
#2906 from @sshraven."""
|
|
332
|
-
G = nx.DiGraph()
|
|
333
|
-
|
|
334
|
-
G.add_nodes_from(range(5), demand=0)
|
|
335
|
-
G.nodes[4]["demand"] = -13
|
|
336
|
-
G.nodes[3]["demand"] = 13
|
|
337
|
-
|
|
338
|
-
G.add_edges_from([(0, 2), (0, 3), (2, 1)], capacity=20, weight=0.1)
|
|
339
|
-
pytest.raises(nx.NetworkXUnfeasible, nx.min_cost_flow, G)
|
|
340
|
-
|
|
341
|
-
def test_infinite_capacity_neg_digon(self):
|
|
342
|
-
"""An infinite capacity negative cost digon results in an unbounded
|
|
343
|
-
instance."""
|
|
344
|
-
nodes = [(1, {}), (2, {"demand": -4}), (3, {"demand": 4})]
|
|
345
|
-
edges = [
|
|
346
|
-
(1, 2, {"weight": -600}),
|
|
347
|
-
(2, 1, {"weight": 0}),
|
|
348
|
-
(2, 3, {"capacity": 5, "weight": 714285}),
|
|
349
|
-
(3, 2, {"capacity": 2, "weight": 0}),
|
|
350
|
-
]
|
|
351
|
-
G = nx.DiGraph(edges)
|
|
352
|
-
G.add_nodes_from(nodes)
|
|
353
|
-
pytest.raises(nx.NetworkXUnbounded, nx.network_simplex, G)
|
|
354
|
-
pytest.raises(nx.NetworkXUnbounded, nx.capacity_scaling, G)
|
|
355
|
-
|
|
356
|
-
def test_finite_capacity_neg_digon(self):
|
|
357
|
-
"""The digon should receive the maximum amount of flow it can handle.
|
|
358
|
-
Taken from ticket #749 by @chuongdo."""
|
|
359
|
-
G = nx.DiGraph()
|
|
360
|
-
G.add_edge("a", "b", capacity=1, weight=-1)
|
|
361
|
-
G.add_edge("b", "a", capacity=1, weight=-1)
|
|
362
|
-
min_cost = -2
|
|
363
|
-
assert nx.min_cost_flow_cost(G) == min_cost
|
|
364
|
-
|
|
365
|
-
flowCost, H = nx.capacity_scaling(G)
|
|
366
|
-
assert flowCost == -2
|
|
367
|
-
assert H == {"a": {"b": 1}, "b": {"a": 1}}
|
|
368
|
-
assert nx.cost_of_flow(G, H) == -2
|
|
369
|
-
|
|
370
|
-
def test_multidigraph(self):
|
|
371
|
-
"""Multidigraphs are acceptable."""
|
|
372
|
-
G = nx.MultiDiGraph()
|
|
373
|
-
G.add_weighted_edges_from([(1, 2, 1), (2, 3, 2)], weight="capacity")
|
|
374
|
-
flowCost, H = nx.network_simplex(G)
|
|
375
|
-
assert flowCost == 0
|
|
376
|
-
assert H == {1: {2: {0: 0}}, 2: {3: {0: 0}}, 3: {}}
|
|
377
|
-
|
|
378
|
-
flowCost, H = nx.capacity_scaling(G)
|
|
379
|
-
assert flowCost == 0
|
|
380
|
-
assert H == {1: {2: {0: 0}}, 2: {3: {0: 0}}, 3: {}}
|
|
381
|
-
|
|
382
|
-
def test_negative_selfloops(self):
|
|
383
|
-
"""Negative selfloops should cause an exception if uncapacitated and
|
|
384
|
-
always be saturated otherwise.
|
|
385
|
-
"""
|
|
386
|
-
G = nx.DiGraph()
|
|
387
|
-
G.add_edge(1, 1, weight=-1)
|
|
388
|
-
pytest.raises(nx.NetworkXUnbounded, nx.network_simplex, G)
|
|
389
|
-
pytest.raises(nx.NetworkXUnbounded, nx.capacity_scaling, G)
|
|
390
|
-
G[1][1]["capacity"] = 2
|
|
391
|
-
flowCost, H = nx.network_simplex(G)
|
|
392
|
-
assert flowCost == -2
|
|
393
|
-
assert H == {1: {1: 2}}
|
|
394
|
-
flowCost, H = nx.capacity_scaling(G)
|
|
395
|
-
assert flowCost == -2
|
|
396
|
-
assert H == {1: {1: 2}}
|
|
397
|
-
|
|
398
|
-
G = nx.MultiDiGraph()
|
|
399
|
-
G.add_edge(1, 1, "x", weight=-1)
|
|
400
|
-
G.add_edge(1, 1, "y", weight=1)
|
|
401
|
-
pytest.raises(nx.NetworkXUnbounded, nx.network_simplex, G)
|
|
402
|
-
pytest.raises(nx.NetworkXUnbounded, nx.capacity_scaling, G)
|
|
403
|
-
G[1][1]["x"]["capacity"] = 2
|
|
404
|
-
flowCost, H = nx.network_simplex(G)
|
|
405
|
-
assert flowCost == -2
|
|
406
|
-
assert H == {1: {1: {"x": 2, "y": 0}}}
|
|
407
|
-
flowCost, H = nx.capacity_scaling(G)
|
|
408
|
-
assert flowCost == -2
|
|
409
|
-
assert H == {1: {1: {"x": 2, "y": 0}}}
|
|
410
|
-
|
|
411
|
-
def test_bone_shaped(self):
|
|
412
|
-
# From #1283
|
|
413
|
-
G = nx.DiGraph()
|
|
414
|
-
G.add_node(0, demand=-4)
|
|
415
|
-
G.add_node(1, demand=2)
|
|
416
|
-
G.add_node(2, demand=2)
|
|
417
|
-
G.add_node(3, demand=4)
|
|
418
|
-
G.add_node(4, demand=-2)
|
|
419
|
-
G.add_node(5, demand=-2)
|
|
420
|
-
G.add_edge(0, 1, capacity=4)
|
|
421
|
-
G.add_edge(0, 2, capacity=4)
|
|
422
|
-
G.add_edge(4, 3, capacity=4)
|
|
423
|
-
G.add_edge(5, 3, capacity=4)
|
|
424
|
-
G.add_edge(0, 3, capacity=0)
|
|
425
|
-
flowCost, H = nx.network_simplex(G)
|
|
426
|
-
assert flowCost == 0
|
|
427
|
-
assert H == {0: {1: 2, 2: 2, 3: 0}, 1: {}, 2: {}, 3: {}, 4: {3: 2}, 5: {3: 2}}
|
|
428
|
-
flowCost, H = nx.capacity_scaling(G)
|
|
429
|
-
assert flowCost == 0
|
|
430
|
-
assert H == {0: {1: 2, 2: 2, 3: 0}, 1: {}, 2: {}, 3: {}, 4: {3: 2}, 5: {3: 2}}
|
|
431
|
-
|
|
432
|
-
def test_exceptions(self):
|
|
433
|
-
G = nx.Graph()
|
|
434
|
-
pytest.raises(nx.NetworkXNotImplemented, nx.network_simplex, G)
|
|
435
|
-
pytest.raises(nx.NetworkXNotImplemented, nx.capacity_scaling, G)
|
|
436
|
-
G = nx.MultiGraph()
|
|
437
|
-
pytest.raises(nx.NetworkXNotImplemented, nx.network_simplex, G)
|
|
438
|
-
pytest.raises(nx.NetworkXNotImplemented, nx.capacity_scaling, G)
|
|
439
|
-
G = nx.DiGraph()
|
|
440
|
-
pytest.raises(nx.NetworkXError, nx.network_simplex, G)
|
|
441
|
-
# pytest.raises(nx.NetworkXError, nx.capacity_scaling, G)
|
|
442
|
-
G.add_node(0, demand=float("inf"))
|
|
443
|
-
pytest.raises(nx.NetworkXError, nx.network_simplex, G)
|
|
444
|
-
pytest.raises(nx.NetworkXUnfeasible, nx.capacity_scaling, G)
|
|
445
|
-
G.nodes[0]["demand"] = 0
|
|
446
|
-
G.add_node(1, demand=0)
|
|
447
|
-
G.add_edge(0, 1, weight=-float("inf"))
|
|
448
|
-
pytest.raises(nx.NetworkXError, nx.network_simplex, G)
|
|
449
|
-
pytest.raises(nx.NetworkXUnfeasible, nx.capacity_scaling, G)
|
|
450
|
-
G[0][1]["weight"] = 0
|
|
451
|
-
G.add_edge(0, 0, weight=float("inf"))
|
|
452
|
-
pytest.raises(nx.NetworkXError, nx.network_simplex, G)
|
|
453
|
-
# pytest.raises(nx.NetworkXError, nx.capacity_scaling, G)
|
|
454
|
-
G[0][0]["weight"] = 0
|
|
455
|
-
G[0][1]["capacity"] = -1
|
|
456
|
-
pytest.raises(nx.NetworkXUnfeasible, nx.network_simplex, G)
|
|
457
|
-
# pytest.raises(nx.NetworkXUnfeasible, nx.capacity_scaling, G)
|
|
458
|
-
G[0][1]["capacity"] = 0
|
|
459
|
-
G[0][0]["capacity"] = -1
|
|
460
|
-
pytest.raises(nx.NetworkXUnfeasible, nx.network_simplex, G)
|
|
461
|
-
# pytest.raises(nx.NetworkXUnfeasible, nx.capacity_scaling, G)
|
|
462
|
-
|
|
463
|
-
def test_large(self):
|
|
464
|
-
fname = (
|
|
465
|
-
importlib.resources.files("networkx.algorithms.flow.tests")
|
|
466
|
-
/ "netgen-2.gpickle.bz2"
|
|
467
|
-
)
|
|
468
|
-
with bz2.BZ2File(fname, "rb") as f:
|
|
469
|
-
G = pickle.load(f)
|
|
470
|
-
flowCost, flowDict = nx.network_simplex(G)
|
|
471
|
-
assert 6749969302 == flowCost
|
|
472
|
-
assert 6749969302 == nx.cost_of_flow(G, flowDict)
|
|
473
|
-
flowCost, flowDict = nx.capacity_scaling(G)
|
|
474
|
-
assert 6749969302 == flowCost
|
|
475
|
-
assert 6749969302 == nx.cost_of_flow(G, flowDict)
|