okstra 0.107.2 → 0.109.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/package.json +1 -1
- package/runtime/BUILD.json +2 -2
- package/runtime/prompts/lead/okstra-lead-contract.md +1 -1
- package/runtime/prompts/profiles/_common-contract.md +3 -2
- package/runtime/python/okstra_ctl/graphify_cmd.py +225 -0
- package/runtime/python/okstra_ctl/resolve_task_key.py +15 -9
- package/runtime/python/okstra_ctl/session.py +44 -0
- package/runtime/python/okstra_project/__init__.py +2 -0
- package/runtime/python/okstra_project/state.py +36 -0
- package/runtime/python/okstra_token_usage/claude.py +15 -9
- package/runtime/python/okstra_token_usage/cli.py +23 -0
- package/runtime/python/okstra_token_usage/collect.py +163 -4
- package/runtime/python/okstra_vendor/__init__.py +41 -0
- package/runtime/python/okstra_vendor/graphify/.vendored-version +1 -0
- package/runtime/python/okstra_vendor/graphify/__init__.py +28 -0
- package/runtime/python/okstra_vendor/graphify/__main__.py +1371 -0
- package/runtime/python/okstra_vendor/graphify/analyze.py +540 -0
- package/runtime/python/okstra_vendor/graphify/benchmark.py +129 -0
- package/runtime/python/okstra_vendor/graphify/build.py +107 -0
- package/runtime/python/okstra_vendor/graphify/cache.py +169 -0
- package/runtime/python/okstra_vendor/graphify/cluster.py +137 -0
- package/runtime/python/okstra_vendor/graphify/detect.py +510 -0
- package/runtime/python/okstra_vendor/graphify/export.py +1014 -0
- package/runtime/python/okstra_vendor/graphify/extract.py +3277 -0
- package/runtime/python/okstra_vendor/graphify/hooks.py +220 -0
- package/runtime/python/okstra_vendor/graphify/ingest.py +297 -0
- package/runtime/python/okstra_vendor/graphify/manifest.py +4 -0
- package/runtime/python/okstra_vendor/graphify/report.py +175 -0
- package/runtime/python/okstra_vendor/graphify/security.py +203 -0
- package/runtime/python/okstra_vendor/graphify/serve.py +373 -0
- package/runtime/python/okstra_vendor/graphify/skill-aider.md +1184 -0
- package/runtime/python/okstra_vendor/graphify/skill-claw.md +1184 -0
- package/runtime/python/okstra_vendor/graphify/skill-codex.md +1242 -0
- package/runtime/python/okstra_vendor/graphify/skill-copilot.md +1268 -0
- package/runtime/python/okstra_vendor/graphify/skill-droid.md +1239 -0
- package/runtime/python/okstra_vendor/graphify/skill-kiro.md +1183 -0
- package/runtime/python/okstra_vendor/graphify/skill-opencode.md +1238 -0
- package/runtime/python/okstra_vendor/graphify/skill-trae.md +1208 -0
- package/runtime/python/okstra_vendor/graphify/skill-vscode.md +253 -0
- package/runtime/python/okstra_vendor/graphify/skill-windows.md +1245 -0
- package/runtime/python/okstra_vendor/graphify/skill.md +1319 -0
- package/runtime/python/okstra_vendor/graphify/transcribe.py +182 -0
- package/runtime/python/okstra_vendor/graphify/validate.py +72 -0
- package/runtime/python/okstra_vendor/graphify/watch.py +188 -0
- package/runtime/python/okstra_vendor/graphify/wiki.py +214 -0
- package/runtime/python/okstra_vendor/networkx/__init__.py +62 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/__init__.py +134 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/__init__.py +26 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/clique.py +259 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/clustering_coefficient.py +71 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/connectivity.py +412 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/density.py +396 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/distance_measures.py +150 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/dominating_set.py +149 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/kcomponents.py +369 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/matching.py +44 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/maxcut.py +143 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/ramsey.py +53 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/steinertree.py +265 -0
- 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 +41 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_clique.py +112 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_connectivity.py +199 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_density.py +146 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_distance_measures.py +59 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_dominating_set.py +78 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_kcomponents.py +303 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_matching.py +8 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_maxcut.py +94 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_ramsey.py +31 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_steinertree.py +306 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_traveling_salesman.py +1014 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_treewidth.py +274 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_vertex_cover.py +68 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/traveling_salesman.py +1508 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/treewidth.py +255 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/vertex_cover.py +83 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/__init__.py +5 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/connectivity.py +122 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/correlation.py +302 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/mixing.py +255 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/neighbor_degree.py +160 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/pairs.py +127 -0
- 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 +81 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_connectivity.py +143 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_correlation.py +122 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_mixing.py +174 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_neighbor_degree.py +107 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_pairs.py +87 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/asteroidal.py +164 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/__init__.py +88 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/basic.py +322 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/centrality.py +290 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/cluster.py +289 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/covering.py +57 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/edgelist.py +360 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/extendability.py +105 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/generators.py +603 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/link_analysis.py +316 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/matching.py +590 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/matrix.py +232 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/projection.py +526 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/redundancy.py +112 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/spectral.py +69 -0
- 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 +125 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_centrality.py +192 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_cluster.py +84 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_covering.py +33 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_edgelist.py +240 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_extendability.py +334 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_generators.py +407 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_link_analysis.py +218 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_matching.py +327 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_matrix.py +138 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_project.py +409 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_redundancy.py +35 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_spectral_bipartivity.py +80 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/boundary.py +168 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bridges.py +205 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/broadcasting.py +164 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/__init__.py +20 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/betweenness.py +591 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/betweenness_subset.py +236 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/closeness.py +282 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/current_flow_betweenness.py +364 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/current_flow_betweenness_subset.py +227 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/current_flow_closeness.py +96 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/degree_alg.py +150 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/dispersion.py +107 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/eigenvector.py +357 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/flow_matrix.py +130 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/group.py +787 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/harmonic.py +88 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/katz.py +331 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/laplacian.py +150 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/load.py +200 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/percolation.py +128 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/reaching.py +209 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/second_order.py +141 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/subgraph_alg.py +361 -0
- 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 +923 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_betweenness_centrality_subset.py +354 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_closeness_centrality.py +274 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality.py +259 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality_subset.py +147 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_closeness.py +43 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_degree_centrality.py +144 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_dispersion.py +73 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_eigenvector_centrality.py +186 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_group.py +277 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_harmonic_centrality.py +122 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_katz_centrality.py +345 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_laplacian_centrality.py +220 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_load_centrality.py +344 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_percolation_centrality.py +87 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_reaching.py +140 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_second_order_centrality.py +82 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_subgraph.py +110 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_trophic.py +302 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_voterank.py +64 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/trophic.py +181 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/voterank_alg.py +95 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/chains.py +172 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/chordal.py +443 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/clique.py +818 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/cluster.py +732 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/coloring/__init__.py +4 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/coloring/equitable_coloring.py +505 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/coloring/greedy_coloring.py +565 -0
- 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 +863 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/communicability_alg.py +163 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/__init__.py +28 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/asyn_fluid.py +153 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/bipartitions.py +354 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/centrality.py +171 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/community_utils.py +30 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/divisive.py +216 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/kclique.py +79 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/label_propagation.py +338 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/leiden.py +162 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/local.py +220 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/louvain.py +384 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/lukes.py +227 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/modularity_max.py +452 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/quality.py +347 -0
- 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 +147 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_bipartitions.py +157 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_centrality.py +85 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_divisive.py +106 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_kclique.py +91 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_label_propagation.py +241 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_leiden.py +138 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_local.py +76 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_louvain.py +264 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_lukes.py +152 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_modularity_max.py +340 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_quality.py +139 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_utils.py +26 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/__init__.py +6 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/attracting.py +115 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/biconnected.py +394 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/connected.py +282 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/semiconnected.py +71 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/strongly_connected.py +359 -0
- 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 +70 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_biconnected.py +248 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_connected.py +138 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_semiconnected.py +55 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_strongly_connected.py +193 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_weakly_connected.py +96 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/weakly_connected.py +196 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/__init__.py +11 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/connectivity.py +811 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/cuts.py +616 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/disjoint_paths.py +408 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/edge_augmentation.py +1270 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/edge_kcomponents.py +592 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/kcomponents.py +220 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/kcutsets.py +235 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/stoerwagner.py +152 -0
- 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 +421 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_cuts.py +309 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_disjoint_paths.py +249 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_edge_augmentation.py +502 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_edge_kcomponents.py +488 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_kcomponents.py +323 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_kcutsets.py +280 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_stoer_wagner.py +102 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/utils.py +88 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/core.py +588 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/covering.py +142 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/cuts.py +416 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/cycles.py +1234 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/d_separation.py +677 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/dag.py +1392 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/distance_measures.py +1095 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/distance_regular.py +272 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/dominance.py +142 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/dominating.py +268 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/efficiency_measures.py +167 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/euler.py +470 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/__init__.py +11 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/boykovkolmogorov.py +370 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/capacityscaling.py +407 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/dinitz_alg.py +238 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/edmondskarp.py +241 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/gomory_hu.py +178 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/maxflow.py +611 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/mincost.py +356 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/networksimplex.py +662 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/preflowpush.py +425 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/shortestaugmentingpath.py +300 -0
- 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 +128 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_maxflow.py +573 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_maxflow_large_graph.py +155 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_mincost.py +475 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_networksimplex.py +481 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/wlm3.gpickle.bz2 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/utils.py +194 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/graph_hashing.py +435 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/graphical.py +483 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/hierarchy.py +57 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/hybrid.py +196 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isolate.py +107 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/__init__.py +7 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/ismags.py +1306 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/isomorph.py +336 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/isomorphvf2.py +1262 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/matchhelpers.py +352 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/temporalisomorphvf2.py +308 -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 +719 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_isomorphism.py +103 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_isomorphvf2.py +490 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_match_helpers.py +64 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_temporalisomorphvf2.py +212 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_tree_isomorphism.py +202 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2pp.py +1655 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2pp_helpers.py +3118 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2userfunc.py +196 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tree_isomorphism.py +264 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/vf2pp.py +1102 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/vf2userfunc.py +192 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/__init__.py +2 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/hits_alg.py +337 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/pagerank_alg.py +498 -0
- 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 +77 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/test_pagerank.py +213 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/link_prediction.py +687 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/lowest_common_ancestors.py +280 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/matching.py +1148 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/minors/__init__.py +27 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/minors/contraction.py +738 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/minors/tests/test_contraction.py +544 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/mis.py +78 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/moral.py +59 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/node_classification.py +219 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/non_randomness.py +155 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/__init__.py +4 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/all.py +324 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/binary.py +468 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/product.py +633 -0
- 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 +328 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_binary.py +451 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_product.py +491 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_unary.py +55 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/unary.py +77 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/perfect_graph.py +73 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/planar_drawing.py +464 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/planarity.py +1463 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/polynomials.py +306 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/reciprocity.py +98 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/regular.py +167 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/richclub.py +138 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/__init__.py +5 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/astar.py +239 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/dense.py +264 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/generic.py +716 -0
- 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 +254 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_dense.py +212 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_dense_numpy.py +88 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_generic.py +511 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_unweighted.py +149 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_weighted.py +983 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/unweighted.py +625 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/weighted.py +2542 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/similarity.py +2107 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/simple_paths.py +966 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/smallworld.py +404 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/smetric.py +30 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/sparsifiers.py +296 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/structuralholes.py +374 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/summarization.py +564 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/swap.py +406 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_asteroidal.py +23 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_boundary.py +154 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_bridges.py +144 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_broadcasting.py +109 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_chains.py +136 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_chordal.py +129 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_clique.py +300 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cluster.py +678 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_communicability.py +80 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_core.py +266 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_covering.py +85 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cuts.py +171 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cycles.py +984 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_d_separation.py +340 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dag.py +835 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_distance_measures.py +831 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_distance_regular.py +85 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dominance.py +299 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dominating.py +115 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_efficiency.py +58 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_euler.py +314 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_graph_hashing.py +872 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_graphical.py +163 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_hierarchy.py +46 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_hybrid.py +24 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_isolate.py +26 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_link_prediction.py +615 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_lowest_common_ancestors.py +459 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_matching.py +556 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_max_weight_clique.py +179 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_mis.py +62 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_moral.py +15 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_node_classification.py +140 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_non_randomness.py +60 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_perfect_graph.py +27 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_planar_drawing.py +274 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_planarity.py +556 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_polynomials.py +57 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_reciprocity.py +37 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_regular.py +88 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_richclub.py +149 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_similarity.py +1158 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_simple_paths.py +803 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_smallworld.py +76 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_smetric.py +8 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_sparsifiers.py +138 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_structuralholes.py +191 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_summarization.py +642 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_swap.py +179 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_threshold.py +270 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_time_dependent.py +431 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_tournament.py +161 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_triads.py +248 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_vitality.py +41 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_voronoi.py +103 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_walks.py +54 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_wiener.py +157 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/threshold.py +981 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/time_dependent.py +142 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tournament.py +406 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/__init__.py +5 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/beamsearch.py +90 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/breadth_first_search.py +576 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/depth_first_search.py +529 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/edgebfs.py +185 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/edgedfs.py +182 -0
- 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 +25 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_bfs.py +203 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_dfs.py +307 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_edgebfs.py +147 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_edgedfs.py +131 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/__init__.py +7 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/branchings.py +1042 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/coding.py +413 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/decomposition.py +88 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/distance_measures.py +219 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/mst.py +1281 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/operations.py +106 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/recognition.py +273 -0
- 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 +624 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_coding.py +114 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_decomposition.py +79 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_distance_measures.py +99 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_mst.py +934 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_operations.py +53 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_recognition.py +174 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/triads.py +500 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/vitality.py +76 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/voronoi.py +86 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/walks.py +77 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/wiener.py +278 -0
- package/runtime/python/okstra_vendor/networkx/classes/__init__.py +13 -0
- package/runtime/python/okstra_vendor/networkx/classes/coreviews.py +435 -0
- package/runtime/python/okstra_vendor/networkx/classes/digraph.py +1363 -0
- package/runtime/python/okstra_vendor/networkx/classes/filters.py +95 -0
- package/runtime/python/okstra_vendor/networkx/classes/function.py +1549 -0
- package/runtime/python/okstra_vendor/networkx/classes/graph.py +2082 -0
- package/runtime/python/okstra_vendor/networkx/classes/graphviews.py +269 -0
- package/runtime/python/okstra_vendor/networkx/classes/multidigraph.py +977 -0
- package/runtime/python/okstra_vendor/networkx/classes/multigraph.py +1294 -0
- package/runtime/python/okstra_vendor/networkx/classes/reportviews.py +1447 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/dispatch_interface.py +192 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/historical_tests.py +476 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_coreviews.py +362 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_digraph.py +331 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_digraph_historical.py +110 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_filters.py +177 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_function.py +1045 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_graph.py +950 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_graph_historical.py +12 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_graphviews.py +349 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_multidigraph.py +459 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_multigraph.py +528 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_reportviews.py +1421 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_special.py +131 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_subgraphviews.py +371 -0
- package/runtime/python/okstra_vendor/networkx/conftest.py +261 -0
- package/runtime/python/okstra_vendor/networkx/convert.py +502 -0
- package/runtime/python/okstra_vendor/networkx/convert_matrix.py +1314 -0
- package/runtime/python/okstra_vendor/networkx/drawing/__init__.py +7 -0
- package/runtime/python/okstra_vendor/networkx/drawing/layout.py +2036 -0
- package/runtime/python/okstra_vendor/networkx/drawing/nx_agraph.py +470 -0
- package/runtime/python/okstra_vendor/networkx/drawing/nx_latex.py +570 -0
- package/runtime/python/okstra_vendor/networkx/drawing/nx_pydot.py +361 -0
- package/runtime/python/okstra_vendor/networkx/drawing/nx_pylab.py +2978 -0
- 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 +237 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_image_comparison_pylab_mpl.py +229 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_latex.py +285 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_layout.py +631 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_pydot.py +146 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_pylab.py +1582 -0
- package/runtime/python/okstra_vendor/networkx/exception.py +131 -0
- package/runtime/python/okstra_vendor/networkx/generators/__init__.py +34 -0
- package/runtime/python/okstra_vendor/networkx/generators/atlas.dat.gz +0 -0
- package/runtime/python/okstra_vendor/networkx/generators/atlas.py +227 -0
- package/runtime/python/okstra_vendor/networkx/generators/classic.py +1091 -0
- package/runtime/python/okstra_vendor/networkx/generators/cographs.py +68 -0
- package/runtime/python/okstra_vendor/networkx/generators/community.py +1070 -0
- package/runtime/python/okstra_vendor/networkx/generators/degree_seq.py +886 -0
- package/runtime/python/okstra_vendor/networkx/generators/directed.py +572 -0
- package/runtime/python/okstra_vendor/networkx/generators/duplication.py +174 -0
- package/runtime/python/okstra_vendor/networkx/generators/ego.py +66 -0
- package/runtime/python/okstra_vendor/networkx/generators/expanders.py +499 -0
- package/runtime/python/okstra_vendor/networkx/generators/geometric.py +1037 -0
- package/runtime/python/okstra_vendor/networkx/generators/harary_graph.py +163 -0
- package/runtime/python/okstra_vendor/networkx/generators/internet_as_graphs.py +443 -0
- package/runtime/python/okstra_vendor/networkx/generators/intersection.py +125 -0
- package/runtime/python/okstra_vendor/networkx/generators/interval_graph.py +70 -0
- package/runtime/python/okstra_vendor/networkx/generators/joint_degree_seq.py +664 -0
- package/runtime/python/okstra_vendor/networkx/generators/lattice.py +405 -0
- package/runtime/python/okstra_vendor/networkx/generators/line.py +501 -0
- package/runtime/python/okstra_vendor/networkx/generators/mycielski.py +110 -0
- package/runtime/python/okstra_vendor/networkx/generators/nonisomorphic_trees.py +259 -0
- package/runtime/python/okstra_vendor/networkx/generators/random_clustered.py +117 -0
- package/runtime/python/okstra_vendor/networkx/generators/random_graphs.py +1416 -0
- package/runtime/python/okstra_vendor/networkx/generators/small.py +1070 -0
- package/runtime/python/okstra_vendor/networkx/generators/social.py +554 -0
- package/runtime/python/okstra_vendor/networkx/generators/spectral_graph_forge.py +120 -0
- package/runtime/python/okstra_vendor/networkx/generators/stochastic.py +54 -0
- package/runtime/python/okstra_vendor/networkx/generators/sudoku.py +131 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_atlas.py +75 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_classic.py +642 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_cographs.py +20 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_community.py +362 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_degree_seq.py +224 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_directed.py +189 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_duplication.py +103 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_ego.py +39 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_expanders.py +182 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_geometric.py +488 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_harary_graph.py +133 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_internet_as_graphs.py +221 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_intersection.py +28 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_interval_graph.py +144 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_joint_degree_seq.py +125 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_lattice.py +264 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_line.py +316 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_mycielski.py +30 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_nonisomorphic_trees.py +82 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_random_clustered.py +33 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_random_graphs.py +495 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_small.py +220 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_spectral_graph_forge.py +49 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_stochastic.py +72 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_sudoku.py +92 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_time_series.py +64 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_trees.py +195 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_triads.py +15 -0
- package/runtime/python/okstra_vendor/networkx/generators/time_series.py +74 -0
- package/runtime/python/okstra_vendor/networkx/generators/trees.py +1070 -0
- package/runtime/python/okstra_vendor/networkx/generators/triads.py +94 -0
- package/runtime/python/okstra_vendor/networkx/lazy_imports.py +188 -0
- package/runtime/python/okstra_vendor/networkx/linalg/__init__.py +13 -0
- package/runtime/python/okstra_vendor/networkx/linalg/algebraicconnectivity.py +650 -0
- package/runtime/python/okstra_vendor/networkx/linalg/attrmatrix.py +466 -0
- package/runtime/python/okstra_vendor/networkx/linalg/bethehessianmatrix.py +77 -0
- package/runtime/python/okstra_vendor/networkx/linalg/graphmatrix.py +168 -0
- package/runtime/python/okstra_vendor/networkx/linalg/laplacianmatrix.py +512 -0
- package/runtime/python/okstra_vendor/networkx/linalg/modularitymatrix.py +166 -0
- package/runtime/python/okstra_vendor/networkx/linalg/spectrum.py +186 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_algebraic_connectivity.py +400 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_attrmatrix.py +108 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_bethehessian.py +40 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_graphmatrix.py +275 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_laplacian.py +334 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_modularity.py +86 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_spectrum.py +70 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/__init__.py +17 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/adjlist.py +330 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/edgelist.py +489 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/gexf.py +1084 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/gml.py +879 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/graph6.py +427 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/graphml.py +1053 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/__init__.py +19 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/adjacency.py +156 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/cytoscape.py +190 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/node_link.py +261 -0
- 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 +78 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_cytoscape.py +78 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_node_link.py +109 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_tree.py +48 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tree.py +137 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/leda.py +108 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/multiline_adjlist.py +393 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/p2g.py +113 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/pajek.py +286 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/sparse6.py +379 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_adjlist.py +354 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_edgelist.py +318 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_gexf.py +612 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_gml.py +744 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_graph6.py +181 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_graphml.py +1531 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_leda.py +30 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_p2g.py +63 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_pajek.py +128 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_sparse6.py +166 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_text.py +1742 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/text.py +851 -0
- package/runtime/python/okstra_vendor/networkx/relabel.py +285 -0
- package/runtime/python/okstra_vendor/networkx/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_all_random_functions.py +248 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_convert.py +321 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_convert_numpy.py +531 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_convert_pandas.py +349 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_convert_scipy.py +281 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_exceptions.py +40 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_import.py +11 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_lazy_imports.py +96 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_relabel.py +349 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_removed_functions_exception_messages.py +8 -0
- package/runtime/python/okstra_vendor/networkx/utils/__init__.py +8 -0
- package/runtime/python/okstra_vendor/networkx/utils/backends.py +2171 -0
- package/runtime/python/okstra_vendor/networkx/utils/configs.py +396 -0
- package/runtime/python/okstra_vendor/networkx/utils/decorators.py +1233 -0
- package/runtime/python/okstra_vendor/networkx/utils/heaps.py +338 -0
- package/runtime/python/okstra_vendor/networkx/utils/mapped_queue.py +297 -0
- package/runtime/python/okstra_vendor/networkx/utils/misc.py +703 -0
- package/runtime/python/okstra_vendor/networkx/utils/random_sequence.py +198 -0
- package/runtime/python/okstra_vendor/networkx/utils/rcm.py +159 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test__init.py +11 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_backends.py +225 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_config.py +263 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_decorators.py +510 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_heaps.py +131 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_mapped_queue.py +268 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_misc.py +393 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_random_sequence.py +53 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_rcm.py +63 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_unionfind.py +55 -0
- package/runtime/python/okstra_vendor/networkx/utils/union_find.py +106 -0
- package/runtime/skills/okstra-graphify/SKILL.md +161 -0
- package/runtime/skills/okstra-inspect/SKILL.md +17 -9
- package/runtime/templates/reports/settings.template.json +4 -0
- package/runtime/validators/forbidden_actions.py +8 -2
- package/runtime/validators/validate_session_conformance.py +26 -5
- package/src/cli-registry.mjs +7 -0
- package/src/commands/graphify.mjs +32 -0
- package/src/commands/lifecycle/doctor.mjs +9 -0
- package/src/lib/skill-catalog.mjs +1 -0
package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_maxflow_large_graph.py
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
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
|
|
@@ -0,0 +1,475 @@
|
|
|
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)
|