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,163 +0,0 @@
|
|
|
1
|
-
"""Generators for Harary graphs
|
|
2
|
-
|
|
3
|
-
This module gives two generators for the Harary graph, which was
|
|
4
|
-
introduced by the famous mathematician Frank Harary in his 1962 work [H]_.
|
|
5
|
-
The first generator gives the Harary graph that maximizes the node
|
|
6
|
-
connectivity with given number of nodes and given number of edges.
|
|
7
|
-
The second generator gives the Harary graph that minimizes
|
|
8
|
-
the number of edges in the graph with given node connectivity and
|
|
9
|
-
number of nodes.
|
|
10
|
-
|
|
11
|
-
References
|
|
12
|
-
----------
|
|
13
|
-
.. [H] Harary, F. "The Maximum Connectivity of a Graph."
|
|
14
|
-
Proc. Nat. Acad. Sci. USA 48, 1142-1146, 1962.
|
|
15
|
-
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
import networkx as nx
|
|
19
|
-
from networkx.exception import NetworkXError
|
|
20
|
-
|
|
21
|
-
__all__ = ["hnm_harary_graph", "hkn_harary_graph"]
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@nx._dispatchable(graphs=None, returns_graph=True)
|
|
25
|
-
def hnm_harary_graph(n, m, create_using=None):
|
|
26
|
-
r"""Return the Harary graph with given numbers of nodes and edges.
|
|
27
|
-
|
|
28
|
-
The Harary graph $H_{n, m}$ is the graph that maximizes node connectivity
|
|
29
|
-
with $n$ nodes and $m$ edges.
|
|
30
|
-
|
|
31
|
-
This maximum node connectivity is known to be $\lfloor 2m/n \rfloor$. [1]_
|
|
32
|
-
|
|
33
|
-
Parameters
|
|
34
|
-
----------
|
|
35
|
-
n: integer
|
|
36
|
-
The number of nodes the generated graph is to contain.
|
|
37
|
-
|
|
38
|
-
m: integer
|
|
39
|
-
The number of edges the generated graph is to contain.
|
|
40
|
-
|
|
41
|
-
create_using : NetworkX graph constructor, optional (default=nx.Graph)
|
|
42
|
-
Graph type to create. If graph instance, then cleared before populated.
|
|
43
|
-
|
|
44
|
-
Returns
|
|
45
|
-
-------
|
|
46
|
-
NetworkX graph
|
|
47
|
-
The Harary graph $H_{n, m}$.
|
|
48
|
-
|
|
49
|
-
See Also
|
|
50
|
-
--------
|
|
51
|
-
hkn_harary_graph
|
|
52
|
-
|
|
53
|
-
Notes
|
|
54
|
-
-----
|
|
55
|
-
This algorithm runs in $O(m)$ time.
|
|
56
|
-
The implementation follows [2]_.
|
|
57
|
-
|
|
58
|
-
References
|
|
59
|
-
----------
|
|
60
|
-
.. [1] F. T. Boesch, A. Satyanarayana, and C. L. Suffel,
|
|
61
|
-
"A Survey of Some Network Reliability Analysis and Synthesis Results,"
|
|
62
|
-
Networks, pp. 99-107, 2009.
|
|
63
|
-
|
|
64
|
-
.. [2] Harary, F. "The Maximum Connectivity of a Graph."
|
|
65
|
-
Proc. Nat. Acad. Sci. USA 48, 1142-1146, 1962.
|
|
66
|
-
"""
|
|
67
|
-
|
|
68
|
-
if n < 1:
|
|
69
|
-
raise NetworkXError("The number of nodes must be >= 1!")
|
|
70
|
-
if m < n - 1:
|
|
71
|
-
raise NetworkXError("The number of edges must be >= n - 1 !")
|
|
72
|
-
if m > n * (n - 1) // 2:
|
|
73
|
-
raise NetworkXError("The number of edges must be <= n(n-1)/2")
|
|
74
|
-
|
|
75
|
-
# Get the floor of average node degree.
|
|
76
|
-
d = 2 * m // n
|
|
77
|
-
|
|
78
|
-
offset = d // 2
|
|
79
|
-
H = nx.circulant_graph(n, range(1, offset + 1), create_using=create_using)
|
|
80
|
-
|
|
81
|
-
half = n // 2
|
|
82
|
-
if (n % 2 == 0) or (d % 2 == 0):
|
|
83
|
-
# If d is odd; n must be even.
|
|
84
|
-
if d % 2 == 1:
|
|
85
|
-
# Add edges diagonally.
|
|
86
|
-
H.add_edges_from((i, i + half) for i in range(half))
|
|
87
|
-
|
|
88
|
-
r = 2 * m % n
|
|
89
|
-
# Add remaining edges at offset + 1.
|
|
90
|
-
H.add_edges_from((i, i + offset + 1) for i in range(r // 2))
|
|
91
|
-
else:
|
|
92
|
-
# Add the remaining m - n * offset edges between i and i + half.
|
|
93
|
-
H.add_edges_from((i, (i + half) % n) for i in range(m - n * offset))
|
|
94
|
-
|
|
95
|
-
return H
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
@nx._dispatchable(graphs=None, returns_graph=True)
|
|
99
|
-
def hkn_harary_graph(k, n, create_using=None):
|
|
100
|
-
r"""Return the Harary graph with given node connectivity and node number.
|
|
101
|
-
|
|
102
|
-
The Harary graph $H_{k, n}$ is the graph that minimizes the number of
|
|
103
|
-
edges needed with given node connectivity $k$ and node number $n$.
|
|
104
|
-
|
|
105
|
-
This smallest number of edges is known to be $\lceil kn/2 \rceil$ [1]_.
|
|
106
|
-
|
|
107
|
-
Parameters
|
|
108
|
-
----------
|
|
109
|
-
k: integer
|
|
110
|
-
The node connectivity of the generated graph.
|
|
111
|
-
|
|
112
|
-
n: integer
|
|
113
|
-
The number of nodes the generated graph is to contain.
|
|
114
|
-
|
|
115
|
-
create_using : NetworkX graph constructor, optional (default=nx.Graph)
|
|
116
|
-
Graph type to create. If graph instance, then cleared before populated.
|
|
117
|
-
|
|
118
|
-
Returns
|
|
119
|
-
-------
|
|
120
|
-
NetworkX graph
|
|
121
|
-
The Harary graph $H_{k, n}$.
|
|
122
|
-
|
|
123
|
-
See Also
|
|
124
|
-
--------
|
|
125
|
-
hnm_harary_graph
|
|
126
|
-
|
|
127
|
-
Notes
|
|
128
|
-
-----
|
|
129
|
-
This algorithm runs in $O(kn)$ time.
|
|
130
|
-
The implementation follows [2]_.
|
|
131
|
-
|
|
132
|
-
References
|
|
133
|
-
----------
|
|
134
|
-
.. [1] Weisstein, Eric W. "Harary Graph." From MathWorld--A Wolfram Web
|
|
135
|
-
Resource. http://mathworld.wolfram.com/HararyGraph.html.
|
|
136
|
-
|
|
137
|
-
.. [2] Harary, F. "The Maximum Connectivity of a Graph."
|
|
138
|
-
Proc. Nat. Acad. Sci. USA 48, 1142-1146, 1962.
|
|
139
|
-
"""
|
|
140
|
-
|
|
141
|
-
if k < 1:
|
|
142
|
-
raise NetworkXError("The node connectivity must be >= 1!")
|
|
143
|
-
if n < k + 1:
|
|
144
|
-
raise NetworkXError("The number of nodes must be >= k+1 !")
|
|
145
|
-
|
|
146
|
-
# In case of connectivity 1, simply return the path graph.
|
|
147
|
-
if k == 1:
|
|
148
|
-
return nx.path_graph(n, create_using)
|
|
149
|
-
|
|
150
|
-
offset = k // 2
|
|
151
|
-
H = nx.circulant_graph(n, range(1, offset + 1), create_using=create_using)
|
|
152
|
-
|
|
153
|
-
half = n // 2
|
|
154
|
-
if (k % 2 == 0) or (n % 2 == 0):
|
|
155
|
-
# If k is odd; n must be even.
|
|
156
|
-
if k % 2 == 1:
|
|
157
|
-
# Add edges diagonally.
|
|
158
|
-
H.add_edges_from((i, i + half) for i in range(half))
|
|
159
|
-
else:
|
|
160
|
-
# Add half + 1 edges between i and i + half.
|
|
161
|
-
H.add_edges_from((i, (i + half) % n) for i in range(half + 1))
|
|
162
|
-
|
|
163
|
-
return H
|
|
@@ -1,443 +0,0 @@
|
|
|
1
|
-
"""Generates graphs resembling the Internet Autonomous System network"""
|
|
2
|
-
|
|
3
|
-
import networkx as nx
|
|
4
|
-
from networkx.utils import py_random_state
|
|
5
|
-
|
|
6
|
-
__all__ = ["random_internet_as_graph"]
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def uniform_int_from_avg(a, m, seed):
|
|
10
|
-
"""Pick a random integer with uniform probability.
|
|
11
|
-
|
|
12
|
-
Returns a random integer uniformly taken from a distribution with
|
|
13
|
-
minimum value 'a' and average value 'm', X~U(a,b), E[X]=m, X in N where
|
|
14
|
-
b = 2*m - a.
|
|
15
|
-
|
|
16
|
-
Notes
|
|
17
|
-
-----
|
|
18
|
-
p = (b-floor(b))/2
|
|
19
|
-
X = X1 + X2; X1~U(a,floor(b)), X2~B(p)
|
|
20
|
-
E[X] = E[X1] + E[X2] = (floor(b)+a)/2 + (b-floor(b))/2 = (b+a)/2 = m
|
|
21
|
-
"""
|
|
22
|
-
|
|
23
|
-
from math import floor
|
|
24
|
-
|
|
25
|
-
assert m >= a
|
|
26
|
-
b = 2 * m - a
|
|
27
|
-
p = (b - floor(b)) / 2
|
|
28
|
-
X1 = round(seed.random() * (floor(b) - a) + a)
|
|
29
|
-
if seed.random() < p:
|
|
30
|
-
X2 = 1
|
|
31
|
-
else:
|
|
32
|
-
X2 = 0
|
|
33
|
-
return X1 + X2
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
@py_random_state("seed")
|
|
37
|
-
def choose_pref_attach(degs, seed):
|
|
38
|
-
"""Pick a random value, with a probability given by its weight.
|
|
39
|
-
|
|
40
|
-
Returns a random choice among degs keys, each of which has a
|
|
41
|
-
probability proportional to the corresponding dictionary value.
|
|
42
|
-
|
|
43
|
-
Parameters
|
|
44
|
-
----------
|
|
45
|
-
degs: dictionary
|
|
46
|
-
It contains the possible values (keys) and the corresponding
|
|
47
|
-
probabilities (values)
|
|
48
|
-
seed: random state
|
|
49
|
-
|
|
50
|
-
Returns
|
|
51
|
-
-------
|
|
52
|
-
v: object
|
|
53
|
-
A key of degs or None if degs is empty
|
|
54
|
-
"""
|
|
55
|
-
|
|
56
|
-
if len(degs) == 0:
|
|
57
|
-
return None
|
|
58
|
-
s = sum(degs.values())
|
|
59
|
-
if s == 0:
|
|
60
|
-
return seed.choice(list(degs.keys()))
|
|
61
|
-
v = seed.random() * s
|
|
62
|
-
|
|
63
|
-
nodes = list(degs.keys())
|
|
64
|
-
i = 0
|
|
65
|
-
acc = degs[nodes[i]]
|
|
66
|
-
while v > acc:
|
|
67
|
-
i += 1
|
|
68
|
-
acc += degs[nodes[i]]
|
|
69
|
-
return nodes[i]
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
class AS_graph_generator:
|
|
73
|
-
"""Generates random internet AS graphs."""
|
|
74
|
-
|
|
75
|
-
@py_random_state("seed")
|
|
76
|
-
def __init__(self, n, seed):
|
|
77
|
-
"""Initializes variables. Immediate numbers are taken from [1].
|
|
78
|
-
|
|
79
|
-
Parameters
|
|
80
|
-
----------
|
|
81
|
-
n: integer
|
|
82
|
-
Number of graph nodes
|
|
83
|
-
seed: random state
|
|
84
|
-
Indicator of random number generation state.
|
|
85
|
-
See :ref:`Randomness<randomness>`.
|
|
86
|
-
|
|
87
|
-
Returns
|
|
88
|
-
-------
|
|
89
|
-
GG: AS_graph_generator object
|
|
90
|
-
|
|
91
|
-
References
|
|
92
|
-
----------
|
|
93
|
-
[1] A. Elmokashfi, A. Kvalbein and C. Dovrolis, "On the Scalability of
|
|
94
|
-
BGP: The Role of Topology Growth," in IEEE Journal on Selected Areas
|
|
95
|
-
in Communications, vol. 28, no. 8, pp. 1250-1261, October 2010.
|
|
96
|
-
"""
|
|
97
|
-
|
|
98
|
-
self.seed = seed
|
|
99
|
-
self.n_t = min(n, round(self.seed.random() * 2 + 4)) # num of T nodes
|
|
100
|
-
self.n_m = round(0.15 * n) # number of M nodes
|
|
101
|
-
self.n_cp = round(0.05 * n) # number of CP nodes
|
|
102
|
-
self.n_c = max(0, n - self.n_t - self.n_m - self.n_cp) # number of C nodes
|
|
103
|
-
|
|
104
|
-
self.d_m = 2 + (2.5 * n) / 10000 # average multihoming degree for M nodes
|
|
105
|
-
self.d_cp = 2 + (1.5 * n) / 10000 # avg multihoming degree for CP nodes
|
|
106
|
-
self.d_c = 1 + (5 * n) / 100000 # average multihoming degree for C nodes
|
|
107
|
-
|
|
108
|
-
self.p_m_m = 1 + (2 * n) / 10000 # avg num of peer edges between M and M
|
|
109
|
-
self.p_cp_m = 0.2 + (2 * n) / 10000 # avg num of peer edges between CP, M
|
|
110
|
-
self.p_cp_cp = 0.05 + (2 * n) / 100000 # avg num of peer edges btwn CP, CP
|
|
111
|
-
|
|
112
|
-
self.t_m = 0.375 # probability M's provider is T
|
|
113
|
-
self.t_cp = 0.375 # probability CP's provider is T
|
|
114
|
-
self.t_c = 0.125 # probability C's provider is T
|
|
115
|
-
|
|
116
|
-
def t_graph(self):
|
|
117
|
-
"""Generates the core mesh network of tier one nodes of a AS graph.
|
|
118
|
-
|
|
119
|
-
Returns
|
|
120
|
-
-------
|
|
121
|
-
G: Networkx Graph
|
|
122
|
-
Core network
|
|
123
|
-
"""
|
|
124
|
-
|
|
125
|
-
self.G = nx.Graph()
|
|
126
|
-
for i in range(self.n_t):
|
|
127
|
-
self.G.add_node(i, type="T")
|
|
128
|
-
for r in self.regions:
|
|
129
|
-
self.regions[r].add(i)
|
|
130
|
-
for j in self.G.nodes():
|
|
131
|
-
if i != j:
|
|
132
|
-
self.add_edge(i, j, "peer")
|
|
133
|
-
self.customers[i] = set()
|
|
134
|
-
self.providers[i] = set()
|
|
135
|
-
return self.G
|
|
136
|
-
|
|
137
|
-
def add_edge(self, i, j, kind):
|
|
138
|
-
if kind == "transit":
|
|
139
|
-
customer = str(i)
|
|
140
|
-
else:
|
|
141
|
-
customer = "none"
|
|
142
|
-
self.G.add_edge(i, j, type=kind, customer=customer)
|
|
143
|
-
|
|
144
|
-
def choose_peer_pref_attach(self, node_list):
|
|
145
|
-
"""Pick a node with a probability weighted by its peer degree.
|
|
146
|
-
|
|
147
|
-
Pick a node from node_list with preferential attachment
|
|
148
|
-
computed only on their peer degree
|
|
149
|
-
"""
|
|
150
|
-
|
|
151
|
-
d = {}
|
|
152
|
-
for n in node_list:
|
|
153
|
-
d[n] = self.G.nodes[n]["peers"]
|
|
154
|
-
return choose_pref_attach(d, self.seed)
|
|
155
|
-
|
|
156
|
-
def choose_node_pref_attach(self, node_list):
|
|
157
|
-
"""Pick a node with a probability weighted by its degree.
|
|
158
|
-
|
|
159
|
-
Pick a node from node_list with preferential attachment
|
|
160
|
-
computed on their degree
|
|
161
|
-
"""
|
|
162
|
-
|
|
163
|
-
degs = dict(self.G.degree(node_list))
|
|
164
|
-
return choose_pref_attach(degs, self.seed)
|
|
165
|
-
|
|
166
|
-
def add_customer(self, i, j):
|
|
167
|
-
"""Keep the dictionaries 'customers' and 'providers' consistent."""
|
|
168
|
-
|
|
169
|
-
self.customers[j].add(i)
|
|
170
|
-
self.providers[i].add(j)
|
|
171
|
-
for z in self.providers[j]:
|
|
172
|
-
self.customers[z].add(i)
|
|
173
|
-
self.providers[i].add(z)
|
|
174
|
-
|
|
175
|
-
def add_node(self, i, kind, reg2prob, avg_deg, t_edge_prob):
|
|
176
|
-
"""Add a node and its customer transit edges to the graph.
|
|
177
|
-
|
|
178
|
-
Parameters
|
|
179
|
-
----------
|
|
180
|
-
i: object
|
|
181
|
-
Identifier of the new node
|
|
182
|
-
kind: string
|
|
183
|
-
Type of the new node. Options are: 'M' for middle node, 'CP' for
|
|
184
|
-
content provider and 'C' for customer.
|
|
185
|
-
reg2prob: float
|
|
186
|
-
Probability the new node can be in two different regions.
|
|
187
|
-
avg_deg: float
|
|
188
|
-
Average number of transit nodes of which node i is customer.
|
|
189
|
-
t_edge_prob: float
|
|
190
|
-
Probability node i establish a customer transit edge with a tier
|
|
191
|
-
one (T) node
|
|
192
|
-
|
|
193
|
-
Returns
|
|
194
|
-
-------
|
|
195
|
-
i: object
|
|
196
|
-
Identifier of the new node
|
|
197
|
-
"""
|
|
198
|
-
|
|
199
|
-
regs = 1 # regions in which node resides
|
|
200
|
-
if self.seed.random() < reg2prob: # node is in two regions
|
|
201
|
-
regs = 2
|
|
202
|
-
node_options = set()
|
|
203
|
-
|
|
204
|
-
self.G.add_node(i, type=kind, peers=0)
|
|
205
|
-
self.customers[i] = set()
|
|
206
|
-
self.providers[i] = set()
|
|
207
|
-
self.nodes[kind].add(i)
|
|
208
|
-
for r in self.seed.sample(list(self.regions), regs):
|
|
209
|
-
node_options = node_options.union(self.regions[r])
|
|
210
|
-
self.regions[r].add(i)
|
|
211
|
-
|
|
212
|
-
edge_num = uniform_int_from_avg(1, avg_deg, self.seed)
|
|
213
|
-
|
|
214
|
-
t_options = node_options.intersection(self.nodes["T"])
|
|
215
|
-
m_options = node_options.intersection(self.nodes["M"])
|
|
216
|
-
if i in m_options:
|
|
217
|
-
m_options.remove(i)
|
|
218
|
-
d = 0
|
|
219
|
-
while d < edge_num and (len(t_options) > 0 or len(m_options) > 0):
|
|
220
|
-
if len(m_options) == 0 or (
|
|
221
|
-
len(t_options) > 0 and self.seed.random() < t_edge_prob
|
|
222
|
-
): # add edge to a T node
|
|
223
|
-
j = self.choose_node_pref_attach(t_options)
|
|
224
|
-
t_options.remove(j)
|
|
225
|
-
else:
|
|
226
|
-
j = self.choose_node_pref_attach(m_options)
|
|
227
|
-
m_options.remove(j)
|
|
228
|
-
self.add_edge(i, j, "transit")
|
|
229
|
-
self.add_customer(i, j)
|
|
230
|
-
d += 1
|
|
231
|
-
|
|
232
|
-
return i
|
|
233
|
-
|
|
234
|
-
def add_m_peering_link(self, m, to_kind):
|
|
235
|
-
"""Add a peering link between two middle tier (M) nodes.
|
|
236
|
-
|
|
237
|
-
Target node j is drawn considering a preferential attachment based on
|
|
238
|
-
other M node peering degree.
|
|
239
|
-
|
|
240
|
-
Parameters
|
|
241
|
-
----------
|
|
242
|
-
m: object
|
|
243
|
-
Node identifier
|
|
244
|
-
to_kind: string
|
|
245
|
-
type for target node j (must be always M)
|
|
246
|
-
|
|
247
|
-
Returns
|
|
248
|
-
-------
|
|
249
|
-
success: boolean
|
|
250
|
-
"""
|
|
251
|
-
|
|
252
|
-
# candidates are of type 'M' and are not customers of m
|
|
253
|
-
node_options = self.nodes["M"].difference(self.customers[m])
|
|
254
|
-
# candidates are not providers of m
|
|
255
|
-
node_options = node_options.difference(self.providers[m])
|
|
256
|
-
# remove self
|
|
257
|
-
if m in node_options:
|
|
258
|
-
node_options.remove(m)
|
|
259
|
-
|
|
260
|
-
# remove candidates we are already connected to
|
|
261
|
-
for j in self.G.neighbors(m):
|
|
262
|
-
if j in node_options:
|
|
263
|
-
node_options.remove(j)
|
|
264
|
-
|
|
265
|
-
if len(node_options) > 0:
|
|
266
|
-
j = self.choose_peer_pref_attach(node_options)
|
|
267
|
-
self.add_edge(m, j, "peer")
|
|
268
|
-
self.G.nodes[m]["peers"] += 1
|
|
269
|
-
self.G.nodes[j]["peers"] += 1
|
|
270
|
-
return True
|
|
271
|
-
else:
|
|
272
|
-
return False
|
|
273
|
-
|
|
274
|
-
def add_cp_peering_link(self, cp, to_kind):
|
|
275
|
-
"""Add a peering link to a content provider (CP) node.
|
|
276
|
-
|
|
277
|
-
Target node j can be CP or M and it is drawn uniformly among the nodes
|
|
278
|
-
belonging to the same region as cp.
|
|
279
|
-
|
|
280
|
-
Parameters
|
|
281
|
-
----------
|
|
282
|
-
cp: object
|
|
283
|
-
Node identifier
|
|
284
|
-
to_kind: string
|
|
285
|
-
type for target node j (must be M or CP)
|
|
286
|
-
|
|
287
|
-
Returns
|
|
288
|
-
-------
|
|
289
|
-
success: boolean
|
|
290
|
-
"""
|
|
291
|
-
|
|
292
|
-
node_options = set()
|
|
293
|
-
for r in self.regions: # options include nodes in the same region(s)
|
|
294
|
-
if cp in self.regions[r]:
|
|
295
|
-
node_options = node_options.union(self.regions[r])
|
|
296
|
-
|
|
297
|
-
# options are restricted to the indicated kind ('M' or 'CP')
|
|
298
|
-
node_options = self.nodes[to_kind].intersection(node_options)
|
|
299
|
-
|
|
300
|
-
# remove self
|
|
301
|
-
if cp in node_options:
|
|
302
|
-
node_options.remove(cp)
|
|
303
|
-
|
|
304
|
-
# remove nodes that are cp's providers
|
|
305
|
-
node_options = node_options.difference(self.providers[cp])
|
|
306
|
-
|
|
307
|
-
# remove nodes we are already connected to
|
|
308
|
-
for j in self.G.neighbors(cp):
|
|
309
|
-
if j in node_options:
|
|
310
|
-
node_options.remove(j)
|
|
311
|
-
|
|
312
|
-
if len(node_options) > 0:
|
|
313
|
-
j = self.seed.sample(list(node_options), 1)[0]
|
|
314
|
-
self.add_edge(cp, j, "peer")
|
|
315
|
-
self.G.nodes[cp]["peers"] += 1
|
|
316
|
-
self.G.nodes[j]["peers"] += 1
|
|
317
|
-
return True
|
|
318
|
-
else:
|
|
319
|
-
return False
|
|
320
|
-
|
|
321
|
-
def graph_regions(self, rn):
|
|
322
|
-
"""Initializes AS network regions.
|
|
323
|
-
|
|
324
|
-
Parameters
|
|
325
|
-
----------
|
|
326
|
-
rn: integer
|
|
327
|
-
Number of regions
|
|
328
|
-
"""
|
|
329
|
-
|
|
330
|
-
self.regions = {}
|
|
331
|
-
for i in range(rn):
|
|
332
|
-
self.regions["REG" + str(i)] = set()
|
|
333
|
-
|
|
334
|
-
def add_peering_links(self, from_kind, to_kind):
|
|
335
|
-
"""Utility function to add peering links among node groups."""
|
|
336
|
-
peer_link_method = None
|
|
337
|
-
if from_kind == "M":
|
|
338
|
-
peer_link_method = self.add_m_peering_link
|
|
339
|
-
m = self.p_m_m
|
|
340
|
-
if from_kind == "CP":
|
|
341
|
-
peer_link_method = self.add_cp_peering_link
|
|
342
|
-
if to_kind == "M":
|
|
343
|
-
m = self.p_cp_m
|
|
344
|
-
else:
|
|
345
|
-
m = self.p_cp_cp
|
|
346
|
-
|
|
347
|
-
for i in self.nodes[from_kind]:
|
|
348
|
-
num = uniform_int_from_avg(0, m, self.seed)
|
|
349
|
-
for _ in range(num):
|
|
350
|
-
peer_link_method(i, to_kind)
|
|
351
|
-
|
|
352
|
-
def generate(self):
|
|
353
|
-
"""Generates a random AS network graph as described in [1].
|
|
354
|
-
|
|
355
|
-
Returns
|
|
356
|
-
-------
|
|
357
|
-
G: Graph object
|
|
358
|
-
|
|
359
|
-
Notes
|
|
360
|
-
-----
|
|
361
|
-
The process steps are the following: first we create the core network
|
|
362
|
-
of tier one nodes, then we add the middle tier (M), the content
|
|
363
|
-
provider (CP) and the customer (C) nodes along with their transit edges
|
|
364
|
-
(link i,j means i is customer of j). Finally we add peering links
|
|
365
|
-
between M nodes, between M and CP nodes and between CP node couples.
|
|
366
|
-
For a detailed description of the algorithm, please refer to [1].
|
|
367
|
-
|
|
368
|
-
References
|
|
369
|
-
----------
|
|
370
|
-
[1] A. Elmokashfi, A. Kvalbein and C. Dovrolis, "On the Scalability of
|
|
371
|
-
BGP: The Role of Topology Growth," in IEEE Journal on Selected Areas
|
|
372
|
-
in Communications, vol. 28, no. 8, pp. 1250-1261, October 2010.
|
|
373
|
-
"""
|
|
374
|
-
|
|
375
|
-
self.graph_regions(5)
|
|
376
|
-
self.customers = {}
|
|
377
|
-
self.providers = {}
|
|
378
|
-
self.nodes = {"T": set(), "M": set(), "CP": set(), "C": set()}
|
|
379
|
-
|
|
380
|
-
self.t_graph()
|
|
381
|
-
self.nodes["T"] = set(self.G.nodes())
|
|
382
|
-
|
|
383
|
-
i = len(self.nodes["T"])
|
|
384
|
-
for _ in range(self.n_m):
|
|
385
|
-
self.nodes["M"].add(self.add_node(i, "M", 0.2, self.d_m, self.t_m))
|
|
386
|
-
i += 1
|
|
387
|
-
for _ in range(self.n_cp):
|
|
388
|
-
self.nodes["CP"].add(self.add_node(i, "CP", 0.05, self.d_cp, self.t_cp))
|
|
389
|
-
i += 1
|
|
390
|
-
for _ in range(self.n_c):
|
|
391
|
-
self.nodes["C"].add(self.add_node(i, "C", 0, self.d_c, self.t_c))
|
|
392
|
-
i += 1
|
|
393
|
-
|
|
394
|
-
self.add_peering_links("M", "M")
|
|
395
|
-
self.add_peering_links("CP", "M")
|
|
396
|
-
self.add_peering_links("CP", "CP")
|
|
397
|
-
|
|
398
|
-
return self.G
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
@py_random_state(1)
|
|
402
|
-
@nx._dispatchable(graphs=None, returns_graph=True)
|
|
403
|
-
def random_internet_as_graph(n, seed=None):
|
|
404
|
-
"""Generates a random undirected graph resembling the Internet AS network
|
|
405
|
-
|
|
406
|
-
Parameters
|
|
407
|
-
----------
|
|
408
|
-
n: integer in [1000, 10000]
|
|
409
|
-
Number of graph nodes
|
|
410
|
-
seed : integer, random_state, or None (default)
|
|
411
|
-
Indicator of random number generation state.
|
|
412
|
-
See :ref:`Randomness<randomness>`.
|
|
413
|
-
|
|
414
|
-
Returns
|
|
415
|
-
-------
|
|
416
|
-
G: Networkx Graph object
|
|
417
|
-
A randomly generated undirected graph
|
|
418
|
-
|
|
419
|
-
Notes
|
|
420
|
-
-----
|
|
421
|
-
This algorithm returns an undirected graph resembling the Internet
|
|
422
|
-
Autonomous System (AS) network, it uses the approach by Elmokashfi et al.
|
|
423
|
-
[1]_ and it grants the properties described in the related paper [1]_.
|
|
424
|
-
|
|
425
|
-
Each node models an autonomous system, with an attribute 'type' specifying
|
|
426
|
-
its kind; tier-1 (T), mid-level (M), customer (C) or content-provider (CP).
|
|
427
|
-
Each edge models an ADV communication link (hence, bidirectional) with
|
|
428
|
-
attributes:
|
|
429
|
-
|
|
430
|
-
- type: transit|peer, the kind of commercial agreement between nodes;
|
|
431
|
-
- customer: <node id>, the identifier of the node acting as customer
|
|
432
|
-
('none' if type is peer).
|
|
433
|
-
|
|
434
|
-
References
|
|
435
|
-
----------
|
|
436
|
-
.. [1] A. Elmokashfi, A. Kvalbein and C. Dovrolis, "On the Scalability of
|
|
437
|
-
BGP: The Role of Topology Growth," in IEEE Journal on Selected Areas
|
|
438
|
-
in Communications, vol. 28, no. 8, pp. 1250-1261, October 2010.
|
|
439
|
-
"""
|
|
440
|
-
|
|
441
|
-
GG = AS_graph_generator(n, seed)
|
|
442
|
-
G = GG.generate()
|
|
443
|
-
return G
|