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,168 +0,0 @@
|
|
|
1
|
-
"""Routines to find the boundary of a set of nodes.
|
|
2
|
-
|
|
3
|
-
An edge boundary is a set of edges, each of which has exactly one
|
|
4
|
-
endpoint in a given set of nodes (or, in the case of directed graphs,
|
|
5
|
-
the set of edges whose source node is in the set).
|
|
6
|
-
|
|
7
|
-
A node boundary of a set *S* of nodes is the set of (out-)neighbors of
|
|
8
|
-
nodes in *S* that are outside *S*.
|
|
9
|
-
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
from itertools import chain
|
|
13
|
-
|
|
14
|
-
import networkx as nx
|
|
15
|
-
|
|
16
|
-
__all__ = ["edge_boundary", "node_boundary"]
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@nx._dispatchable(edge_attrs={"data": "default"}, preserve_edge_attrs="data")
|
|
20
|
-
def edge_boundary(G, nbunch1, nbunch2=None, data=False, keys=False, default=None):
|
|
21
|
-
"""Returns the edge boundary of `nbunch1`.
|
|
22
|
-
|
|
23
|
-
The *edge boundary* of a set *S* with respect to a set *T* is the
|
|
24
|
-
set of edges (*u*, *v*) such that *u* is in *S* and *v* is in *T*.
|
|
25
|
-
If *T* is not specified, it is assumed to be the set of all nodes
|
|
26
|
-
not in *S*.
|
|
27
|
-
|
|
28
|
-
Parameters
|
|
29
|
-
----------
|
|
30
|
-
G : NetworkX graph
|
|
31
|
-
|
|
32
|
-
nbunch1 : iterable
|
|
33
|
-
Iterable of nodes in the graph representing the set of nodes
|
|
34
|
-
whose edge boundary will be returned. (This is the set *S* from
|
|
35
|
-
the definition above.)
|
|
36
|
-
|
|
37
|
-
nbunch2 : iterable
|
|
38
|
-
Iterable of nodes representing the target (or "exterior") set of
|
|
39
|
-
nodes. (This is the set *T* from the definition above.) If not
|
|
40
|
-
specified, this is assumed to be the set of all nodes in `G`
|
|
41
|
-
not in `nbunch1`.
|
|
42
|
-
|
|
43
|
-
keys : bool
|
|
44
|
-
This parameter has the same meaning as in
|
|
45
|
-
:meth:`MultiGraph.edges`.
|
|
46
|
-
|
|
47
|
-
data : bool or object
|
|
48
|
-
This parameter has the same meaning as in
|
|
49
|
-
:meth:`MultiGraph.edges`.
|
|
50
|
-
|
|
51
|
-
default : object
|
|
52
|
-
This parameter has the same meaning as in
|
|
53
|
-
:meth:`MultiGraph.edges`.
|
|
54
|
-
|
|
55
|
-
Returns
|
|
56
|
-
-------
|
|
57
|
-
iterator
|
|
58
|
-
An iterator over the edges in the boundary of `nbunch1` with
|
|
59
|
-
respect to `nbunch2`. If `keys`, `data`, or `default`
|
|
60
|
-
are specified and `G` is a multigraph, then edges are returned
|
|
61
|
-
with keys and/or data, as in :meth:`MultiGraph.edges`.
|
|
62
|
-
|
|
63
|
-
Examples
|
|
64
|
-
--------
|
|
65
|
-
>>> G = nx.wheel_graph(6)
|
|
66
|
-
|
|
67
|
-
When nbunch2=None:
|
|
68
|
-
|
|
69
|
-
>>> list(nx.edge_boundary(G, (1, 3)))
|
|
70
|
-
[(1, 0), (1, 2), (1, 5), (3, 0), (3, 2), (3, 4)]
|
|
71
|
-
|
|
72
|
-
When nbunch2 is given:
|
|
73
|
-
|
|
74
|
-
>>> list(nx.edge_boundary(G, (1, 3), (2, 0)))
|
|
75
|
-
[(1, 0), (1, 2), (3, 0), (3, 2)]
|
|
76
|
-
|
|
77
|
-
Notes
|
|
78
|
-
-----
|
|
79
|
-
Any element of `nbunch` that is not in the graph `G` will be
|
|
80
|
-
ignored.
|
|
81
|
-
|
|
82
|
-
`nbunch1` and `nbunch2` are usually meant to be disjoint, but in
|
|
83
|
-
the interest of speed and generality, that is not required here.
|
|
84
|
-
|
|
85
|
-
"""
|
|
86
|
-
nset1 = {n for n in nbunch1 if n in G}
|
|
87
|
-
# Here we create an iterator over edges incident to nodes in the set
|
|
88
|
-
# `nset1`. The `Graph.edges()` method does not provide a guarantee
|
|
89
|
-
# on the orientation of the edges, so our algorithm below must
|
|
90
|
-
# handle the case in which exactly one orientation, either (u, v) or
|
|
91
|
-
# (v, u), appears in this iterable.
|
|
92
|
-
if G.is_multigraph():
|
|
93
|
-
edges = G.edges(nset1, data=data, keys=keys, default=default)
|
|
94
|
-
else:
|
|
95
|
-
edges = G.edges(nset1, data=data, default=default)
|
|
96
|
-
# If `nbunch2` is not provided, then it is assumed to be the set
|
|
97
|
-
# complement of `nbunch1`. For the sake of efficiency, this is
|
|
98
|
-
# implemented by using the `not in` operator, instead of by creating
|
|
99
|
-
# an additional set and using the `in` operator.
|
|
100
|
-
if nbunch2 is None:
|
|
101
|
-
return (e for e in edges if (e[0] in nset1) ^ (e[1] in nset1))
|
|
102
|
-
nset2 = set(nbunch2)
|
|
103
|
-
return (
|
|
104
|
-
e
|
|
105
|
-
for e in edges
|
|
106
|
-
if (e[0] in nset1 and e[1] in nset2) or (e[1] in nset1 and e[0] in nset2)
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
@nx._dispatchable
|
|
111
|
-
def node_boundary(G, nbunch1, nbunch2=None):
|
|
112
|
-
"""Returns the node boundary of `nbunch1`.
|
|
113
|
-
|
|
114
|
-
The *node boundary* of a set *S* with respect to a set *T* is the
|
|
115
|
-
set of nodes *v* in *T* such that for some *u* in *S*, there is an
|
|
116
|
-
edge joining *u* to *v*. If *T* is not specified, it is assumed to
|
|
117
|
-
be the set of all nodes not in *S*.
|
|
118
|
-
|
|
119
|
-
Parameters
|
|
120
|
-
----------
|
|
121
|
-
G : NetworkX graph
|
|
122
|
-
|
|
123
|
-
nbunch1 : iterable
|
|
124
|
-
Iterable of nodes in the graph representing the set of nodes
|
|
125
|
-
whose node boundary will be returned. (This is the set *S* from
|
|
126
|
-
the definition above.)
|
|
127
|
-
|
|
128
|
-
nbunch2 : iterable
|
|
129
|
-
Iterable of nodes representing the target (or "exterior") set of
|
|
130
|
-
nodes. (This is the set *T* from the definition above.) If not
|
|
131
|
-
specified, this is assumed to be the set of all nodes in `G`
|
|
132
|
-
not in `nbunch1`.
|
|
133
|
-
|
|
134
|
-
Returns
|
|
135
|
-
-------
|
|
136
|
-
set
|
|
137
|
-
The node boundary of `nbunch1` with respect to `nbunch2`.
|
|
138
|
-
|
|
139
|
-
Examples
|
|
140
|
-
--------
|
|
141
|
-
>>> G = nx.wheel_graph(6)
|
|
142
|
-
|
|
143
|
-
When nbunch2=None:
|
|
144
|
-
|
|
145
|
-
>>> list(nx.node_boundary(G, (3, 4)))
|
|
146
|
-
[0, 2, 5]
|
|
147
|
-
|
|
148
|
-
When nbunch2 is given:
|
|
149
|
-
|
|
150
|
-
>>> list(nx.node_boundary(G, (3, 4), (0, 1, 5)))
|
|
151
|
-
[0, 5]
|
|
152
|
-
|
|
153
|
-
Notes
|
|
154
|
-
-----
|
|
155
|
-
Any element of `nbunch` that is not in the graph `G` will be
|
|
156
|
-
ignored.
|
|
157
|
-
|
|
158
|
-
`nbunch1` and `nbunch2` are usually meant to be disjoint, but in
|
|
159
|
-
the interest of speed and generality, that is not required here.
|
|
160
|
-
|
|
161
|
-
"""
|
|
162
|
-
nset1 = {n for n in nbunch1 if n in G}
|
|
163
|
-
bdy = set(chain.from_iterable(G[v] for v in nset1)) - nset1
|
|
164
|
-
# If `nbunch2` is not specified, it is assumed to be the set
|
|
165
|
-
# complement of `nbunch1`.
|
|
166
|
-
if nbunch2 is not None:
|
|
167
|
-
bdy &= set(nbunch2)
|
|
168
|
-
return bdy
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
"""Bridge-finding algorithms."""
|
|
2
|
-
|
|
3
|
-
from itertools import chain
|
|
4
|
-
|
|
5
|
-
import networkx as nx
|
|
6
|
-
from networkx.utils import not_implemented_for
|
|
7
|
-
|
|
8
|
-
__all__ = ["bridges", "has_bridges", "local_bridges"]
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@not_implemented_for("directed")
|
|
12
|
-
@nx._dispatchable
|
|
13
|
-
def bridges(G, root=None):
|
|
14
|
-
"""Generate all bridges in a graph.
|
|
15
|
-
|
|
16
|
-
A *bridge* in a graph is an edge whose removal causes the number of
|
|
17
|
-
connected components of the graph to increase. Equivalently, a bridge is an
|
|
18
|
-
edge that does not belong to any cycle. Bridges are also known as cut-edges,
|
|
19
|
-
isthmuses, or cut arcs.
|
|
20
|
-
|
|
21
|
-
Parameters
|
|
22
|
-
----------
|
|
23
|
-
G : undirected graph
|
|
24
|
-
|
|
25
|
-
root : node (optional)
|
|
26
|
-
A node in the graph `G`. If specified, only the bridges in the
|
|
27
|
-
connected component containing this node will be returned.
|
|
28
|
-
|
|
29
|
-
Yields
|
|
30
|
-
------
|
|
31
|
-
e : edge
|
|
32
|
-
An edge in the graph whose removal disconnects the graph (or
|
|
33
|
-
causes the number of connected components to increase).
|
|
34
|
-
|
|
35
|
-
Raises
|
|
36
|
-
------
|
|
37
|
-
NodeNotFound
|
|
38
|
-
If `root` is not in the graph `G`.
|
|
39
|
-
|
|
40
|
-
NetworkXNotImplemented
|
|
41
|
-
If `G` is a directed graph.
|
|
42
|
-
|
|
43
|
-
Examples
|
|
44
|
-
--------
|
|
45
|
-
The barbell graph with parameter zero has a single bridge:
|
|
46
|
-
|
|
47
|
-
>>> G = nx.barbell_graph(10, 0)
|
|
48
|
-
>>> list(nx.bridges(G))
|
|
49
|
-
[(9, 10)]
|
|
50
|
-
|
|
51
|
-
Notes
|
|
52
|
-
-----
|
|
53
|
-
This is an implementation of the algorithm described in [1]_. An edge is a
|
|
54
|
-
bridge if and only if it is not contained in any chain. Chains are found
|
|
55
|
-
using the :func:`networkx.chain_decomposition` function.
|
|
56
|
-
|
|
57
|
-
The algorithm described in [1]_ requires a simple graph. If the provided
|
|
58
|
-
graph is a multigraph, we convert it to a simple graph and verify that any
|
|
59
|
-
bridges discovered by the chain decomposition algorithm are not multi-edges.
|
|
60
|
-
|
|
61
|
-
Ignoring polylogarithmic factors, the worst-case time complexity is the
|
|
62
|
-
same as the :func:`networkx.chain_decomposition` function,
|
|
63
|
-
$O(m + n)$, where $n$ is the number of nodes in the graph and $m$ is
|
|
64
|
-
the number of edges.
|
|
65
|
-
|
|
66
|
-
References
|
|
67
|
-
----------
|
|
68
|
-
.. [1] https://en.wikipedia.org/wiki/Bridge_%28graph_theory%29#Bridge-Finding_with_Chain_Decompositions
|
|
69
|
-
"""
|
|
70
|
-
multigraph = G.is_multigraph()
|
|
71
|
-
H = nx.Graph(G) if multigraph else G
|
|
72
|
-
chains = nx.chain_decomposition(H, root=root)
|
|
73
|
-
chain_edges = set(chain.from_iterable(chains))
|
|
74
|
-
if root is not None:
|
|
75
|
-
H = H.subgraph(nx.node_connected_component(H, root)).copy()
|
|
76
|
-
for u, v in H.edges():
|
|
77
|
-
if (u, v) not in chain_edges and (v, u) not in chain_edges:
|
|
78
|
-
if multigraph and len(G[u][v]) > 1:
|
|
79
|
-
continue
|
|
80
|
-
yield u, v
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
@not_implemented_for("directed")
|
|
84
|
-
@nx._dispatchable
|
|
85
|
-
def has_bridges(G, root=None):
|
|
86
|
-
"""Decide whether a graph has any bridges.
|
|
87
|
-
|
|
88
|
-
A *bridge* in a graph is an edge whose removal causes the number of
|
|
89
|
-
connected components of the graph to increase.
|
|
90
|
-
|
|
91
|
-
Parameters
|
|
92
|
-
----------
|
|
93
|
-
G : undirected graph
|
|
94
|
-
|
|
95
|
-
root : node (optional)
|
|
96
|
-
A node in the graph `G`. If specified, only the bridges in the
|
|
97
|
-
connected component containing this node will be considered.
|
|
98
|
-
|
|
99
|
-
Returns
|
|
100
|
-
-------
|
|
101
|
-
bool
|
|
102
|
-
Whether the graph (or the connected component containing `root`)
|
|
103
|
-
has any bridges.
|
|
104
|
-
|
|
105
|
-
Raises
|
|
106
|
-
------
|
|
107
|
-
NodeNotFound
|
|
108
|
-
If `root` is not in the graph `G`.
|
|
109
|
-
|
|
110
|
-
NetworkXNotImplemented
|
|
111
|
-
If `G` is a directed graph.
|
|
112
|
-
|
|
113
|
-
Examples
|
|
114
|
-
--------
|
|
115
|
-
The barbell graph with parameter zero has a single bridge::
|
|
116
|
-
|
|
117
|
-
>>> G = nx.barbell_graph(10, 0)
|
|
118
|
-
>>> nx.has_bridges(G)
|
|
119
|
-
True
|
|
120
|
-
|
|
121
|
-
On the other hand, the cycle graph has no bridges::
|
|
122
|
-
|
|
123
|
-
>>> G = nx.cycle_graph(5)
|
|
124
|
-
>>> nx.has_bridges(G)
|
|
125
|
-
False
|
|
126
|
-
|
|
127
|
-
Notes
|
|
128
|
-
-----
|
|
129
|
-
This implementation uses the :func:`networkx.bridges` function, so
|
|
130
|
-
it shares its worst-case time complexity, $O(m + n)$, ignoring
|
|
131
|
-
polylogarithmic factors, where $n$ is the number of nodes in the
|
|
132
|
-
graph and $m$ is the number of edges.
|
|
133
|
-
|
|
134
|
-
"""
|
|
135
|
-
try:
|
|
136
|
-
next(bridges(G, root=root))
|
|
137
|
-
except StopIteration:
|
|
138
|
-
return False
|
|
139
|
-
else:
|
|
140
|
-
return True
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
@not_implemented_for("multigraph")
|
|
144
|
-
@not_implemented_for("directed")
|
|
145
|
-
@nx._dispatchable(edge_attrs="weight")
|
|
146
|
-
def local_bridges(G, with_span=True, weight=None):
|
|
147
|
-
"""Iterate over local bridges of `G` optionally computing the span
|
|
148
|
-
|
|
149
|
-
A *local bridge* is an edge whose endpoints have no common neighbors.
|
|
150
|
-
That is, the edge is not part of a triangle in the graph.
|
|
151
|
-
|
|
152
|
-
The *span* of a *local bridge* is the shortest path length between
|
|
153
|
-
the endpoints if the local bridge is removed.
|
|
154
|
-
|
|
155
|
-
Parameters
|
|
156
|
-
----------
|
|
157
|
-
G : undirected graph
|
|
158
|
-
|
|
159
|
-
with_span : bool
|
|
160
|
-
If True, yield a 3-tuple `(u, v, span)`
|
|
161
|
-
|
|
162
|
-
weight : function, string or None (default: None)
|
|
163
|
-
If function, used to compute edge weights for the span.
|
|
164
|
-
If string, the edge data attribute used in calculating span.
|
|
165
|
-
If None, all edges have weight 1.
|
|
166
|
-
|
|
167
|
-
Yields
|
|
168
|
-
------
|
|
169
|
-
e : edge
|
|
170
|
-
The local bridges as an edge 2-tuple of nodes `(u, v)` or
|
|
171
|
-
as a 3-tuple `(u, v, span)` when `with_span is True`.
|
|
172
|
-
|
|
173
|
-
Raises
|
|
174
|
-
------
|
|
175
|
-
NetworkXNotImplemented
|
|
176
|
-
If `G` is a directed graph or multigraph.
|
|
177
|
-
|
|
178
|
-
Examples
|
|
179
|
-
--------
|
|
180
|
-
A cycle graph has every edge a local bridge with span N-1.
|
|
181
|
-
|
|
182
|
-
>>> G = nx.cycle_graph(9)
|
|
183
|
-
>>> (0, 8, 8) in set(nx.local_bridges(G))
|
|
184
|
-
True
|
|
185
|
-
"""
|
|
186
|
-
if with_span is not True:
|
|
187
|
-
for u, v in G.edges:
|
|
188
|
-
if not (set(G[u]) & set(G[v])):
|
|
189
|
-
yield u, v
|
|
190
|
-
else:
|
|
191
|
-
wt = nx.weighted._weight_function(G, weight)
|
|
192
|
-
for u, v in G.edges:
|
|
193
|
-
if not (set(G[u]) & set(G[v])):
|
|
194
|
-
enodes = {u, v}
|
|
195
|
-
|
|
196
|
-
def hide_edge(n, nbr, d):
|
|
197
|
-
if n not in enodes or nbr not in enodes:
|
|
198
|
-
return wt(n, nbr, d)
|
|
199
|
-
return None
|
|
200
|
-
|
|
201
|
-
try:
|
|
202
|
-
span = nx.shortest_path_length(G, u, v, weight=hide_edge)
|
|
203
|
-
yield u, v, span
|
|
204
|
-
except nx.NetworkXNoPath:
|
|
205
|
-
yield u, v, float("inf")
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
"""Routines to calculate the broadcast time of certain graphs.
|
|
2
|
-
|
|
3
|
-
Broadcasting is an information dissemination problem in which a node in a graph,
|
|
4
|
-
called the originator, must distribute a message to all other nodes by placing
|
|
5
|
-
a series of calls along the edges of the graph. Once informed, other nodes aid
|
|
6
|
-
the originator in distributing the message.
|
|
7
|
-
|
|
8
|
-
The broadcasting must be completed as quickly as possible subject to the
|
|
9
|
-
following constraints:
|
|
10
|
-
- Each call requires one unit of time.
|
|
11
|
-
- A node can only participate in one call per unit of time.
|
|
12
|
-
- Each call only involves two adjacent nodes: a sender and a receiver.
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
import networkx as nx
|
|
16
|
-
from networkx.utils import not_implemented_for
|
|
17
|
-
|
|
18
|
-
__all__ = [
|
|
19
|
-
"tree_broadcast_center",
|
|
20
|
-
"tree_broadcast_time",
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def _get_max_broadcast_value(G, U, v, values):
|
|
25
|
-
adj = sorted(set(G.neighbors(v)) & U, key=values.get, reverse=True)
|
|
26
|
-
return max(values[u] + i for i, u in enumerate(adj, start=1))
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def _get_broadcast_centers(G, v, values, target):
|
|
30
|
-
adj = sorted(G.neighbors(v), key=values.get, reverse=True)
|
|
31
|
-
j = next(i for i, u in enumerate(adj, start=1) if values[u] + i == target)
|
|
32
|
-
return set([v] + adj[:j])
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
@not_implemented_for("directed")
|
|
36
|
-
@not_implemented_for("multigraph")
|
|
37
|
-
@nx._dispatchable
|
|
38
|
-
def tree_broadcast_center(G):
|
|
39
|
-
"""Return the broadcast center of a tree.
|
|
40
|
-
|
|
41
|
-
The broadcast center of a graph `G` denotes the set of nodes having
|
|
42
|
-
minimum broadcast time [1]_. This function implements a linear algorithm
|
|
43
|
-
for determining the broadcast center of a tree with ``n`` nodes. As a
|
|
44
|
-
by-product, it also determines the broadcast time from the broadcast center.
|
|
45
|
-
|
|
46
|
-
Parameters
|
|
47
|
-
----------
|
|
48
|
-
G : Graph
|
|
49
|
-
The graph should be an undirected tree.
|
|
50
|
-
|
|
51
|
-
Returns
|
|
52
|
-
-------
|
|
53
|
-
b_T, b_C : (int, set) tuple
|
|
54
|
-
Minimum broadcast time of the broadcast center in `G`, set of nodes
|
|
55
|
-
in the broadcast center.
|
|
56
|
-
|
|
57
|
-
Raises
|
|
58
|
-
------
|
|
59
|
-
NetworkXNotImplemented
|
|
60
|
-
If `G` is directed or is a multigraph.
|
|
61
|
-
|
|
62
|
-
NotATree
|
|
63
|
-
If `G` is not a tree.
|
|
64
|
-
|
|
65
|
-
References
|
|
66
|
-
----------
|
|
67
|
-
.. [1] Slater, P.J., Cockayne, E.J., Hedetniemi, S.T,
|
|
68
|
-
Information dissemination in trees. SIAM J.Comput. 10(4), 692–701 (1981)
|
|
69
|
-
"""
|
|
70
|
-
# Assert that the graph G is a tree
|
|
71
|
-
if not nx.is_tree(G):
|
|
72
|
-
raise nx.NotATree("G is not a tree")
|
|
73
|
-
# step 0
|
|
74
|
-
if (n := len(G)) < 3:
|
|
75
|
-
return n - 1, set(G)
|
|
76
|
-
|
|
77
|
-
# step 1
|
|
78
|
-
U = {node for node, deg in G.degree if deg == 1}
|
|
79
|
-
values = {n: 0 for n in U}
|
|
80
|
-
T = G.copy()
|
|
81
|
-
T.remove_nodes_from(U)
|
|
82
|
-
|
|
83
|
-
# step 2
|
|
84
|
-
W = {node for node, deg in T.degree if deg == 1}
|
|
85
|
-
values.update((w, G.degree[w] - 1) for w in W)
|
|
86
|
-
|
|
87
|
-
# step 3
|
|
88
|
-
while len(T) >= 2:
|
|
89
|
-
# step 4
|
|
90
|
-
w = min(W, key=values.get)
|
|
91
|
-
v = next(T.neighbors(w))
|
|
92
|
-
|
|
93
|
-
# step 5
|
|
94
|
-
U.add(w)
|
|
95
|
-
W.remove(w)
|
|
96
|
-
T.remove_node(w)
|
|
97
|
-
|
|
98
|
-
# step 6
|
|
99
|
-
if T.degree(v) == 1:
|
|
100
|
-
# update t(v)
|
|
101
|
-
values.update({v: _get_max_broadcast_value(G, U, v, values)})
|
|
102
|
-
W.add(v)
|
|
103
|
-
|
|
104
|
-
# step 7
|
|
105
|
-
v = nx.utils.arbitrary_element(T)
|
|
106
|
-
b_T = _get_max_broadcast_value(G, U, v, values)
|
|
107
|
-
return b_T, _get_broadcast_centers(G, v, values, b_T)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
@not_implemented_for("directed")
|
|
111
|
-
@not_implemented_for("multigraph")
|
|
112
|
-
@nx._dispatchable
|
|
113
|
-
def tree_broadcast_time(G, node=None):
|
|
114
|
-
"""Return the minimum broadcast time of a (node in a) tree.
|
|
115
|
-
|
|
116
|
-
The minimum broadcast time of a node is defined as the minimum amount
|
|
117
|
-
of time required to complete broadcasting starting from that node.
|
|
118
|
-
The broadcast time of a graph is the maximum over
|
|
119
|
-
all nodes of the minimum broadcast time from that node [1]_.
|
|
120
|
-
This function returns the minimum broadcast time of `node`.
|
|
121
|
-
If `node` is `None`, the broadcast time for the graph is returned.
|
|
122
|
-
|
|
123
|
-
Parameters
|
|
124
|
-
----------
|
|
125
|
-
G : Graph
|
|
126
|
-
The graph should be an undirected tree.
|
|
127
|
-
|
|
128
|
-
node : node, optional (default=None)
|
|
129
|
-
Starting node for the broadcasting. If `None`, the algorithm
|
|
130
|
-
returns the broadcast time of the graph instead.
|
|
131
|
-
|
|
132
|
-
Returns
|
|
133
|
-
-------
|
|
134
|
-
int
|
|
135
|
-
Minimum broadcast time of `node` in `G`, or broadcast time of `G`
|
|
136
|
-
if no node is provided.
|
|
137
|
-
|
|
138
|
-
Raises
|
|
139
|
-
------
|
|
140
|
-
NetworkXNotImplemented
|
|
141
|
-
If `G` is directed or is a multigraph.
|
|
142
|
-
|
|
143
|
-
NodeNotFound
|
|
144
|
-
If `node` is not a node in `G`.
|
|
145
|
-
|
|
146
|
-
NotATree
|
|
147
|
-
If `G` is not a tree.
|
|
148
|
-
|
|
149
|
-
References
|
|
150
|
-
----------
|
|
151
|
-
.. [1] Harutyunyan, H. A. and Li, Z.
|
|
152
|
-
"A Simple Construction of Broadcast Graphs."
|
|
153
|
-
In Computing and Combinatorics. COCOON 2019
|
|
154
|
-
(Ed. D. Z. Du and C. Tian.) Springer, pp. 240-253, 2019.
|
|
155
|
-
"""
|
|
156
|
-
if node is not None and node not in G:
|
|
157
|
-
err = f"node {node} not in G"
|
|
158
|
-
raise nx.NodeNotFound(err)
|
|
159
|
-
b_T, b_C = tree_broadcast_center(G)
|
|
160
|
-
if node is None:
|
|
161
|
-
return b_T + sum(1 for _ in nx.bfs_layers(G, b_C)) - 1
|
|
162
|
-
return b_T + next(
|
|
163
|
-
d for d, layer in enumerate(nx.bfs_layers(G, b_C)) if node in layer
|
|
164
|
-
)
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
from .betweenness import *
|
|
2
|
-
from .betweenness_subset import *
|
|
3
|
-
from .closeness import *
|
|
4
|
-
from .current_flow_betweenness import *
|
|
5
|
-
from .current_flow_betweenness_subset import *
|
|
6
|
-
from .current_flow_closeness import *
|
|
7
|
-
from .degree_alg import *
|
|
8
|
-
from .dispersion import *
|
|
9
|
-
from .eigenvector import *
|
|
10
|
-
from .group import *
|
|
11
|
-
from .harmonic import *
|
|
12
|
-
from .katz import *
|
|
13
|
-
from .load import *
|
|
14
|
-
from .percolation import *
|
|
15
|
-
from .reaching import *
|
|
16
|
-
from .second_order import *
|
|
17
|
-
from .subgraph_alg import *
|
|
18
|
-
from .trophic import *
|
|
19
|
-
from .voterank_alg import *
|
|
20
|
-
from .laplacian import *
|