okstra 0.130.4 → 0.131.1
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.md +0 -1
- package/docs/architecture.md +2 -2
- package/docs/cli.md +1 -1
- package/docs/for-ai/README.md +0 -2
- package/docs/for-ai/skills/okstra-run.md +13 -2
- package/docs/for-ai/skills/okstra-setup.md +4 -1
- package/docs/project-structure-overview.md +5 -4
- package/docs/task-process/implementation-planning.md +13 -0
- package/docs/task-process/implementation.md +17 -2
- package/package.json +1 -1
- package/runtime/BUILD.json +2 -2
- package/runtime/agents/workers/report-writer-worker.md +7 -0
- package/runtime/bin/lib/okstra/usage.sh +4 -4
- package/runtime/prompts/lead/okstra-lead-contract.md +2 -2
- package/runtime/prompts/lead/plan-body-verification.md +26 -5
- package/runtime/prompts/lead/report-writer.md +6 -2
- package/runtime/prompts/profiles/_common-contract.md +2 -1
- package/runtime/prompts/profiles/_implementation-deliverable.md +6 -1
- package/runtime/prompts/profiles/_implementation-executor.md +2 -2
- package/runtime/prompts/profiles/_implementation-verifier.md +33 -10
- package/runtime/prompts/profiles/final-verification.md +21 -6
- package/runtime/prompts/profiles/implementation-planning.md +16 -4
- package/runtime/python/okstra_ctl/codex_dispatch.py +31 -0
- package/runtime/python/okstra_ctl/conformance.py +49 -11
- package/runtime/python/okstra_ctl/report_finalize.py +52 -1
- package/runtime/python/okstra_ctl/run.py +15 -3
- package/runtime/python/okstra_ctl/worker_prompt_contract.py +14 -6
- package/runtime/python/okstra_ctl/worker_prompt_policy.py +19 -1
- package/runtime/python/okstra_vendor/__init__.py +0 -44
- package/runtime/schemas/final-report-v1.0.schema.json +99 -5
- package/runtime/skills/okstra-run/SKILL.md +11 -4
- package/runtime/skills/okstra-setup/SKILL.md +3 -2
- package/runtime/skills/okstra-setup/references/project-config.md +16 -7
- package/runtime/templates/reports/final-report.template.md +15 -9
- package/runtime/templates/reports/i18n/en.json +1 -0
- package/runtime/templates/reports/i18n/ko.json +1 -0
- package/runtime/validators/lib/fixtures.sh +6 -0
- package/runtime/validators/validate-run.py +2019 -96
- package/src/cli-registry.mjs +0 -7
- package/src/commands/lifecycle/doctor.mjs +0 -9
- package/src/lib/skill-catalog.mjs +0 -1
- package/docs/for-ai/skills/okstra-graphify.md +0 -64
- package/runtime/python/okstra_ctl/graphify_cmd.py +0 -225
- package/runtime/python/okstra_vendor/graphify/.vendored-version +0 -1
- package/runtime/python/okstra_vendor/graphify/__init__.py +0 -28
- package/runtime/python/okstra_vendor/graphify/__main__.py +0 -1371
- package/runtime/python/okstra_vendor/graphify/analyze.py +0 -540
- package/runtime/python/okstra_vendor/graphify/benchmark.py +0 -129
- package/runtime/python/okstra_vendor/graphify/build.py +0 -107
- package/runtime/python/okstra_vendor/graphify/cache.py +0 -169
- package/runtime/python/okstra_vendor/graphify/cluster.py +0 -137
- package/runtime/python/okstra_vendor/graphify/detect.py +0 -510
- package/runtime/python/okstra_vendor/graphify/export.py +0 -1014
- package/runtime/python/okstra_vendor/graphify/extract.py +0 -3277
- package/runtime/python/okstra_vendor/graphify/hooks.py +0 -220
- package/runtime/python/okstra_vendor/graphify/ingest.py +0 -297
- package/runtime/python/okstra_vendor/graphify/manifest.py +0 -4
- package/runtime/python/okstra_vendor/graphify/report.py +0 -175
- package/runtime/python/okstra_vendor/graphify/security.py +0 -203
- package/runtime/python/okstra_vendor/graphify/serve.py +0 -373
- package/runtime/python/okstra_vendor/graphify/skill-aider.md +0 -1184
- package/runtime/python/okstra_vendor/graphify/skill-claw.md +0 -1184
- package/runtime/python/okstra_vendor/graphify/skill-codex.md +0 -1242
- package/runtime/python/okstra_vendor/graphify/skill-copilot.md +0 -1268
- package/runtime/python/okstra_vendor/graphify/skill-droid.md +0 -1239
- package/runtime/python/okstra_vendor/graphify/skill-kiro.md +0 -1183
- package/runtime/python/okstra_vendor/graphify/skill-opencode.md +0 -1238
- package/runtime/python/okstra_vendor/graphify/skill-trae.md +0 -1208
- package/runtime/python/okstra_vendor/graphify/skill-vscode.md +0 -253
- package/runtime/python/okstra_vendor/graphify/skill-windows.md +0 -1245
- package/runtime/python/okstra_vendor/graphify/skill.md +0 -1319
- package/runtime/python/okstra_vendor/graphify/transcribe.py +0 -182
- package/runtime/python/okstra_vendor/graphify/validate.py +0 -72
- package/runtime/python/okstra_vendor/graphify/watch.py +0 -188
- package/runtime/python/okstra_vendor/graphify/wiki.py +0 -214
- package/runtime/python/okstra_vendor/networkx/__init__.py +0 -62
- package/runtime/python/okstra_vendor/networkx/algorithms/__init__.py +0 -134
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/__init__.py +0 -26
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/clique.py +0 -259
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/clustering_coefficient.py +0 -71
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/connectivity.py +0 -412
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/density.py +0 -396
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/distance_measures.py +0 -150
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/dominating_set.py +0 -149
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/kcomponents.py +0 -369
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/matching.py +0 -44
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/maxcut.py +0 -143
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/ramsey.py +0 -53
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/steinertree.py +0 -265
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/traveling_salesman.py +0 -1508
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/treewidth.py +0 -255
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/vertex_cover.py +0 -83
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/__init__.py +0 -5
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/connectivity.py +0 -122
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/correlation.py +0 -302
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/mixing.py +0 -255
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/neighbor_degree.py +0 -160
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/pairs.py +0 -127
- package/runtime/python/okstra_vendor/networkx/algorithms/asteroidal.py +0 -164
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/__init__.py +0 -88
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/basic.py +0 -322
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/centrality.py +0 -290
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/cluster.py +0 -289
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/covering.py +0 -57
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/edgelist.py +0 -360
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/extendability.py +0 -105
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/generators.py +0 -603
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/link_analysis.py +0 -316
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/matching.py +0 -590
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/matrix.py +0 -232
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/projection.py +0 -526
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/redundancy.py +0 -112
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/spectral.py +0 -69
- package/runtime/python/okstra_vendor/networkx/algorithms/boundary.py +0 -168
- package/runtime/python/okstra_vendor/networkx/algorithms/bridges.py +0 -205
- package/runtime/python/okstra_vendor/networkx/algorithms/broadcasting.py +0 -164
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/__init__.py +0 -20
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/betweenness.py +0 -591
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/betweenness_subset.py +0 -236
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/closeness.py +0 -282
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/current_flow_betweenness.py +0 -364
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/current_flow_betweenness_subset.py +0 -227
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/current_flow_closeness.py +0 -96
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/degree_alg.py +0 -150
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/dispersion.py +0 -107
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/eigenvector.py +0 -357
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/flow_matrix.py +0 -130
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/group.py +0 -787
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/harmonic.py +0 -88
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/katz.py +0 -331
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/laplacian.py +0 -150
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/load.py +0 -200
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/percolation.py +0 -128
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/reaching.py +0 -209
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/second_order.py +0 -141
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/subgraph_alg.py +0 -361
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/trophic.py +0 -181
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/voterank_alg.py +0 -95
- package/runtime/python/okstra_vendor/networkx/algorithms/chains.py +0 -172
- package/runtime/python/okstra_vendor/networkx/algorithms/chordal.py +0 -443
- package/runtime/python/okstra_vendor/networkx/algorithms/clique.py +0 -818
- package/runtime/python/okstra_vendor/networkx/algorithms/cluster.py +0 -732
- package/runtime/python/okstra_vendor/networkx/algorithms/coloring/__init__.py +0 -4
- package/runtime/python/okstra_vendor/networkx/algorithms/coloring/equitable_coloring.py +0 -505
- package/runtime/python/okstra_vendor/networkx/algorithms/coloring/greedy_coloring.py +0 -565
- package/runtime/python/okstra_vendor/networkx/algorithms/communicability_alg.py +0 -163
- package/runtime/python/okstra_vendor/networkx/algorithms/community/__init__.py +0 -28
- package/runtime/python/okstra_vendor/networkx/algorithms/community/asyn_fluid.py +0 -153
- package/runtime/python/okstra_vendor/networkx/algorithms/community/bipartitions.py +0 -354
- package/runtime/python/okstra_vendor/networkx/algorithms/community/centrality.py +0 -171
- package/runtime/python/okstra_vendor/networkx/algorithms/community/community_utils.py +0 -30
- package/runtime/python/okstra_vendor/networkx/algorithms/community/divisive.py +0 -216
- package/runtime/python/okstra_vendor/networkx/algorithms/community/kclique.py +0 -79
- package/runtime/python/okstra_vendor/networkx/algorithms/community/label_propagation.py +0 -338
- package/runtime/python/okstra_vendor/networkx/algorithms/community/leiden.py +0 -162
- package/runtime/python/okstra_vendor/networkx/algorithms/community/local.py +0 -220
- package/runtime/python/okstra_vendor/networkx/algorithms/community/louvain.py +0 -384
- package/runtime/python/okstra_vendor/networkx/algorithms/community/lukes.py +0 -227
- package/runtime/python/okstra_vendor/networkx/algorithms/community/modularity_max.py +0 -452
- package/runtime/python/okstra_vendor/networkx/algorithms/community/quality.py +0 -347
- package/runtime/python/okstra_vendor/networkx/algorithms/components/__init__.py +0 -6
- package/runtime/python/okstra_vendor/networkx/algorithms/components/attracting.py +0 -115
- package/runtime/python/okstra_vendor/networkx/algorithms/components/biconnected.py +0 -394
- package/runtime/python/okstra_vendor/networkx/algorithms/components/connected.py +0 -282
- package/runtime/python/okstra_vendor/networkx/algorithms/components/semiconnected.py +0 -71
- package/runtime/python/okstra_vendor/networkx/algorithms/components/strongly_connected.py +0 -359
- package/runtime/python/okstra_vendor/networkx/algorithms/components/weakly_connected.py +0 -196
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/__init__.py +0 -11
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/connectivity.py +0 -811
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/cuts.py +0 -616
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/disjoint_paths.py +0 -408
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/edge_augmentation.py +0 -1270
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/edge_kcomponents.py +0 -592
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/kcomponents.py +0 -220
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/kcutsets.py +0 -235
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/stoerwagner.py +0 -152
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/utils.py +0 -88
- package/runtime/python/okstra_vendor/networkx/algorithms/core.py +0 -588
- package/runtime/python/okstra_vendor/networkx/algorithms/covering.py +0 -142
- package/runtime/python/okstra_vendor/networkx/algorithms/cuts.py +0 -416
- package/runtime/python/okstra_vendor/networkx/algorithms/cycles.py +0 -1234
- package/runtime/python/okstra_vendor/networkx/algorithms/d_separation.py +0 -677
- package/runtime/python/okstra_vendor/networkx/algorithms/dag.py +0 -1392
- package/runtime/python/okstra_vendor/networkx/algorithms/distance_measures.py +0 -1095
- package/runtime/python/okstra_vendor/networkx/algorithms/distance_regular.py +0 -272
- package/runtime/python/okstra_vendor/networkx/algorithms/dominance.py +0 -142
- package/runtime/python/okstra_vendor/networkx/algorithms/dominating.py +0 -268
- package/runtime/python/okstra_vendor/networkx/algorithms/efficiency_measures.py +0 -167
- package/runtime/python/okstra_vendor/networkx/algorithms/euler.py +0 -470
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/__init__.py +0 -11
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/boykovkolmogorov.py +0 -370
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/capacityscaling.py +0 -407
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/dinitz_alg.py +0 -238
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/edmondskarp.py +0 -241
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/gomory_hu.py +0 -178
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/maxflow.py +0 -611
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/mincost.py +0 -356
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/networksimplex.py +0 -662
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/preflowpush.py +0 -425
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/shortestaugmentingpath.py +0 -300
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/utils.py +0 -194
- package/runtime/python/okstra_vendor/networkx/algorithms/graph_hashing.py +0 -435
- package/runtime/python/okstra_vendor/networkx/algorithms/graphical.py +0 -483
- package/runtime/python/okstra_vendor/networkx/algorithms/hierarchy.py +0 -57
- package/runtime/python/okstra_vendor/networkx/algorithms/hybrid.py +0 -196
- package/runtime/python/okstra_vendor/networkx/algorithms/isolate.py +0 -107
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/__init__.py +0 -7
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/ismags.py +0 -1306
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/isomorph.py +0 -336
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/isomorphvf2.py +0 -1262
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/matchhelpers.py +0 -352
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/temporalisomorphvf2.py +0 -308
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tree_isomorphism.py +0 -264
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/vf2pp.py +0 -1102
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/vf2userfunc.py +0 -192
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/__init__.py +0 -2
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/hits_alg.py +0 -337
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/pagerank_alg.py +0 -498
- package/runtime/python/okstra_vendor/networkx/algorithms/link_prediction.py +0 -687
- package/runtime/python/okstra_vendor/networkx/algorithms/lowest_common_ancestors.py +0 -280
- package/runtime/python/okstra_vendor/networkx/algorithms/matching.py +0 -1148
- package/runtime/python/okstra_vendor/networkx/algorithms/minors/__init__.py +0 -27
- package/runtime/python/okstra_vendor/networkx/algorithms/minors/contraction.py +0 -738
- package/runtime/python/okstra_vendor/networkx/algorithms/mis.py +0 -78
- package/runtime/python/okstra_vendor/networkx/algorithms/moral.py +0 -59
- package/runtime/python/okstra_vendor/networkx/algorithms/node_classification.py +0 -219
- package/runtime/python/okstra_vendor/networkx/algorithms/non_randomness.py +0 -155
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/__init__.py +0 -4
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/all.py +0 -324
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/binary.py +0 -468
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/product.py +0 -633
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/unary.py +0 -77
- package/runtime/python/okstra_vendor/networkx/algorithms/perfect_graph.py +0 -73
- package/runtime/python/okstra_vendor/networkx/algorithms/planar_drawing.py +0 -464
- package/runtime/python/okstra_vendor/networkx/algorithms/planarity.py +0 -1463
- package/runtime/python/okstra_vendor/networkx/algorithms/polynomials.py +0 -306
- package/runtime/python/okstra_vendor/networkx/algorithms/reciprocity.py +0 -98
- package/runtime/python/okstra_vendor/networkx/algorithms/regular.py +0 -167
- package/runtime/python/okstra_vendor/networkx/algorithms/richclub.py +0 -138
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/__init__.py +0 -5
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/astar.py +0 -239
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/dense.py +0 -264
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/generic.py +0 -716
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/unweighted.py +0 -625
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/weighted.py +0 -2542
- package/runtime/python/okstra_vendor/networkx/algorithms/similarity.py +0 -2107
- package/runtime/python/okstra_vendor/networkx/algorithms/simple_paths.py +0 -966
- package/runtime/python/okstra_vendor/networkx/algorithms/smallworld.py +0 -404
- package/runtime/python/okstra_vendor/networkx/algorithms/smetric.py +0 -30
- package/runtime/python/okstra_vendor/networkx/algorithms/sparsifiers.py +0 -296
- package/runtime/python/okstra_vendor/networkx/algorithms/structuralholes.py +0 -374
- package/runtime/python/okstra_vendor/networkx/algorithms/summarization.py +0 -564
- package/runtime/python/okstra_vendor/networkx/algorithms/swap.py +0 -406
- package/runtime/python/okstra_vendor/networkx/algorithms/threshold.py +0 -981
- package/runtime/python/okstra_vendor/networkx/algorithms/time_dependent.py +0 -142
- package/runtime/python/okstra_vendor/networkx/algorithms/tournament.py +0 -406
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/__init__.py +0 -5
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/beamsearch.py +0 -90
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/breadth_first_search.py +0 -576
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/depth_first_search.py +0 -529
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/edgebfs.py +0 -185
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/edgedfs.py +0 -182
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/__init__.py +0 -7
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/branchings.py +0 -1042
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/coding.py +0 -413
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/decomposition.py +0 -88
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/distance_measures.py +0 -219
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/mst.py +0 -1281
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/operations.py +0 -106
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/recognition.py +0 -273
- package/runtime/python/okstra_vendor/networkx/algorithms/triads.py +0 -500
- package/runtime/python/okstra_vendor/networkx/algorithms/vitality.py +0 -76
- package/runtime/python/okstra_vendor/networkx/algorithms/voronoi.py +0 -86
- package/runtime/python/okstra_vendor/networkx/algorithms/walks.py +0 -77
- package/runtime/python/okstra_vendor/networkx/algorithms/wiener.py +0 -278
- package/runtime/python/okstra_vendor/networkx/classes/__init__.py +0 -13
- package/runtime/python/okstra_vendor/networkx/classes/coreviews.py +0 -435
- package/runtime/python/okstra_vendor/networkx/classes/digraph.py +0 -1363
- package/runtime/python/okstra_vendor/networkx/classes/filters.py +0 -95
- package/runtime/python/okstra_vendor/networkx/classes/function.py +0 -1549
- package/runtime/python/okstra_vendor/networkx/classes/graph.py +0 -2082
- package/runtime/python/okstra_vendor/networkx/classes/graphviews.py +0 -269
- package/runtime/python/okstra_vendor/networkx/classes/multidigraph.py +0 -977
- package/runtime/python/okstra_vendor/networkx/classes/multigraph.py +0 -1294
- package/runtime/python/okstra_vendor/networkx/classes/reportviews.py +0 -1447
- package/runtime/python/okstra_vendor/networkx/convert.py +0 -502
- package/runtime/python/okstra_vendor/networkx/convert_matrix.py +0 -1314
- package/runtime/python/okstra_vendor/networkx/drawing/__init__.py +0 -7
- package/runtime/python/okstra_vendor/networkx/drawing/layout.py +0 -2036
- package/runtime/python/okstra_vendor/networkx/drawing/nx_agraph.py +0 -470
- package/runtime/python/okstra_vendor/networkx/drawing/nx_latex.py +0 -570
- package/runtime/python/okstra_vendor/networkx/drawing/nx_pydot.py +0 -361
- package/runtime/python/okstra_vendor/networkx/drawing/nx_pylab.py +0 -2978
- package/runtime/python/okstra_vendor/networkx/exception.py +0 -131
- package/runtime/python/okstra_vendor/networkx/generators/__init__.py +0 -34
- package/runtime/python/okstra_vendor/networkx/generators/atlas.dat.gz +0 -0
- package/runtime/python/okstra_vendor/networkx/generators/atlas.py +0 -227
- package/runtime/python/okstra_vendor/networkx/generators/classic.py +0 -1091
- package/runtime/python/okstra_vendor/networkx/generators/cographs.py +0 -68
- package/runtime/python/okstra_vendor/networkx/generators/community.py +0 -1070
- package/runtime/python/okstra_vendor/networkx/generators/degree_seq.py +0 -886
- package/runtime/python/okstra_vendor/networkx/generators/directed.py +0 -572
- package/runtime/python/okstra_vendor/networkx/generators/duplication.py +0 -174
- package/runtime/python/okstra_vendor/networkx/generators/ego.py +0 -66
- package/runtime/python/okstra_vendor/networkx/generators/expanders.py +0 -499
- package/runtime/python/okstra_vendor/networkx/generators/geometric.py +0 -1037
- package/runtime/python/okstra_vendor/networkx/generators/harary_graph.py +0 -163
- package/runtime/python/okstra_vendor/networkx/generators/internet_as_graphs.py +0 -443
- package/runtime/python/okstra_vendor/networkx/generators/intersection.py +0 -125
- package/runtime/python/okstra_vendor/networkx/generators/interval_graph.py +0 -70
- package/runtime/python/okstra_vendor/networkx/generators/joint_degree_seq.py +0 -664
- package/runtime/python/okstra_vendor/networkx/generators/lattice.py +0 -405
- package/runtime/python/okstra_vendor/networkx/generators/line.py +0 -501
- package/runtime/python/okstra_vendor/networkx/generators/mycielski.py +0 -110
- package/runtime/python/okstra_vendor/networkx/generators/nonisomorphic_trees.py +0 -259
- package/runtime/python/okstra_vendor/networkx/generators/random_clustered.py +0 -117
- package/runtime/python/okstra_vendor/networkx/generators/random_graphs.py +0 -1416
- package/runtime/python/okstra_vendor/networkx/generators/small.py +0 -1070
- package/runtime/python/okstra_vendor/networkx/generators/social.py +0 -554
- package/runtime/python/okstra_vendor/networkx/generators/spectral_graph_forge.py +0 -120
- package/runtime/python/okstra_vendor/networkx/generators/stochastic.py +0 -54
- package/runtime/python/okstra_vendor/networkx/generators/sudoku.py +0 -131
- package/runtime/python/okstra_vendor/networkx/generators/time_series.py +0 -74
- package/runtime/python/okstra_vendor/networkx/generators/trees.py +0 -1070
- package/runtime/python/okstra_vendor/networkx/generators/triads.py +0 -94
- package/runtime/python/okstra_vendor/networkx/lazy_imports.py +0 -188
- package/runtime/python/okstra_vendor/networkx/linalg/__init__.py +0 -13
- package/runtime/python/okstra_vendor/networkx/linalg/algebraicconnectivity.py +0 -650
- package/runtime/python/okstra_vendor/networkx/linalg/attrmatrix.py +0 -466
- package/runtime/python/okstra_vendor/networkx/linalg/bethehessianmatrix.py +0 -77
- package/runtime/python/okstra_vendor/networkx/linalg/graphmatrix.py +0 -168
- package/runtime/python/okstra_vendor/networkx/linalg/laplacianmatrix.py +0 -512
- package/runtime/python/okstra_vendor/networkx/linalg/modularitymatrix.py +0 -166
- package/runtime/python/okstra_vendor/networkx/linalg/spectrum.py +0 -186
- package/runtime/python/okstra_vendor/networkx/readwrite/__init__.py +0 -17
- package/runtime/python/okstra_vendor/networkx/readwrite/adjlist.py +0 -330
- package/runtime/python/okstra_vendor/networkx/readwrite/edgelist.py +0 -489
- package/runtime/python/okstra_vendor/networkx/readwrite/gexf.py +0 -1084
- package/runtime/python/okstra_vendor/networkx/readwrite/gml.py +0 -879
- package/runtime/python/okstra_vendor/networkx/readwrite/graph6.py +0 -427
- package/runtime/python/okstra_vendor/networkx/readwrite/graphml.py +0 -1053
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/__init__.py +0 -19
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/adjacency.py +0 -156
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/cytoscape.py +0 -190
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/node_link.py +0 -261
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tree.py +0 -137
- package/runtime/python/okstra_vendor/networkx/readwrite/leda.py +0 -108
- package/runtime/python/okstra_vendor/networkx/readwrite/multiline_adjlist.py +0 -393
- package/runtime/python/okstra_vendor/networkx/readwrite/p2g.py +0 -113
- package/runtime/python/okstra_vendor/networkx/readwrite/pajek.py +0 -286
- package/runtime/python/okstra_vendor/networkx/readwrite/sparse6.py +0 -379
- package/runtime/python/okstra_vendor/networkx/readwrite/text.py +0 -851
- package/runtime/python/okstra_vendor/networkx/relabel.py +0 -285
- package/runtime/python/okstra_vendor/networkx/utils/__init__.py +0 -8
- package/runtime/python/okstra_vendor/networkx/utils/backends.py +0 -2171
- package/runtime/python/okstra_vendor/networkx/utils/configs.py +0 -396
- package/runtime/python/okstra_vendor/networkx/utils/decorators.py +0 -1233
- package/runtime/python/okstra_vendor/networkx/utils/heaps.py +0 -338
- package/runtime/python/okstra_vendor/networkx/utils/mapped_queue.py +0 -297
- package/runtime/python/okstra_vendor/networkx/utils/misc.py +0 -703
- package/runtime/python/okstra_vendor/networkx/utils/random_sequence.py +0 -198
- package/runtime/python/okstra_vendor/networkx/utils/rcm.py +0 -159
- package/runtime/python/okstra_vendor/networkx/utils/union_find.py +0 -106
- package/runtime/skills/okstra-graphify/SKILL.md +0 -169
- package/src/commands/graphify.mjs +0 -32
|
@@ -1,360 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
********************
|
|
3
|
-
Bipartite Edge Lists
|
|
4
|
-
********************
|
|
5
|
-
Read and write NetworkX graphs as bipartite edge lists.
|
|
6
|
-
|
|
7
|
-
Format
|
|
8
|
-
------
|
|
9
|
-
You can read or write three formats of edge lists with these functions.
|
|
10
|
-
|
|
11
|
-
Node pairs with no data::
|
|
12
|
-
|
|
13
|
-
1 2
|
|
14
|
-
|
|
15
|
-
Python dictionary as data::
|
|
16
|
-
|
|
17
|
-
1 2 {'weight':7, 'color':'green'}
|
|
18
|
-
|
|
19
|
-
Arbitrary data::
|
|
20
|
-
|
|
21
|
-
1 2 7 green
|
|
22
|
-
|
|
23
|
-
For each edge (u, v) the node u is assigned to part 0 and the node v to part 1.
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
__all__ = ["generate_edgelist", "write_edgelist", "parse_edgelist", "read_edgelist"]
|
|
27
|
-
|
|
28
|
-
import networkx as nx
|
|
29
|
-
from networkx.utils import not_implemented_for, open_file
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@open_file(1, mode="wb")
|
|
33
|
-
def write_edgelist(G, path, comments="#", delimiter=" ", data=True, encoding="utf-8"):
|
|
34
|
-
"""Write a bipartite graph as a list of edges.
|
|
35
|
-
|
|
36
|
-
Parameters
|
|
37
|
-
----------
|
|
38
|
-
G : Graph
|
|
39
|
-
A NetworkX bipartite graph
|
|
40
|
-
path : file or string
|
|
41
|
-
File or filename to write. If a file is provided, it must be
|
|
42
|
-
opened in 'wb' mode. Filenames ending in .gz or .bz2 will be compressed.
|
|
43
|
-
comments : string, optional
|
|
44
|
-
The character used to indicate the start of a comment
|
|
45
|
-
delimiter : string, optional
|
|
46
|
-
The string used to separate values. The default is whitespace.
|
|
47
|
-
data : bool or list, optional
|
|
48
|
-
If False write no edge data.
|
|
49
|
-
If True write a string representation of the edge data dictionary..
|
|
50
|
-
If a list (or other iterable) is provided, write the keys specified
|
|
51
|
-
in the list.
|
|
52
|
-
encoding: string, optional
|
|
53
|
-
Specify which encoding to use when writing file.
|
|
54
|
-
|
|
55
|
-
Examples
|
|
56
|
-
--------
|
|
57
|
-
>>> G = nx.path_graph(4)
|
|
58
|
-
>>> G.add_nodes_from([0, 2], bipartite=0)
|
|
59
|
-
>>> G.add_nodes_from([1, 3], bipartite=1)
|
|
60
|
-
>>> nx.write_edgelist(G, "test.edgelist")
|
|
61
|
-
>>> fh = open("test.edgelist_open", "wb")
|
|
62
|
-
>>> nx.write_edgelist(G, fh)
|
|
63
|
-
>>> nx.write_edgelist(G, "test.edgelist.gz")
|
|
64
|
-
>>> nx.write_edgelist(G, "test.edgelist_nodata.gz", data=False)
|
|
65
|
-
|
|
66
|
-
>>> G = nx.Graph()
|
|
67
|
-
>>> G.add_edge(1, 2, weight=7, color="red")
|
|
68
|
-
>>> nx.write_edgelist(G, "test.edgelist_bigger_nodata", data=False)
|
|
69
|
-
>>> nx.write_edgelist(G, "test.edgelist_color", data=["color"])
|
|
70
|
-
>>> nx.write_edgelist(G, "test.edgelist_color_weight", data=["color", "weight"])
|
|
71
|
-
|
|
72
|
-
See Also
|
|
73
|
-
--------
|
|
74
|
-
write_edgelist
|
|
75
|
-
generate_edgelist
|
|
76
|
-
"""
|
|
77
|
-
for line in generate_edgelist(G, delimiter, data):
|
|
78
|
-
line += "\n"
|
|
79
|
-
path.write(line.encode(encoding))
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
@not_implemented_for("directed")
|
|
83
|
-
def generate_edgelist(G, delimiter=" ", data=True):
|
|
84
|
-
"""Generate a single line of the bipartite graph G in edge list format.
|
|
85
|
-
|
|
86
|
-
Parameters
|
|
87
|
-
----------
|
|
88
|
-
G : NetworkX graph
|
|
89
|
-
The graph is assumed to have node attribute `part` set to 0,1 representing
|
|
90
|
-
the two graph parts
|
|
91
|
-
|
|
92
|
-
delimiter : string, optional
|
|
93
|
-
Separator for node labels
|
|
94
|
-
|
|
95
|
-
data : bool or list of keys
|
|
96
|
-
If False generate no edge data. If True use a dictionary
|
|
97
|
-
representation of edge data. If a list of keys use a list of data
|
|
98
|
-
values corresponding to the keys.
|
|
99
|
-
|
|
100
|
-
Returns
|
|
101
|
-
-------
|
|
102
|
-
lines : string
|
|
103
|
-
Lines of data in adjlist format.
|
|
104
|
-
|
|
105
|
-
Examples
|
|
106
|
-
--------
|
|
107
|
-
>>> from networkx.algorithms import bipartite
|
|
108
|
-
>>> G = nx.path_graph(4)
|
|
109
|
-
>>> G.add_nodes_from([0, 2], bipartite=0)
|
|
110
|
-
>>> G.add_nodes_from([1, 3], bipartite=1)
|
|
111
|
-
>>> G[1][2]["weight"] = 3
|
|
112
|
-
>>> G[2][3]["capacity"] = 12
|
|
113
|
-
>>> for line in bipartite.generate_edgelist(G, data=False):
|
|
114
|
-
... print(line)
|
|
115
|
-
0 1
|
|
116
|
-
2 1
|
|
117
|
-
2 3
|
|
118
|
-
|
|
119
|
-
>>> for line in bipartite.generate_edgelist(G):
|
|
120
|
-
... print(line)
|
|
121
|
-
0 1 {}
|
|
122
|
-
2 1 {'weight': 3}
|
|
123
|
-
2 3 {'capacity': 12}
|
|
124
|
-
|
|
125
|
-
>>> for line in bipartite.generate_edgelist(G, data=["weight"]):
|
|
126
|
-
... print(line)
|
|
127
|
-
0 1
|
|
128
|
-
2 1 3
|
|
129
|
-
2 3
|
|
130
|
-
"""
|
|
131
|
-
try:
|
|
132
|
-
part0 = [n for n, d in G.nodes.items() if d["bipartite"] == 0]
|
|
133
|
-
except BaseException as err:
|
|
134
|
-
raise AttributeError("Missing node attribute `bipartite`") from err
|
|
135
|
-
if data is True or data is False:
|
|
136
|
-
for n in part0:
|
|
137
|
-
for edge in G.edges(n, data=data):
|
|
138
|
-
yield delimiter.join(map(str, edge))
|
|
139
|
-
else:
|
|
140
|
-
for n in part0:
|
|
141
|
-
for u, v, d in G.edges(n, data=True):
|
|
142
|
-
edge = [u, v]
|
|
143
|
-
try:
|
|
144
|
-
edge.extend(d[k] for k in data)
|
|
145
|
-
except KeyError:
|
|
146
|
-
pass # missing data for this edge, should warn?
|
|
147
|
-
yield delimiter.join(map(str, edge))
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
@nx._dispatchable(name="bipartite_parse_edgelist", graphs=None, returns_graph=True)
|
|
151
|
-
def parse_edgelist(
|
|
152
|
-
lines, comments="#", delimiter=None, create_using=None, nodetype=None, data=True
|
|
153
|
-
):
|
|
154
|
-
"""Parse lines of an edge list representation of a bipartite graph.
|
|
155
|
-
|
|
156
|
-
Parameters
|
|
157
|
-
----------
|
|
158
|
-
lines : list or iterator of strings
|
|
159
|
-
Input data in edgelist format
|
|
160
|
-
comments : string, optional
|
|
161
|
-
Marker for comment lines
|
|
162
|
-
delimiter : string, optional
|
|
163
|
-
Separator for node labels
|
|
164
|
-
create_using: NetworkX graph container, optional
|
|
165
|
-
Use given NetworkX graph for holding nodes or edges.
|
|
166
|
-
nodetype : Python type, optional
|
|
167
|
-
Convert nodes to this type.
|
|
168
|
-
data : bool or list of (label,type) tuples
|
|
169
|
-
If False generate no edge data or if True use a dictionary
|
|
170
|
-
representation of edge data or a list tuples specifying dictionary
|
|
171
|
-
key names and types for edge data.
|
|
172
|
-
|
|
173
|
-
Returns
|
|
174
|
-
-------
|
|
175
|
-
G: NetworkX Graph
|
|
176
|
-
The bipartite graph corresponding to lines
|
|
177
|
-
|
|
178
|
-
Examples
|
|
179
|
-
--------
|
|
180
|
-
Edgelist with no data:
|
|
181
|
-
|
|
182
|
-
>>> from networkx.algorithms import bipartite
|
|
183
|
-
>>> lines = ["1 2", "2 3", "3 4"]
|
|
184
|
-
>>> G = bipartite.parse_edgelist(lines, nodetype=int)
|
|
185
|
-
>>> sorted(G.nodes())
|
|
186
|
-
[1, 2, 3, 4]
|
|
187
|
-
>>> sorted(G.nodes(data=True))
|
|
188
|
-
[(1, {'bipartite': 0}), (2, {'bipartite': 0}), (3, {'bipartite': 0}), (4, {'bipartite': 1})]
|
|
189
|
-
>>> sorted(G.edges())
|
|
190
|
-
[(1, 2), (2, 3), (3, 4)]
|
|
191
|
-
|
|
192
|
-
Edgelist with data in Python dictionary representation:
|
|
193
|
-
|
|
194
|
-
>>> lines = ["1 2 {'weight':3}", "2 3 {'weight':27}", "3 4 {'weight':3.0}"]
|
|
195
|
-
>>> G = bipartite.parse_edgelist(lines, nodetype=int)
|
|
196
|
-
>>> sorted(G.nodes())
|
|
197
|
-
[1, 2, 3, 4]
|
|
198
|
-
>>> sorted(G.edges(data=True))
|
|
199
|
-
[(1, 2, {'weight': 3}), (2, 3, {'weight': 27}), (3, 4, {'weight': 3.0})]
|
|
200
|
-
|
|
201
|
-
Edgelist with data in a list:
|
|
202
|
-
|
|
203
|
-
>>> lines = ["1 2 3", "2 3 27", "3 4 3.0"]
|
|
204
|
-
>>> G = bipartite.parse_edgelist(lines, nodetype=int, data=(("weight", float),))
|
|
205
|
-
>>> sorted(G.nodes())
|
|
206
|
-
[1, 2, 3, 4]
|
|
207
|
-
>>> sorted(G.edges(data=True))
|
|
208
|
-
[(1, 2, {'weight': 3.0}), (2, 3, {'weight': 27.0}), (3, 4, {'weight': 3.0})]
|
|
209
|
-
|
|
210
|
-
See Also
|
|
211
|
-
--------
|
|
212
|
-
"""
|
|
213
|
-
from ast import literal_eval
|
|
214
|
-
|
|
215
|
-
G = nx.empty_graph(0, create_using)
|
|
216
|
-
for line in lines:
|
|
217
|
-
p = line.find(comments)
|
|
218
|
-
if p >= 0:
|
|
219
|
-
line = line[:p]
|
|
220
|
-
if not len(line):
|
|
221
|
-
continue
|
|
222
|
-
# split line, should have 2 or more
|
|
223
|
-
s = line.rstrip("\n").split(delimiter)
|
|
224
|
-
if len(s) < 2:
|
|
225
|
-
continue
|
|
226
|
-
u = s.pop(0)
|
|
227
|
-
v = s.pop(0)
|
|
228
|
-
d = s
|
|
229
|
-
if nodetype is not None:
|
|
230
|
-
try:
|
|
231
|
-
u = nodetype(u)
|
|
232
|
-
v = nodetype(v)
|
|
233
|
-
except BaseException as err:
|
|
234
|
-
raise TypeError(
|
|
235
|
-
f"Failed to convert nodes {u},{v} to type {nodetype}."
|
|
236
|
-
) from err
|
|
237
|
-
|
|
238
|
-
if len(d) == 0 or data is False:
|
|
239
|
-
# no data or data type specified
|
|
240
|
-
edgedata = {}
|
|
241
|
-
elif data is True:
|
|
242
|
-
# no edge types specified
|
|
243
|
-
try: # try to evaluate as dictionary
|
|
244
|
-
edgedata = dict(literal_eval(" ".join(d)))
|
|
245
|
-
except BaseException as err:
|
|
246
|
-
raise TypeError(
|
|
247
|
-
f"Failed to convert edge data ({d}) to dictionary."
|
|
248
|
-
) from err
|
|
249
|
-
else:
|
|
250
|
-
# convert edge data to dictionary with specified keys and type
|
|
251
|
-
if len(d) != len(data):
|
|
252
|
-
raise IndexError(
|
|
253
|
-
f"Edge data {d} and data_keys {data} are not the same length"
|
|
254
|
-
)
|
|
255
|
-
edgedata = {}
|
|
256
|
-
for (edge_key, edge_type), edge_value in zip(data, d):
|
|
257
|
-
try:
|
|
258
|
-
edge_value = edge_type(edge_value)
|
|
259
|
-
except BaseException as err:
|
|
260
|
-
raise TypeError(
|
|
261
|
-
f"Failed to convert {edge_key} data "
|
|
262
|
-
f"{edge_value} to type {edge_type}."
|
|
263
|
-
) from err
|
|
264
|
-
edgedata.update({edge_key: edge_value})
|
|
265
|
-
G.add_node(u, bipartite=0)
|
|
266
|
-
G.add_node(v, bipartite=1)
|
|
267
|
-
G.add_edge(u, v, **edgedata)
|
|
268
|
-
return G
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
@open_file(0, mode="rb")
|
|
272
|
-
@nx._dispatchable(name="bipartite_read_edgelist", graphs=None, returns_graph=True)
|
|
273
|
-
def read_edgelist(
|
|
274
|
-
path,
|
|
275
|
-
comments="#",
|
|
276
|
-
delimiter=None,
|
|
277
|
-
create_using=None,
|
|
278
|
-
nodetype=None,
|
|
279
|
-
data=True,
|
|
280
|
-
edgetype=None,
|
|
281
|
-
encoding="utf-8",
|
|
282
|
-
):
|
|
283
|
-
"""Read a bipartite graph from a list of edges.
|
|
284
|
-
|
|
285
|
-
Parameters
|
|
286
|
-
----------
|
|
287
|
-
path : file or string
|
|
288
|
-
File or filename to read. If a file is provided, it must be
|
|
289
|
-
opened in 'rb' mode.
|
|
290
|
-
Filenames ending in .gz or .bz2 will be decompressed.
|
|
291
|
-
comments : string, optional
|
|
292
|
-
The character used to indicate the start of a comment.
|
|
293
|
-
delimiter : string, optional
|
|
294
|
-
The string used to separate values. The default is whitespace.
|
|
295
|
-
create_using : Graph container, optional,
|
|
296
|
-
Use specified container to build graph. The default is networkx.Graph,
|
|
297
|
-
an undirected graph.
|
|
298
|
-
nodetype : int, float, str, Python type, optional
|
|
299
|
-
Convert node data from strings to specified type
|
|
300
|
-
data : bool or list of (label,type) tuples
|
|
301
|
-
Tuples specifying dictionary key names and types for edge data
|
|
302
|
-
edgetype : int, float, str, Python type, optional OBSOLETE
|
|
303
|
-
Convert edge data from strings to specified type and use as 'weight'
|
|
304
|
-
encoding: string, optional
|
|
305
|
-
Specify which encoding to use when reading file.
|
|
306
|
-
|
|
307
|
-
Returns
|
|
308
|
-
-------
|
|
309
|
-
G : graph
|
|
310
|
-
A networkx Graph or other type specified with create_using
|
|
311
|
-
|
|
312
|
-
Examples
|
|
313
|
-
--------
|
|
314
|
-
>>> from networkx.algorithms import bipartite
|
|
315
|
-
>>> G = nx.path_graph(4)
|
|
316
|
-
>>> G.add_nodes_from([0, 2], bipartite=0)
|
|
317
|
-
>>> G.add_nodes_from([1, 3], bipartite=1)
|
|
318
|
-
>>> bipartite.write_edgelist(G, "test.edgelist")
|
|
319
|
-
>>> G = bipartite.read_edgelist("test.edgelist")
|
|
320
|
-
|
|
321
|
-
>>> fh = open("test.edgelist", "rb")
|
|
322
|
-
>>> G = bipartite.read_edgelist(fh)
|
|
323
|
-
>>> fh.close()
|
|
324
|
-
|
|
325
|
-
>>> G = bipartite.read_edgelist("test.edgelist", nodetype=int)
|
|
326
|
-
|
|
327
|
-
Edgelist with data in a list:
|
|
328
|
-
|
|
329
|
-
>>> textline = "1 2 3"
|
|
330
|
-
>>> fh = open("test.edgelist", "w")
|
|
331
|
-
>>> d = fh.write(textline)
|
|
332
|
-
>>> fh.close()
|
|
333
|
-
>>> G = bipartite.read_edgelist(
|
|
334
|
-
... "test.edgelist", nodetype=int, data=(("weight", float),)
|
|
335
|
-
... )
|
|
336
|
-
>>> list(G)
|
|
337
|
-
[1, 2]
|
|
338
|
-
>>> list(G.edges(data=True))
|
|
339
|
-
[(1, 2, {'weight': 3.0})]
|
|
340
|
-
|
|
341
|
-
See parse_edgelist() for more examples of formatting.
|
|
342
|
-
|
|
343
|
-
See Also
|
|
344
|
-
--------
|
|
345
|
-
parse_edgelist
|
|
346
|
-
|
|
347
|
-
Notes
|
|
348
|
-
-----
|
|
349
|
-
Since nodes must be hashable, the function nodetype must return hashable
|
|
350
|
-
types (e.g. int, float, str, frozenset - or tuples of those, etc.)
|
|
351
|
-
"""
|
|
352
|
-
lines = (line.decode(encoding) for line in path)
|
|
353
|
-
return parse_edgelist(
|
|
354
|
-
lines,
|
|
355
|
-
comments=comments,
|
|
356
|
-
delimiter=delimiter,
|
|
357
|
-
create_using=create_using,
|
|
358
|
-
nodetype=nodetype,
|
|
359
|
-
data=data,
|
|
360
|
-
)
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"""Provides a function for computing the extendability of a graph which is
|
|
2
|
-
undirected, simple, connected and bipartite and contains at least one perfect matching."""
|
|
3
|
-
|
|
4
|
-
import networkx as nx
|
|
5
|
-
from networkx.utils import not_implemented_for
|
|
6
|
-
|
|
7
|
-
__all__ = ["maximal_extendability"]
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@not_implemented_for("directed")
|
|
11
|
-
@not_implemented_for("multigraph")
|
|
12
|
-
@nx._dispatchable
|
|
13
|
-
def maximal_extendability(G):
|
|
14
|
-
"""Computes the extendability of a graph.
|
|
15
|
-
|
|
16
|
-
The extendability of a graph is defined as the maximum $k$ for which `G`
|
|
17
|
-
is $k$-extendable. Graph `G` is $k$-extendable if and only if `G` has a
|
|
18
|
-
perfect matching and every set of $k$ independent edges can be extended
|
|
19
|
-
to a perfect matching in `G`.
|
|
20
|
-
|
|
21
|
-
Parameters
|
|
22
|
-
----------
|
|
23
|
-
G : NetworkX Graph
|
|
24
|
-
A fully-connected bipartite graph without self-loops
|
|
25
|
-
|
|
26
|
-
Returns
|
|
27
|
-
-------
|
|
28
|
-
extendability : int
|
|
29
|
-
|
|
30
|
-
Raises
|
|
31
|
-
------
|
|
32
|
-
NetworkXError
|
|
33
|
-
If the graph `G` is disconnected.
|
|
34
|
-
If the graph `G` is not bipartite.
|
|
35
|
-
If the graph `G` does not contain a perfect matching.
|
|
36
|
-
If the residual graph of `G` is not strongly connected.
|
|
37
|
-
|
|
38
|
-
Notes
|
|
39
|
-
-----
|
|
40
|
-
Definition:
|
|
41
|
-
Let `G` be a simple, connected, undirected and bipartite graph with a perfect
|
|
42
|
-
matching M and bipartition (U,V). The residual graph of `G`, denoted by $G_M$,
|
|
43
|
-
is the graph obtained from G by directing the edges of M from V to U and the
|
|
44
|
-
edges that do not belong to M from U to V.
|
|
45
|
-
|
|
46
|
-
Lemma [1]_ :
|
|
47
|
-
Let M be a perfect matching of `G`. `G` is $k$-extendable if and only if its residual
|
|
48
|
-
graph $G_M$ is strongly connected and there are $k$ vertex-disjoint directed
|
|
49
|
-
paths between every vertex of U and every vertex of V.
|
|
50
|
-
|
|
51
|
-
Assuming that input graph `G` is undirected, simple, connected, bipartite and contains
|
|
52
|
-
a perfect matching M, this function constructs the residual graph $G_M$ of G and
|
|
53
|
-
returns the minimum value among the maximum vertex-disjoint directed paths between
|
|
54
|
-
every vertex of U and every vertex of V in $G_M$. By combining the definitions
|
|
55
|
-
and the lemma, this value represents the extendability of the graph `G`.
|
|
56
|
-
|
|
57
|
-
Time complexity O($n^3$ $m^2$)) where $n$ is the number of vertices
|
|
58
|
-
and $m$ is the number of edges.
|
|
59
|
-
|
|
60
|
-
References
|
|
61
|
-
----------
|
|
62
|
-
.. [1] "A polynomial algorithm for the extendability problem in bipartite graphs",
|
|
63
|
-
J. Lakhal, L. Litzler, Information Processing Letters, 1998.
|
|
64
|
-
.. [2] "On n-extendible graphs", M. D. Plummer, Discrete Mathematics, 31:201–210, 1980
|
|
65
|
-
https://doi.org/10.1016/0012-365X(80)90037-0
|
|
66
|
-
|
|
67
|
-
"""
|
|
68
|
-
if not nx.is_connected(G):
|
|
69
|
-
raise nx.NetworkXError("Graph G is not connected")
|
|
70
|
-
|
|
71
|
-
if not nx.bipartite.is_bipartite(G):
|
|
72
|
-
raise nx.NetworkXError("Graph G is not bipartite")
|
|
73
|
-
|
|
74
|
-
U, V = nx.bipartite.sets(G)
|
|
75
|
-
|
|
76
|
-
maximum_matching = nx.bipartite.hopcroft_karp_matching(G)
|
|
77
|
-
|
|
78
|
-
if not nx.is_perfect_matching(G, maximum_matching):
|
|
79
|
-
raise nx.NetworkXError("Graph G does not contain a perfect matching")
|
|
80
|
-
|
|
81
|
-
# list of edges in perfect matching, directed from V to U
|
|
82
|
-
pm = [(node, maximum_matching[node]) for node in V & maximum_matching.keys()]
|
|
83
|
-
|
|
84
|
-
# Direct all the edges of G, from V to U if in matching, else from U to V
|
|
85
|
-
directed_edges = [
|
|
86
|
-
(x, y) if (x in V and (x, y) in pm) or (x in U and (y, x) not in pm) else (y, x)
|
|
87
|
-
for x, y in G.edges
|
|
88
|
-
]
|
|
89
|
-
|
|
90
|
-
# Construct the residual graph of G
|
|
91
|
-
residual_G = nx.DiGraph()
|
|
92
|
-
residual_G.add_nodes_from(G)
|
|
93
|
-
residual_G.add_edges_from(directed_edges)
|
|
94
|
-
|
|
95
|
-
if not nx.is_strongly_connected(residual_G):
|
|
96
|
-
raise nx.NetworkXError("The residual graph of G is not strongly connected")
|
|
97
|
-
|
|
98
|
-
# For node-pairs between V & U, keep min of max number of node-disjoint paths
|
|
99
|
-
# Variable $k$ stands for the extendability of graph G
|
|
100
|
-
k = float("inf")
|
|
101
|
-
for u in U:
|
|
102
|
-
for v in V:
|
|
103
|
-
num_paths = sum(1 for _ in nx.node_disjoint_paths(residual_G, u, v))
|
|
104
|
-
k = k if k < num_paths else num_paths
|
|
105
|
-
return k
|