okstra 0.130.4 → 0.131.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.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 +1722 -98
- 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,142 +0,0 @@
|
|
|
1
|
-
"""Functions related to graph covers."""
|
|
2
|
-
|
|
3
|
-
from functools import partial
|
|
4
|
-
from itertools import chain
|
|
5
|
-
|
|
6
|
-
import networkx as nx
|
|
7
|
-
from networkx.utils import arbitrary_element, not_implemented_for
|
|
8
|
-
|
|
9
|
-
__all__ = ["min_edge_cover", "is_edge_cover"]
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@not_implemented_for("directed")
|
|
13
|
-
@not_implemented_for("multigraph")
|
|
14
|
-
@nx._dispatchable
|
|
15
|
-
def min_edge_cover(G, matching_algorithm=None):
|
|
16
|
-
"""Returns the min cardinality edge cover of the graph as a set of edges.
|
|
17
|
-
|
|
18
|
-
A smallest edge cover can be found in polynomial time by finding
|
|
19
|
-
a maximum matching and extending it greedily so that all nodes
|
|
20
|
-
are covered. This function follows that process. A maximum matching
|
|
21
|
-
algorithm can be specified for the first step of the algorithm.
|
|
22
|
-
The resulting set may return a set with one 2-tuple for each edge,
|
|
23
|
-
(the usual case) or with both 2-tuples `(u, v)` and `(v, u)` for
|
|
24
|
-
each edge. The latter is only done when a bipartite matching algorithm
|
|
25
|
-
is specified as `matching_algorithm`.
|
|
26
|
-
|
|
27
|
-
Parameters
|
|
28
|
-
----------
|
|
29
|
-
G : NetworkX graph
|
|
30
|
-
An undirected graph.
|
|
31
|
-
|
|
32
|
-
matching_algorithm : function
|
|
33
|
-
A function that returns a maximum cardinality matching for `G`.
|
|
34
|
-
The function must take one input, the graph `G`, and return
|
|
35
|
-
either a set of edges (with only one direction for the pair of nodes)
|
|
36
|
-
or a dictionary mapping each node to its mate. If not specified,
|
|
37
|
-
:func:`~networkx.algorithms.matching.max_weight_matching` is used.
|
|
38
|
-
Common bipartite matching functions include
|
|
39
|
-
:func:`~networkx.algorithms.bipartite.matching.hopcroft_karp_matching`
|
|
40
|
-
or
|
|
41
|
-
:func:`~networkx.algorithms.bipartite.matching.eppstein_matching`.
|
|
42
|
-
|
|
43
|
-
Returns
|
|
44
|
-
-------
|
|
45
|
-
min_cover : set
|
|
46
|
-
|
|
47
|
-
A set of the edges in a minimum edge cover in the form of tuples.
|
|
48
|
-
It contains only one of the equivalent 2-tuples `(u, v)` and `(v, u)`
|
|
49
|
-
for each edge. If a bipartite method is used to compute the matching,
|
|
50
|
-
the returned set contains both the 2-tuples `(u, v)` and `(v, u)`
|
|
51
|
-
for each edge of a minimum edge cover.
|
|
52
|
-
|
|
53
|
-
Examples
|
|
54
|
-
--------
|
|
55
|
-
>>> G = nx.Graph([(0, 1), (0, 2), (0, 3), (1, 2), (1, 3)])
|
|
56
|
-
>>> sorted(nx.min_edge_cover(G))
|
|
57
|
-
[(2, 1), (3, 0)]
|
|
58
|
-
|
|
59
|
-
Notes
|
|
60
|
-
-----
|
|
61
|
-
An edge cover of a graph is a set of edges such that every node of
|
|
62
|
-
the graph is incident to at least one edge of the set.
|
|
63
|
-
The minimum edge cover is an edge covering of smallest cardinality.
|
|
64
|
-
|
|
65
|
-
Due to its implementation, the worst-case running time of this algorithm
|
|
66
|
-
is bounded by the worst-case running time of the function
|
|
67
|
-
``matching_algorithm``.
|
|
68
|
-
|
|
69
|
-
Minimum edge cover for `G` can also be found using
|
|
70
|
-
:func:`~networkx.algorithms.bipartite.covering.min_edge_covering` which is
|
|
71
|
-
simply this function with a default matching algorithm of
|
|
72
|
-
:func:`~networkx.algorithms.bipartite.matching.hopcroft_karp_matching`
|
|
73
|
-
"""
|
|
74
|
-
if len(G) == 0:
|
|
75
|
-
return set()
|
|
76
|
-
if nx.number_of_isolates(G) > 0:
|
|
77
|
-
# ``min_cover`` does not exist as there is an isolated node
|
|
78
|
-
raise nx.NetworkXException(
|
|
79
|
-
"Graph has a node with no edge incident on it, so no edge cover exists."
|
|
80
|
-
)
|
|
81
|
-
if matching_algorithm is None:
|
|
82
|
-
matching_algorithm = partial(nx.max_weight_matching, maxcardinality=True)
|
|
83
|
-
maximum_matching = matching_algorithm(G)
|
|
84
|
-
# ``min_cover`` is superset of ``maximum_matching``
|
|
85
|
-
try:
|
|
86
|
-
# bipartite matching algs return dict so convert if needed
|
|
87
|
-
min_cover = set(maximum_matching.items())
|
|
88
|
-
bipartite_cover = True
|
|
89
|
-
except AttributeError:
|
|
90
|
-
min_cover = maximum_matching
|
|
91
|
-
bipartite_cover = False
|
|
92
|
-
# iterate for uncovered nodes
|
|
93
|
-
uncovered_nodes = set(G) - {v for u, v in min_cover} - {u for u, v in min_cover}
|
|
94
|
-
for v in uncovered_nodes:
|
|
95
|
-
# Since `v` is uncovered, each edge incident to `v` will join it
|
|
96
|
-
# with a covered node (otherwise, if there were an edge joining
|
|
97
|
-
# uncovered nodes `u` and `v`, the maximum matching algorithm
|
|
98
|
-
# would have found it), so we can choose an arbitrary edge
|
|
99
|
-
# incident to `v`. (This applies only in a simple graph, not a
|
|
100
|
-
# multigraph.)
|
|
101
|
-
u = arbitrary_element(G[v])
|
|
102
|
-
min_cover.add((u, v))
|
|
103
|
-
if bipartite_cover:
|
|
104
|
-
min_cover.add((v, u))
|
|
105
|
-
return min_cover
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
@not_implemented_for("directed")
|
|
109
|
-
@nx._dispatchable
|
|
110
|
-
def is_edge_cover(G, cover):
|
|
111
|
-
"""Decides whether a set of edges is a valid edge cover of the graph.
|
|
112
|
-
|
|
113
|
-
Given a set of edges, whether it is an edge covering can
|
|
114
|
-
be decided if we just check whether all nodes of the graph
|
|
115
|
-
has an edge from the set, incident on it.
|
|
116
|
-
|
|
117
|
-
Parameters
|
|
118
|
-
----------
|
|
119
|
-
G : NetworkX graph
|
|
120
|
-
An undirected bipartite graph.
|
|
121
|
-
|
|
122
|
-
cover : set
|
|
123
|
-
Set of edges to be checked.
|
|
124
|
-
|
|
125
|
-
Returns
|
|
126
|
-
-------
|
|
127
|
-
bool
|
|
128
|
-
Whether the set of edges is a valid edge cover of the graph.
|
|
129
|
-
|
|
130
|
-
Examples
|
|
131
|
-
--------
|
|
132
|
-
>>> G = nx.Graph([(0, 1), (0, 2), (0, 3), (1, 2), (1, 3)])
|
|
133
|
-
>>> cover = {(2, 1), (3, 0)}
|
|
134
|
-
>>> nx.is_edge_cover(G, cover)
|
|
135
|
-
True
|
|
136
|
-
|
|
137
|
-
Notes
|
|
138
|
-
-----
|
|
139
|
-
An edge cover of a graph is a set of edges such that every node of
|
|
140
|
-
the graph is incident to at least one edge of the set.
|
|
141
|
-
"""
|
|
142
|
-
return set(G) <= set(chain.from_iterable(cover))
|
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
"""Functions for finding and evaluating cuts in a graph."""
|
|
2
|
-
|
|
3
|
-
from itertools import chain
|
|
4
|
-
|
|
5
|
-
import networkx as nx
|
|
6
|
-
|
|
7
|
-
__all__ = [
|
|
8
|
-
"boundary_expansion",
|
|
9
|
-
"conductance",
|
|
10
|
-
"cut_size",
|
|
11
|
-
"edge_expansion",
|
|
12
|
-
"mixing_expansion",
|
|
13
|
-
"node_expansion",
|
|
14
|
-
"normalized_cut_size",
|
|
15
|
-
"volume",
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
# TODO STILL NEED TO UPDATE ALL THE DOCUMENTATION!
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@nx._dispatchable(edge_attrs="weight")
|
|
23
|
-
def cut_size(G, S, T=None, weight=None):
|
|
24
|
-
"""Returns the size of the cut between two sets of nodes.
|
|
25
|
-
|
|
26
|
-
A *cut* is a partition of the nodes of a graph into two sets. The
|
|
27
|
-
*cut size* is the sum of the weights of the edges "between" the two
|
|
28
|
-
sets of nodes.
|
|
29
|
-
|
|
30
|
-
Parameters
|
|
31
|
-
----------
|
|
32
|
-
G : NetworkX graph
|
|
33
|
-
|
|
34
|
-
S : collection
|
|
35
|
-
A collection of nodes in `G`.
|
|
36
|
-
|
|
37
|
-
T : collection
|
|
38
|
-
A collection of nodes in `G`. If not specified, this is taken to
|
|
39
|
-
be the set complement of `S`.
|
|
40
|
-
|
|
41
|
-
weight : object
|
|
42
|
-
Edge attribute key to use as weight. If not specified, edges
|
|
43
|
-
have weight one.
|
|
44
|
-
|
|
45
|
-
Returns
|
|
46
|
-
-------
|
|
47
|
-
number
|
|
48
|
-
Total weight of all edges from nodes in set `S` to nodes in
|
|
49
|
-
set `T` (and, in the case of directed graphs, all edges from
|
|
50
|
-
nodes in `T` to nodes in `S`).
|
|
51
|
-
|
|
52
|
-
Examples
|
|
53
|
-
--------
|
|
54
|
-
In the graph with two cliques joined by a single edges, the natural
|
|
55
|
-
bipartition of the graph into two blocks, one for each clique,
|
|
56
|
-
yields a cut of weight one:
|
|
57
|
-
|
|
58
|
-
>>> G = nx.barbell_graph(3, 0)
|
|
59
|
-
>>> S = {0, 1, 2}
|
|
60
|
-
>>> T = {3, 4, 5}
|
|
61
|
-
>>> nx.cut_size(G, S, T)
|
|
62
|
-
1
|
|
63
|
-
|
|
64
|
-
Each parallel edge in a multigraph is counted when determining the
|
|
65
|
-
cut size:
|
|
66
|
-
|
|
67
|
-
>>> G = nx.MultiGraph(["ab", "ab"])
|
|
68
|
-
>>> S = {"a"}
|
|
69
|
-
>>> T = {"b"}
|
|
70
|
-
>>> nx.cut_size(G, S, T)
|
|
71
|
-
2
|
|
72
|
-
|
|
73
|
-
Notes
|
|
74
|
-
-----
|
|
75
|
-
In a multigraph, the cut size is the total weight of edges including
|
|
76
|
-
multiplicity.
|
|
77
|
-
|
|
78
|
-
"""
|
|
79
|
-
edges = nx.edge_boundary(G, S, T, data=weight, default=1)
|
|
80
|
-
if G.is_directed():
|
|
81
|
-
edges = chain(edges, nx.edge_boundary(G, T, S, data=weight, default=1))
|
|
82
|
-
return sum(weight for u, v, weight in edges)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
@nx._dispatchable(edge_attrs="weight")
|
|
86
|
-
def volume(G, S, weight=None):
|
|
87
|
-
"""Returns the volume of a set of nodes.
|
|
88
|
-
|
|
89
|
-
The *volume* of a set *S* is the sum of the (out-)degrees of nodes
|
|
90
|
-
in *S* (taking into account parallel edges in multigraphs). [1]
|
|
91
|
-
|
|
92
|
-
Parameters
|
|
93
|
-
----------
|
|
94
|
-
G : NetworkX graph
|
|
95
|
-
|
|
96
|
-
S : collection
|
|
97
|
-
A collection of nodes in `G`.
|
|
98
|
-
|
|
99
|
-
weight : object
|
|
100
|
-
Edge attribute key to use as weight. If not specified, edges
|
|
101
|
-
have weight one.
|
|
102
|
-
|
|
103
|
-
Returns
|
|
104
|
-
-------
|
|
105
|
-
number
|
|
106
|
-
The volume of the set of nodes represented by `S` in the graph
|
|
107
|
-
`G`.
|
|
108
|
-
|
|
109
|
-
See also
|
|
110
|
-
--------
|
|
111
|
-
conductance
|
|
112
|
-
cut_size
|
|
113
|
-
edge_expansion
|
|
114
|
-
edge_boundary
|
|
115
|
-
normalized_cut_size
|
|
116
|
-
|
|
117
|
-
References
|
|
118
|
-
----------
|
|
119
|
-
.. [1] David Gleich.
|
|
120
|
-
*Hierarchical Directed Spectral Graph Partitioning*.
|
|
121
|
-
<https://www.cs.purdue.edu/homes/dgleich/publications/Gleich%202005%20-%20hierarchical%20directed%20spectral.pdf>
|
|
122
|
-
|
|
123
|
-
"""
|
|
124
|
-
degree = G.out_degree if G.is_directed() else G.degree
|
|
125
|
-
return sum(d for v, d in degree(S, weight=weight))
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
@nx._dispatchable(edge_attrs="weight")
|
|
129
|
-
def normalized_cut_size(G, S, T=None, weight=None):
|
|
130
|
-
"""Returns the normalized size of the cut between two sets of nodes.
|
|
131
|
-
|
|
132
|
-
The *normalized cut size* is the cut size times the sum of the
|
|
133
|
-
reciprocal sizes of the volumes of the two sets. [1]
|
|
134
|
-
|
|
135
|
-
Parameters
|
|
136
|
-
----------
|
|
137
|
-
G : NetworkX graph
|
|
138
|
-
|
|
139
|
-
S : collection
|
|
140
|
-
A collection of nodes in `G`.
|
|
141
|
-
|
|
142
|
-
T : collection
|
|
143
|
-
A collection of nodes in `G`.
|
|
144
|
-
|
|
145
|
-
weight : object
|
|
146
|
-
Edge attribute key to use as weight. If not specified, edges
|
|
147
|
-
have weight one.
|
|
148
|
-
|
|
149
|
-
Returns
|
|
150
|
-
-------
|
|
151
|
-
number
|
|
152
|
-
The normalized cut size between the two sets `S` and `T`.
|
|
153
|
-
|
|
154
|
-
Notes
|
|
155
|
-
-----
|
|
156
|
-
In a multigraph, the cut size is the total weight of edges including
|
|
157
|
-
multiplicity.
|
|
158
|
-
|
|
159
|
-
See also
|
|
160
|
-
--------
|
|
161
|
-
conductance
|
|
162
|
-
cut_size
|
|
163
|
-
edge_expansion
|
|
164
|
-
volume
|
|
165
|
-
|
|
166
|
-
References
|
|
167
|
-
----------
|
|
168
|
-
.. [1] David Gleich.
|
|
169
|
-
*Hierarchical Directed Spectral Graph Partitioning*.
|
|
170
|
-
<https://www.cs.purdue.edu/homes/dgleich/publications/Gleich%202005%20-%20hierarchical%20directed%20spectral.pdf>
|
|
171
|
-
|
|
172
|
-
"""
|
|
173
|
-
if T is None:
|
|
174
|
-
T = set(G) - set(S)
|
|
175
|
-
num_cut_edges = cut_size(G, S, T=T, weight=weight)
|
|
176
|
-
volume_S = volume(G, S, weight=weight)
|
|
177
|
-
volume_T = volume(G, T, weight=weight)
|
|
178
|
-
return num_cut_edges * ((1 / volume_S) + (1 / volume_T))
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
@nx._dispatchable(edge_attrs="weight")
|
|
182
|
-
def conductance(G, S, T=None, weight=None):
|
|
183
|
-
"""Returns the conductance of two sets of nodes.
|
|
184
|
-
|
|
185
|
-
The *conductance* is the quotient of the cut size and the smaller of
|
|
186
|
-
the volumes of the two sets. [1]
|
|
187
|
-
|
|
188
|
-
Parameters
|
|
189
|
-
----------
|
|
190
|
-
G : NetworkX graph
|
|
191
|
-
|
|
192
|
-
S : collection
|
|
193
|
-
A collection of nodes in `G`.
|
|
194
|
-
|
|
195
|
-
T : collection
|
|
196
|
-
A collection of nodes in `G`.
|
|
197
|
-
|
|
198
|
-
weight : object
|
|
199
|
-
Edge attribute key to use as weight. If not specified, edges
|
|
200
|
-
have weight one.
|
|
201
|
-
|
|
202
|
-
Returns
|
|
203
|
-
-------
|
|
204
|
-
number
|
|
205
|
-
The conductance between the two sets `S` and `T`.
|
|
206
|
-
|
|
207
|
-
See also
|
|
208
|
-
--------
|
|
209
|
-
cut_size
|
|
210
|
-
edge_expansion
|
|
211
|
-
normalized_cut_size
|
|
212
|
-
volume
|
|
213
|
-
|
|
214
|
-
References
|
|
215
|
-
----------
|
|
216
|
-
.. [1] David Gleich.
|
|
217
|
-
*Hierarchical Directed Spectral Graph Partitioning*.
|
|
218
|
-
<https://www.cs.purdue.edu/homes/dgleich/publications/Gleich%202005%20-%20hierarchical%20directed%20spectral.pdf>
|
|
219
|
-
|
|
220
|
-
"""
|
|
221
|
-
if T is None:
|
|
222
|
-
T = set(G) - set(S)
|
|
223
|
-
num_cut_edges = cut_size(G, S, T, weight=weight)
|
|
224
|
-
volume_S = volume(G, S, weight=weight)
|
|
225
|
-
volume_T = volume(G, T, weight=weight)
|
|
226
|
-
return num_cut_edges / min(volume_S, volume_T)
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
@nx._dispatchable(edge_attrs="weight")
|
|
230
|
-
def edge_expansion(G, S, T=None, weight=None):
|
|
231
|
-
"""Returns the edge expansion between two node sets.
|
|
232
|
-
|
|
233
|
-
The *edge expansion* is the quotient of the cut size and the smaller
|
|
234
|
-
of the cardinalities of the two sets. [1]
|
|
235
|
-
|
|
236
|
-
Parameters
|
|
237
|
-
----------
|
|
238
|
-
G : NetworkX graph
|
|
239
|
-
|
|
240
|
-
S : collection
|
|
241
|
-
A collection of nodes in `G`.
|
|
242
|
-
|
|
243
|
-
T : collection
|
|
244
|
-
A collection of nodes in `G`.
|
|
245
|
-
|
|
246
|
-
weight : object
|
|
247
|
-
Edge attribute key to use as weight. If not specified, edges
|
|
248
|
-
have weight one.
|
|
249
|
-
|
|
250
|
-
Returns
|
|
251
|
-
-------
|
|
252
|
-
number
|
|
253
|
-
The edge expansion between the two sets `S` and `T`.
|
|
254
|
-
|
|
255
|
-
See also
|
|
256
|
-
--------
|
|
257
|
-
boundary_expansion
|
|
258
|
-
mixing_expansion
|
|
259
|
-
node_expansion
|
|
260
|
-
|
|
261
|
-
References
|
|
262
|
-
----------
|
|
263
|
-
.. [1] Fan Chung.
|
|
264
|
-
*Spectral Graph Theory*.
|
|
265
|
-
(CBMS Regional Conference Series in Mathematics, No. 92),
|
|
266
|
-
American Mathematical Society, 1997, ISBN 0-8218-0315-8
|
|
267
|
-
<http://www.math.ucsd.edu/~fan/research/revised.html>
|
|
268
|
-
|
|
269
|
-
"""
|
|
270
|
-
if T is None:
|
|
271
|
-
T = set(G) - set(S)
|
|
272
|
-
num_cut_edges = cut_size(G, S, T=T, weight=weight)
|
|
273
|
-
return num_cut_edges / min(len(S), len(T))
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
@nx._dispatchable(edge_attrs="weight")
|
|
277
|
-
def mixing_expansion(G, S, T=None, weight=None):
|
|
278
|
-
"""Returns the mixing expansion between two node sets.
|
|
279
|
-
|
|
280
|
-
The *mixing expansion* is the quotient of the cut size and twice the
|
|
281
|
-
number of edges in the graph. [1]
|
|
282
|
-
|
|
283
|
-
Parameters
|
|
284
|
-
----------
|
|
285
|
-
G : NetworkX graph
|
|
286
|
-
|
|
287
|
-
S : collection
|
|
288
|
-
A collection of nodes in `G`.
|
|
289
|
-
|
|
290
|
-
T : collection
|
|
291
|
-
A collection of nodes in `G`.
|
|
292
|
-
|
|
293
|
-
weight : object
|
|
294
|
-
Edge attribute key to use as weight. If not specified, edges
|
|
295
|
-
have weight one.
|
|
296
|
-
|
|
297
|
-
Returns
|
|
298
|
-
-------
|
|
299
|
-
number
|
|
300
|
-
The mixing expansion between the two sets `S` and `T`.
|
|
301
|
-
|
|
302
|
-
See also
|
|
303
|
-
--------
|
|
304
|
-
boundary_expansion
|
|
305
|
-
edge_expansion
|
|
306
|
-
node_expansion
|
|
307
|
-
|
|
308
|
-
References
|
|
309
|
-
----------
|
|
310
|
-
.. [1] Vadhan, Salil P.
|
|
311
|
-
"Pseudorandomness."
|
|
312
|
-
*Foundations and Trends
|
|
313
|
-
in Theoretical Computer Science* 7.1–3 (2011): 1–336.
|
|
314
|
-
<https://doi.org/10.1561/0400000010>
|
|
315
|
-
|
|
316
|
-
"""
|
|
317
|
-
num_cut_edges = cut_size(G, S, T=T, weight=weight)
|
|
318
|
-
num_total_edges = G.number_of_edges()
|
|
319
|
-
return num_cut_edges / (2 * num_total_edges)
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
# TODO What is the generalization to two arguments, S and T? Does the
|
|
323
|
-
# denominator become `min(len(S), len(T))`?
|
|
324
|
-
@nx._dispatchable
|
|
325
|
-
def node_expansion(G, S):
|
|
326
|
-
"""Returns the node expansion of the set `S`.
|
|
327
|
-
|
|
328
|
-
The *node expansion* is the quotient of the size of the node
|
|
329
|
-
boundary of *S* and the cardinality of *S*. [1]
|
|
330
|
-
|
|
331
|
-
Parameters
|
|
332
|
-
----------
|
|
333
|
-
G : NetworkX graph
|
|
334
|
-
|
|
335
|
-
S : collection
|
|
336
|
-
A collection of nodes in `G`.
|
|
337
|
-
|
|
338
|
-
Returns
|
|
339
|
-
-------
|
|
340
|
-
number
|
|
341
|
-
The node expansion of the set `S`.
|
|
342
|
-
|
|
343
|
-
See also
|
|
344
|
-
--------
|
|
345
|
-
boundary_expansion
|
|
346
|
-
edge_expansion
|
|
347
|
-
mixing_expansion
|
|
348
|
-
|
|
349
|
-
References
|
|
350
|
-
----------
|
|
351
|
-
.. [1] Vadhan, Salil P.
|
|
352
|
-
"Pseudorandomness."
|
|
353
|
-
*Foundations and Trends
|
|
354
|
-
in Theoretical Computer Science* 7.1–3 (2011): 1–336.
|
|
355
|
-
<https://doi.org/10.1561/0400000010>
|
|
356
|
-
|
|
357
|
-
"""
|
|
358
|
-
neighborhood = set(chain.from_iterable(G.neighbors(v) for v in S))
|
|
359
|
-
return len(neighborhood) / len(S)
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
@nx._dispatchable
|
|
363
|
-
def boundary_expansion(G, S):
|
|
364
|
-
"""Returns the boundary expansion of the set `S`.
|
|
365
|
-
|
|
366
|
-
The *boundary expansion* of a set `S` is the ratio between the size of its
|
|
367
|
-
node boundary and the cardinality of the set itself [1]_ .
|
|
368
|
-
|
|
369
|
-
Parameters
|
|
370
|
-
----------
|
|
371
|
-
G : NetworkX graph
|
|
372
|
-
The input graph.
|
|
373
|
-
|
|
374
|
-
S : collection
|
|
375
|
-
A collection of nodes in `G`.
|
|
376
|
-
|
|
377
|
-
Returns
|
|
378
|
-
-------
|
|
379
|
-
number
|
|
380
|
-
The boundary expansion ratio: size of node boundary / size of `S`.
|
|
381
|
-
|
|
382
|
-
Examples
|
|
383
|
-
--------
|
|
384
|
-
The node boundary is {2, 3} (size 2), divided by ``|S|=2``:
|
|
385
|
-
|
|
386
|
-
>>> G = nx.cycle_graph(4)
|
|
387
|
-
>>> S = {0, 1}
|
|
388
|
-
>>> nx.boundary_expansion(G, S)
|
|
389
|
-
1.0
|
|
390
|
-
|
|
391
|
-
For disconnected sets, e.g. here where the node boundary is ``{1, 3, 5}``:
|
|
392
|
-
|
|
393
|
-
>>> G = nx.cycle_graph(6)
|
|
394
|
-
>>> S = {0, 2, 4}
|
|
395
|
-
>>> nx.boundary_expansion(G, S)
|
|
396
|
-
1.0
|
|
397
|
-
|
|
398
|
-
See also
|
|
399
|
-
--------
|
|
400
|
-
:func:`~networkx.algorithms.boundary.node_boundary`
|
|
401
|
-
edge_expansion
|
|
402
|
-
mixing_expansion
|
|
403
|
-
node_expansion
|
|
404
|
-
|
|
405
|
-
Notes
|
|
406
|
-
-----
|
|
407
|
-
The node boundary is defined as all nodes not in `S` that are adjacent to
|
|
408
|
-
nodes in `S`.
|
|
409
|
-
|
|
410
|
-
References
|
|
411
|
-
----------
|
|
412
|
-
.. [1] Vadhan, Salil P.
|
|
413
|
-
"Pseudorandomness." *Foundations and Trends in Theoretical Computer Science*
|
|
414
|
-
7.1–3 (2011): 1–336. <https://doi.org/10.1561/0400000010>
|
|
415
|
-
"""
|
|
416
|
-
return len(nx.node_boundary(G, S)) / len(S)
|