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,554 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Famous social networks.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
import networkx as nx
|
|
6
|
-
|
|
7
|
-
__all__ = [
|
|
8
|
-
"karate_club_graph",
|
|
9
|
-
"davis_southern_women_graph",
|
|
10
|
-
"florentine_families_graph",
|
|
11
|
-
"les_miserables_graph",
|
|
12
|
-
]
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@nx._dispatchable(graphs=None, returns_graph=True)
|
|
16
|
-
def karate_club_graph():
|
|
17
|
-
"""Returns Zachary's Karate Club graph.
|
|
18
|
-
|
|
19
|
-
Each node in the returned graph has a node attribute 'club' that
|
|
20
|
-
indicates the name of the club to which the member represented by that node
|
|
21
|
-
belongs, either 'Mr. Hi' or 'Officer'. Each edge has a weight based on the
|
|
22
|
-
number of contexts in which that edge's incident node members interacted.
|
|
23
|
-
|
|
24
|
-
The dataset is derived from the 'Club After Split From Data' column of Table 3 in [1]_.
|
|
25
|
-
This was in turn derived from the 'Club After Fission' column of Table 1 in the
|
|
26
|
-
same paper. Note that the nodes are 0-indexed in NetworkX, but 1-indexed in the
|
|
27
|
-
paper (the 'Individual Number in Matrix C' column of Table 3 starts at 1). This
|
|
28
|
-
means, for example, that ``G.nodes[9]["club"]`` returns 'Officer', which
|
|
29
|
-
corresponds to row 10 of Table 3 in the paper.
|
|
30
|
-
|
|
31
|
-
Examples
|
|
32
|
-
--------
|
|
33
|
-
To get the name of the club to which a node belongs:
|
|
34
|
-
|
|
35
|
-
>>> G = nx.karate_club_graph()
|
|
36
|
-
>>> G.nodes[5]["club"]
|
|
37
|
-
'Mr. Hi'
|
|
38
|
-
>>> G.nodes[9]["club"]
|
|
39
|
-
'Officer'
|
|
40
|
-
|
|
41
|
-
References
|
|
42
|
-
----------
|
|
43
|
-
.. [1] Zachary, Wayne W.
|
|
44
|
-
"An Information Flow Model for Conflict and Fission in Small Groups."
|
|
45
|
-
*Journal of Anthropological Research*, 33, 452--473, (1977).
|
|
46
|
-
"""
|
|
47
|
-
# Create the set of all members, and the members of each club.
|
|
48
|
-
all_members = set(range(34))
|
|
49
|
-
club1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 16, 17, 19, 21}
|
|
50
|
-
# club2 = all_members - club1
|
|
51
|
-
|
|
52
|
-
G = nx.Graph()
|
|
53
|
-
G.add_nodes_from(all_members)
|
|
54
|
-
G.name = "Zachary's Karate Club"
|
|
55
|
-
|
|
56
|
-
zacharydat = """\
|
|
57
|
-
0 4 5 3 3 3 3 2 2 0 2 3 2 3 0 0 0 2 0 2 0 2 0 0 0 0 0 0 0 0 0 2 0 0
|
|
58
|
-
4 0 6 3 0 0 0 4 0 0 0 0 0 5 0 0 0 1 0 2 0 2 0 0 0 0 0 0 0 0 2 0 0 0
|
|
59
|
-
5 6 0 3 0 0 0 4 5 1 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 0 0 0 3 0
|
|
60
|
-
3 3 3 0 0 0 0 3 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
61
|
-
3 0 0 0 0 0 2 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
62
|
-
3 0 0 0 0 0 5 0 0 0 3 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
63
|
-
3 0 0 0 2 5 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
64
|
-
2 4 4 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
65
|
-
2 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 4 3
|
|
66
|
-
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2
|
|
67
|
-
2 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
68
|
-
3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
69
|
-
1 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
70
|
-
3 5 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3
|
|
71
|
-
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 2
|
|
72
|
-
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4
|
|
73
|
-
0 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
74
|
-
2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
75
|
-
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2
|
|
76
|
-
2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
|
|
77
|
-
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 1
|
|
78
|
-
2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
79
|
-
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0
|
|
80
|
-
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 4 0 2 0 0 5 4
|
|
81
|
-
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 3 0 0 0 2 0 0
|
|
82
|
-
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 2 0 0 0 0 0 0 7 0 0
|
|
83
|
-
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 2
|
|
84
|
-
0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 3 0 0 0 0 0 0 0 0 4
|
|
85
|
-
0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 2
|
|
86
|
-
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 4 0 0 0 0 0 3 2
|
|
87
|
-
0 2 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3
|
|
88
|
-
2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 7 0 0 2 0 0 0 4 4
|
|
89
|
-
0 0 2 0 0 0 0 0 3 0 0 0 0 0 3 3 0 0 1 0 3 0 2 5 0 0 0 0 0 4 3 4 0 5
|
|
90
|
-
0 0 0 0 0 0 0 0 4 2 0 0 0 3 2 4 0 0 2 1 1 0 3 4 0 0 2 4 2 2 3 4 5 0"""
|
|
91
|
-
|
|
92
|
-
for row, line in enumerate(zacharydat.split("\n")):
|
|
93
|
-
thisrow = [int(b) for b in line.split()]
|
|
94
|
-
for col, entry in enumerate(thisrow):
|
|
95
|
-
if entry >= 1:
|
|
96
|
-
G.add_edge(row, col, weight=entry)
|
|
97
|
-
|
|
98
|
-
# Add the name of each member's club as a node attribute.
|
|
99
|
-
for v in G:
|
|
100
|
-
G.nodes[v]["club"] = "Mr. Hi" if v in club1 else "Officer"
|
|
101
|
-
return G
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
@nx._dispatchable(graphs=None, returns_graph=True)
|
|
105
|
-
def davis_southern_women_graph():
|
|
106
|
-
"""Returns Davis Southern women social network.
|
|
107
|
-
|
|
108
|
-
This is a bipartite graph.
|
|
109
|
-
|
|
110
|
-
References
|
|
111
|
-
----------
|
|
112
|
-
.. [1] A. Davis, Gardner, B. B., Gardner, M. R., 1941. Deep South.
|
|
113
|
-
University of Chicago Press, Chicago, IL.
|
|
114
|
-
"""
|
|
115
|
-
G = nx.Graph()
|
|
116
|
-
# Top nodes
|
|
117
|
-
women = [
|
|
118
|
-
"Evelyn Jefferson",
|
|
119
|
-
"Laura Mandeville",
|
|
120
|
-
"Theresa Anderson",
|
|
121
|
-
"Brenda Rogers",
|
|
122
|
-
"Charlotte McDowd",
|
|
123
|
-
"Frances Anderson",
|
|
124
|
-
"Eleanor Nye",
|
|
125
|
-
"Pearl Oglethorpe",
|
|
126
|
-
"Ruth DeSand",
|
|
127
|
-
"Verne Sanderson",
|
|
128
|
-
"Myra Liddel",
|
|
129
|
-
"Katherina Rogers",
|
|
130
|
-
"Sylvia Avondale",
|
|
131
|
-
"Nora Fayette",
|
|
132
|
-
"Helen Lloyd",
|
|
133
|
-
"Dorothy Murchison",
|
|
134
|
-
"Olivia Carleton",
|
|
135
|
-
"Flora Price",
|
|
136
|
-
]
|
|
137
|
-
G.add_nodes_from(women, bipartite=0)
|
|
138
|
-
# Bottom nodes
|
|
139
|
-
events = [
|
|
140
|
-
"E1",
|
|
141
|
-
"E2",
|
|
142
|
-
"E3",
|
|
143
|
-
"E4",
|
|
144
|
-
"E5",
|
|
145
|
-
"E6",
|
|
146
|
-
"E7",
|
|
147
|
-
"E8",
|
|
148
|
-
"E9",
|
|
149
|
-
"E10",
|
|
150
|
-
"E11",
|
|
151
|
-
"E12",
|
|
152
|
-
"E13",
|
|
153
|
-
"E14",
|
|
154
|
-
]
|
|
155
|
-
G.add_nodes_from(events, bipartite=1)
|
|
156
|
-
|
|
157
|
-
G.add_edges_from(
|
|
158
|
-
[
|
|
159
|
-
("Evelyn Jefferson", "E1"),
|
|
160
|
-
("Evelyn Jefferson", "E2"),
|
|
161
|
-
("Evelyn Jefferson", "E3"),
|
|
162
|
-
("Evelyn Jefferson", "E4"),
|
|
163
|
-
("Evelyn Jefferson", "E5"),
|
|
164
|
-
("Evelyn Jefferson", "E6"),
|
|
165
|
-
("Evelyn Jefferson", "E8"),
|
|
166
|
-
("Evelyn Jefferson", "E9"),
|
|
167
|
-
("Laura Mandeville", "E1"),
|
|
168
|
-
("Laura Mandeville", "E2"),
|
|
169
|
-
("Laura Mandeville", "E3"),
|
|
170
|
-
("Laura Mandeville", "E5"),
|
|
171
|
-
("Laura Mandeville", "E6"),
|
|
172
|
-
("Laura Mandeville", "E7"),
|
|
173
|
-
("Laura Mandeville", "E8"),
|
|
174
|
-
("Theresa Anderson", "E2"),
|
|
175
|
-
("Theresa Anderson", "E3"),
|
|
176
|
-
("Theresa Anderson", "E4"),
|
|
177
|
-
("Theresa Anderson", "E5"),
|
|
178
|
-
("Theresa Anderson", "E6"),
|
|
179
|
-
("Theresa Anderson", "E7"),
|
|
180
|
-
("Theresa Anderson", "E8"),
|
|
181
|
-
("Theresa Anderson", "E9"),
|
|
182
|
-
("Brenda Rogers", "E1"),
|
|
183
|
-
("Brenda Rogers", "E3"),
|
|
184
|
-
("Brenda Rogers", "E4"),
|
|
185
|
-
("Brenda Rogers", "E5"),
|
|
186
|
-
("Brenda Rogers", "E6"),
|
|
187
|
-
("Brenda Rogers", "E7"),
|
|
188
|
-
("Brenda Rogers", "E8"),
|
|
189
|
-
("Charlotte McDowd", "E3"),
|
|
190
|
-
("Charlotte McDowd", "E4"),
|
|
191
|
-
("Charlotte McDowd", "E5"),
|
|
192
|
-
("Charlotte McDowd", "E7"),
|
|
193
|
-
("Frances Anderson", "E3"),
|
|
194
|
-
("Frances Anderson", "E5"),
|
|
195
|
-
("Frances Anderson", "E6"),
|
|
196
|
-
("Frances Anderson", "E8"),
|
|
197
|
-
("Eleanor Nye", "E5"),
|
|
198
|
-
("Eleanor Nye", "E6"),
|
|
199
|
-
("Eleanor Nye", "E7"),
|
|
200
|
-
("Eleanor Nye", "E8"),
|
|
201
|
-
("Pearl Oglethorpe", "E6"),
|
|
202
|
-
("Pearl Oglethorpe", "E8"),
|
|
203
|
-
("Pearl Oglethorpe", "E9"),
|
|
204
|
-
("Ruth DeSand", "E5"),
|
|
205
|
-
("Ruth DeSand", "E7"),
|
|
206
|
-
("Ruth DeSand", "E8"),
|
|
207
|
-
("Ruth DeSand", "E9"),
|
|
208
|
-
("Verne Sanderson", "E7"),
|
|
209
|
-
("Verne Sanderson", "E8"),
|
|
210
|
-
("Verne Sanderson", "E9"),
|
|
211
|
-
("Verne Sanderson", "E12"),
|
|
212
|
-
("Myra Liddel", "E8"),
|
|
213
|
-
("Myra Liddel", "E9"),
|
|
214
|
-
("Myra Liddel", "E10"),
|
|
215
|
-
("Myra Liddel", "E12"),
|
|
216
|
-
("Katherina Rogers", "E8"),
|
|
217
|
-
("Katherina Rogers", "E9"),
|
|
218
|
-
("Katherina Rogers", "E10"),
|
|
219
|
-
("Katherina Rogers", "E12"),
|
|
220
|
-
("Katherina Rogers", "E13"),
|
|
221
|
-
("Katherina Rogers", "E14"),
|
|
222
|
-
("Sylvia Avondale", "E7"),
|
|
223
|
-
("Sylvia Avondale", "E8"),
|
|
224
|
-
("Sylvia Avondale", "E9"),
|
|
225
|
-
("Sylvia Avondale", "E10"),
|
|
226
|
-
("Sylvia Avondale", "E12"),
|
|
227
|
-
("Sylvia Avondale", "E13"),
|
|
228
|
-
("Sylvia Avondale", "E14"),
|
|
229
|
-
("Nora Fayette", "E6"),
|
|
230
|
-
("Nora Fayette", "E7"),
|
|
231
|
-
("Nora Fayette", "E9"),
|
|
232
|
-
("Nora Fayette", "E10"),
|
|
233
|
-
("Nora Fayette", "E11"),
|
|
234
|
-
("Nora Fayette", "E12"),
|
|
235
|
-
("Nora Fayette", "E13"),
|
|
236
|
-
("Nora Fayette", "E14"),
|
|
237
|
-
("Helen Lloyd", "E7"),
|
|
238
|
-
("Helen Lloyd", "E8"),
|
|
239
|
-
("Helen Lloyd", "E10"),
|
|
240
|
-
("Helen Lloyd", "E11"),
|
|
241
|
-
("Helen Lloyd", "E12"),
|
|
242
|
-
("Dorothy Murchison", "E8"),
|
|
243
|
-
("Dorothy Murchison", "E9"),
|
|
244
|
-
("Olivia Carleton", "E9"),
|
|
245
|
-
("Olivia Carleton", "E11"),
|
|
246
|
-
("Flora Price", "E9"),
|
|
247
|
-
("Flora Price", "E11"),
|
|
248
|
-
]
|
|
249
|
-
)
|
|
250
|
-
G.graph["top"] = women
|
|
251
|
-
G.graph["bottom"] = events
|
|
252
|
-
return G
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
@nx._dispatchable(graphs=None, returns_graph=True)
|
|
256
|
-
def florentine_families_graph():
|
|
257
|
-
"""Returns Florentine families graph.
|
|
258
|
-
|
|
259
|
-
References
|
|
260
|
-
----------
|
|
261
|
-
.. [1] Ronald L. Breiger and Philippa E. Pattison
|
|
262
|
-
Cumulated social roles: The duality of persons and their algebras,1
|
|
263
|
-
Social Networks, Volume 8, Issue 3, September 1986, Pages 215-256
|
|
264
|
-
"""
|
|
265
|
-
G = nx.Graph()
|
|
266
|
-
G.add_edge("Acciaiuoli", "Medici")
|
|
267
|
-
G.add_edge("Castellani", "Peruzzi")
|
|
268
|
-
G.add_edge("Castellani", "Strozzi")
|
|
269
|
-
G.add_edge("Castellani", "Barbadori")
|
|
270
|
-
G.add_edge("Medici", "Barbadori")
|
|
271
|
-
G.add_edge("Medici", "Ridolfi")
|
|
272
|
-
G.add_edge("Medici", "Tornabuoni")
|
|
273
|
-
G.add_edge("Medici", "Albizzi")
|
|
274
|
-
G.add_edge("Medici", "Salviati")
|
|
275
|
-
G.add_edge("Salviati", "Pazzi")
|
|
276
|
-
G.add_edge("Peruzzi", "Strozzi")
|
|
277
|
-
G.add_edge("Peruzzi", "Bischeri")
|
|
278
|
-
G.add_edge("Strozzi", "Ridolfi")
|
|
279
|
-
G.add_edge("Strozzi", "Bischeri")
|
|
280
|
-
G.add_edge("Ridolfi", "Tornabuoni")
|
|
281
|
-
G.add_edge("Tornabuoni", "Guadagni")
|
|
282
|
-
G.add_edge("Albizzi", "Ginori")
|
|
283
|
-
G.add_edge("Albizzi", "Guadagni")
|
|
284
|
-
G.add_edge("Bischeri", "Guadagni")
|
|
285
|
-
G.add_edge("Guadagni", "Lamberteschi")
|
|
286
|
-
return G
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
@nx._dispatchable(graphs=None, returns_graph=True)
|
|
290
|
-
def les_miserables_graph():
|
|
291
|
-
"""Returns coappearance network of characters in the novel Les Miserables.
|
|
292
|
-
|
|
293
|
-
References
|
|
294
|
-
----------
|
|
295
|
-
.. [1] D. E. Knuth, 1993.
|
|
296
|
-
The Stanford GraphBase: a platform for combinatorial computing,
|
|
297
|
-
pp. 74-87. New York: AcM Press.
|
|
298
|
-
"""
|
|
299
|
-
G = nx.Graph()
|
|
300
|
-
G.add_edge("Napoleon", "Myriel", weight=1)
|
|
301
|
-
G.add_edge("MlleBaptistine", "Myriel", weight=8)
|
|
302
|
-
G.add_edge("MmeMagloire", "Myriel", weight=10)
|
|
303
|
-
G.add_edge("MmeMagloire", "MlleBaptistine", weight=6)
|
|
304
|
-
G.add_edge("CountessDeLo", "Myriel", weight=1)
|
|
305
|
-
G.add_edge("Geborand", "Myriel", weight=1)
|
|
306
|
-
G.add_edge("Champtercier", "Myriel", weight=1)
|
|
307
|
-
G.add_edge("Cravatte", "Myriel", weight=1)
|
|
308
|
-
G.add_edge("Count", "Myriel", weight=2)
|
|
309
|
-
G.add_edge("OldMan", "Myriel", weight=1)
|
|
310
|
-
G.add_edge("Valjean", "Labarre", weight=1)
|
|
311
|
-
G.add_edge("Valjean", "MmeMagloire", weight=3)
|
|
312
|
-
G.add_edge("Valjean", "MlleBaptistine", weight=3)
|
|
313
|
-
G.add_edge("Valjean", "Myriel", weight=5)
|
|
314
|
-
G.add_edge("Marguerite", "Valjean", weight=1)
|
|
315
|
-
G.add_edge("MmeDeR", "Valjean", weight=1)
|
|
316
|
-
G.add_edge("Isabeau", "Valjean", weight=1)
|
|
317
|
-
G.add_edge("Gervais", "Valjean", weight=1)
|
|
318
|
-
G.add_edge("Listolier", "Tholomyes", weight=4)
|
|
319
|
-
G.add_edge("Fameuil", "Tholomyes", weight=4)
|
|
320
|
-
G.add_edge("Fameuil", "Listolier", weight=4)
|
|
321
|
-
G.add_edge("Blacheville", "Tholomyes", weight=4)
|
|
322
|
-
G.add_edge("Blacheville", "Listolier", weight=4)
|
|
323
|
-
G.add_edge("Blacheville", "Fameuil", weight=4)
|
|
324
|
-
G.add_edge("Favourite", "Tholomyes", weight=3)
|
|
325
|
-
G.add_edge("Favourite", "Listolier", weight=3)
|
|
326
|
-
G.add_edge("Favourite", "Fameuil", weight=3)
|
|
327
|
-
G.add_edge("Favourite", "Blacheville", weight=4)
|
|
328
|
-
G.add_edge("Dahlia", "Tholomyes", weight=3)
|
|
329
|
-
G.add_edge("Dahlia", "Listolier", weight=3)
|
|
330
|
-
G.add_edge("Dahlia", "Fameuil", weight=3)
|
|
331
|
-
G.add_edge("Dahlia", "Blacheville", weight=3)
|
|
332
|
-
G.add_edge("Dahlia", "Favourite", weight=5)
|
|
333
|
-
G.add_edge("Zephine", "Tholomyes", weight=3)
|
|
334
|
-
G.add_edge("Zephine", "Listolier", weight=3)
|
|
335
|
-
G.add_edge("Zephine", "Fameuil", weight=3)
|
|
336
|
-
G.add_edge("Zephine", "Blacheville", weight=3)
|
|
337
|
-
G.add_edge("Zephine", "Favourite", weight=4)
|
|
338
|
-
G.add_edge("Zephine", "Dahlia", weight=4)
|
|
339
|
-
G.add_edge("Fantine", "Tholomyes", weight=3)
|
|
340
|
-
G.add_edge("Fantine", "Listolier", weight=3)
|
|
341
|
-
G.add_edge("Fantine", "Fameuil", weight=3)
|
|
342
|
-
G.add_edge("Fantine", "Blacheville", weight=3)
|
|
343
|
-
G.add_edge("Fantine", "Favourite", weight=4)
|
|
344
|
-
G.add_edge("Fantine", "Dahlia", weight=4)
|
|
345
|
-
G.add_edge("Fantine", "Zephine", weight=4)
|
|
346
|
-
G.add_edge("Fantine", "Marguerite", weight=2)
|
|
347
|
-
G.add_edge("Fantine", "Valjean", weight=9)
|
|
348
|
-
G.add_edge("MmeThenardier", "Fantine", weight=2)
|
|
349
|
-
G.add_edge("MmeThenardier", "Valjean", weight=7)
|
|
350
|
-
G.add_edge("Thenardier", "MmeThenardier", weight=13)
|
|
351
|
-
G.add_edge("Thenardier", "Fantine", weight=1)
|
|
352
|
-
G.add_edge("Thenardier", "Valjean", weight=12)
|
|
353
|
-
G.add_edge("Cosette", "MmeThenardier", weight=4)
|
|
354
|
-
G.add_edge("Cosette", "Valjean", weight=31)
|
|
355
|
-
G.add_edge("Cosette", "Tholomyes", weight=1)
|
|
356
|
-
G.add_edge("Cosette", "Thenardier", weight=1)
|
|
357
|
-
G.add_edge("Javert", "Valjean", weight=17)
|
|
358
|
-
G.add_edge("Javert", "Fantine", weight=5)
|
|
359
|
-
G.add_edge("Javert", "Thenardier", weight=5)
|
|
360
|
-
G.add_edge("Javert", "MmeThenardier", weight=1)
|
|
361
|
-
G.add_edge("Javert", "Cosette", weight=1)
|
|
362
|
-
G.add_edge("Fauchelevent", "Valjean", weight=8)
|
|
363
|
-
G.add_edge("Fauchelevent", "Javert", weight=1)
|
|
364
|
-
G.add_edge("Bamatabois", "Fantine", weight=1)
|
|
365
|
-
G.add_edge("Bamatabois", "Javert", weight=1)
|
|
366
|
-
G.add_edge("Bamatabois", "Valjean", weight=2)
|
|
367
|
-
G.add_edge("Perpetue", "Fantine", weight=1)
|
|
368
|
-
G.add_edge("Simplice", "Perpetue", weight=2)
|
|
369
|
-
G.add_edge("Simplice", "Valjean", weight=3)
|
|
370
|
-
G.add_edge("Simplice", "Fantine", weight=2)
|
|
371
|
-
G.add_edge("Simplice", "Javert", weight=1)
|
|
372
|
-
G.add_edge("Scaufflaire", "Valjean", weight=1)
|
|
373
|
-
G.add_edge("Woman1", "Valjean", weight=2)
|
|
374
|
-
G.add_edge("Woman1", "Javert", weight=1)
|
|
375
|
-
G.add_edge("Judge", "Valjean", weight=3)
|
|
376
|
-
G.add_edge("Judge", "Bamatabois", weight=2)
|
|
377
|
-
G.add_edge("Champmathieu", "Valjean", weight=3)
|
|
378
|
-
G.add_edge("Champmathieu", "Judge", weight=3)
|
|
379
|
-
G.add_edge("Champmathieu", "Bamatabois", weight=2)
|
|
380
|
-
G.add_edge("Brevet", "Judge", weight=2)
|
|
381
|
-
G.add_edge("Brevet", "Champmathieu", weight=2)
|
|
382
|
-
G.add_edge("Brevet", "Valjean", weight=2)
|
|
383
|
-
G.add_edge("Brevet", "Bamatabois", weight=1)
|
|
384
|
-
G.add_edge("Chenildieu", "Judge", weight=2)
|
|
385
|
-
G.add_edge("Chenildieu", "Champmathieu", weight=2)
|
|
386
|
-
G.add_edge("Chenildieu", "Brevet", weight=2)
|
|
387
|
-
G.add_edge("Chenildieu", "Valjean", weight=2)
|
|
388
|
-
G.add_edge("Chenildieu", "Bamatabois", weight=1)
|
|
389
|
-
G.add_edge("Cochepaille", "Judge", weight=2)
|
|
390
|
-
G.add_edge("Cochepaille", "Champmathieu", weight=2)
|
|
391
|
-
G.add_edge("Cochepaille", "Brevet", weight=2)
|
|
392
|
-
G.add_edge("Cochepaille", "Chenildieu", weight=2)
|
|
393
|
-
G.add_edge("Cochepaille", "Valjean", weight=2)
|
|
394
|
-
G.add_edge("Cochepaille", "Bamatabois", weight=1)
|
|
395
|
-
G.add_edge("Pontmercy", "Thenardier", weight=1)
|
|
396
|
-
G.add_edge("Boulatruelle", "Thenardier", weight=1)
|
|
397
|
-
G.add_edge("Eponine", "MmeThenardier", weight=2)
|
|
398
|
-
G.add_edge("Eponine", "Thenardier", weight=3)
|
|
399
|
-
G.add_edge("Anzelma", "Eponine", weight=2)
|
|
400
|
-
G.add_edge("Anzelma", "Thenardier", weight=2)
|
|
401
|
-
G.add_edge("Anzelma", "MmeThenardier", weight=1)
|
|
402
|
-
G.add_edge("Woman2", "Valjean", weight=3)
|
|
403
|
-
G.add_edge("Woman2", "Cosette", weight=1)
|
|
404
|
-
G.add_edge("Woman2", "Javert", weight=1)
|
|
405
|
-
G.add_edge("MotherInnocent", "Fauchelevent", weight=3)
|
|
406
|
-
G.add_edge("MotherInnocent", "Valjean", weight=1)
|
|
407
|
-
G.add_edge("Gribier", "Fauchelevent", weight=2)
|
|
408
|
-
G.add_edge("MmeBurgon", "Jondrette", weight=1)
|
|
409
|
-
G.add_edge("Gavroche", "MmeBurgon", weight=2)
|
|
410
|
-
G.add_edge("Gavroche", "Thenardier", weight=1)
|
|
411
|
-
G.add_edge("Gavroche", "Javert", weight=1)
|
|
412
|
-
G.add_edge("Gavroche", "Valjean", weight=1)
|
|
413
|
-
G.add_edge("Gillenormand", "Cosette", weight=3)
|
|
414
|
-
G.add_edge("Gillenormand", "Valjean", weight=2)
|
|
415
|
-
G.add_edge("Magnon", "Gillenormand", weight=1)
|
|
416
|
-
G.add_edge("Magnon", "MmeThenardier", weight=1)
|
|
417
|
-
G.add_edge("MlleGillenormand", "Gillenormand", weight=9)
|
|
418
|
-
G.add_edge("MlleGillenormand", "Cosette", weight=2)
|
|
419
|
-
G.add_edge("MlleGillenormand", "Valjean", weight=2)
|
|
420
|
-
G.add_edge("MmePontmercy", "MlleGillenormand", weight=1)
|
|
421
|
-
G.add_edge("MmePontmercy", "Pontmercy", weight=1)
|
|
422
|
-
G.add_edge("MlleVaubois", "MlleGillenormand", weight=1)
|
|
423
|
-
G.add_edge("LtGillenormand", "MlleGillenormand", weight=2)
|
|
424
|
-
G.add_edge("LtGillenormand", "Gillenormand", weight=1)
|
|
425
|
-
G.add_edge("LtGillenormand", "Cosette", weight=1)
|
|
426
|
-
G.add_edge("Marius", "MlleGillenormand", weight=6)
|
|
427
|
-
G.add_edge("Marius", "Gillenormand", weight=12)
|
|
428
|
-
G.add_edge("Marius", "Pontmercy", weight=1)
|
|
429
|
-
G.add_edge("Marius", "LtGillenormand", weight=1)
|
|
430
|
-
G.add_edge("Marius", "Cosette", weight=21)
|
|
431
|
-
G.add_edge("Marius", "Valjean", weight=19)
|
|
432
|
-
G.add_edge("Marius", "Tholomyes", weight=1)
|
|
433
|
-
G.add_edge("Marius", "Thenardier", weight=2)
|
|
434
|
-
G.add_edge("Marius", "Eponine", weight=5)
|
|
435
|
-
G.add_edge("Marius", "Gavroche", weight=4)
|
|
436
|
-
G.add_edge("BaronessT", "Gillenormand", weight=1)
|
|
437
|
-
G.add_edge("BaronessT", "Marius", weight=1)
|
|
438
|
-
G.add_edge("Mabeuf", "Marius", weight=1)
|
|
439
|
-
G.add_edge("Mabeuf", "Eponine", weight=1)
|
|
440
|
-
G.add_edge("Mabeuf", "Gavroche", weight=1)
|
|
441
|
-
G.add_edge("Enjolras", "Marius", weight=7)
|
|
442
|
-
G.add_edge("Enjolras", "Gavroche", weight=7)
|
|
443
|
-
G.add_edge("Enjolras", "Javert", weight=6)
|
|
444
|
-
G.add_edge("Enjolras", "Mabeuf", weight=1)
|
|
445
|
-
G.add_edge("Enjolras", "Valjean", weight=4)
|
|
446
|
-
G.add_edge("Combeferre", "Enjolras", weight=15)
|
|
447
|
-
G.add_edge("Combeferre", "Marius", weight=5)
|
|
448
|
-
G.add_edge("Combeferre", "Gavroche", weight=6)
|
|
449
|
-
G.add_edge("Combeferre", "Mabeuf", weight=2)
|
|
450
|
-
G.add_edge("Prouvaire", "Gavroche", weight=1)
|
|
451
|
-
G.add_edge("Prouvaire", "Enjolras", weight=4)
|
|
452
|
-
G.add_edge("Prouvaire", "Combeferre", weight=2)
|
|
453
|
-
G.add_edge("Feuilly", "Gavroche", weight=2)
|
|
454
|
-
G.add_edge("Feuilly", "Enjolras", weight=6)
|
|
455
|
-
G.add_edge("Feuilly", "Prouvaire", weight=2)
|
|
456
|
-
G.add_edge("Feuilly", "Combeferre", weight=5)
|
|
457
|
-
G.add_edge("Feuilly", "Mabeuf", weight=1)
|
|
458
|
-
G.add_edge("Feuilly", "Marius", weight=1)
|
|
459
|
-
G.add_edge("Courfeyrac", "Marius", weight=9)
|
|
460
|
-
G.add_edge("Courfeyrac", "Enjolras", weight=17)
|
|
461
|
-
G.add_edge("Courfeyrac", "Combeferre", weight=13)
|
|
462
|
-
G.add_edge("Courfeyrac", "Gavroche", weight=7)
|
|
463
|
-
G.add_edge("Courfeyrac", "Mabeuf", weight=2)
|
|
464
|
-
G.add_edge("Courfeyrac", "Eponine", weight=1)
|
|
465
|
-
G.add_edge("Courfeyrac", "Feuilly", weight=6)
|
|
466
|
-
G.add_edge("Courfeyrac", "Prouvaire", weight=3)
|
|
467
|
-
G.add_edge("Bahorel", "Combeferre", weight=5)
|
|
468
|
-
G.add_edge("Bahorel", "Gavroche", weight=5)
|
|
469
|
-
G.add_edge("Bahorel", "Courfeyrac", weight=6)
|
|
470
|
-
G.add_edge("Bahorel", "Mabeuf", weight=2)
|
|
471
|
-
G.add_edge("Bahorel", "Enjolras", weight=4)
|
|
472
|
-
G.add_edge("Bahorel", "Feuilly", weight=3)
|
|
473
|
-
G.add_edge("Bahorel", "Prouvaire", weight=2)
|
|
474
|
-
G.add_edge("Bahorel", "Marius", weight=1)
|
|
475
|
-
G.add_edge("Bossuet", "Marius", weight=5)
|
|
476
|
-
G.add_edge("Bossuet", "Courfeyrac", weight=12)
|
|
477
|
-
G.add_edge("Bossuet", "Gavroche", weight=5)
|
|
478
|
-
G.add_edge("Bossuet", "Bahorel", weight=4)
|
|
479
|
-
G.add_edge("Bossuet", "Enjolras", weight=10)
|
|
480
|
-
G.add_edge("Bossuet", "Feuilly", weight=6)
|
|
481
|
-
G.add_edge("Bossuet", "Prouvaire", weight=2)
|
|
482
|
-
G.add_edge("Bossuet", "Combeferre", weight=9)
|
|
483
|
-
G.add_edge("Bossuet", "Mabeuf", weight=1)
|
|
484
|
-
G.add_edge("Bossuet", "Valjean", weight=1)
|
|
485
|
-
G.add_edge("Joly", "Bahorel", weight=5)
|
|
486
|
-
G.add_edge("Joly", "Bossuet", weight=7)
|
|
487
|
-
G.add_edge("Joly", "Gavroche", weight=3)
|
|
488
|
-
G.add_edge("Joly", "Courfeyrac", weight=5)
|
|
489
|
-
G.add_edge("Joly", "Enjolras", weight=5)
|
|
490
|
-
G.add_edge("Joly", "Feuilly", weight=5)
|
|
491
|
-
G.add_edge("Joly", "Prouvaire", weight=2)
|
|
492
|
-
G.add_edge("Joly", "Combeferre", weight=5)
|
|
493
|
-
G.add_edge("Joly", "Mabeuf", weight=1)
|
|
494
|
-
G.add_edge("Joly", "Marius", weight=2)
|
|
495
|
-
G.add_edge("Grantaire", "Bossuet", weight=3)
|
|
496
|
-
G.add_edge("Grantaire", "Enjolras", weight=3)
|
|
497
|
-
G.add_edge("Grantaire", "Combeferre", weight=1)
|
|
498
|
-
G.add_edge("Grantaire", "Courfeyrac", weight=2)
|
|
499
|
-
G.add_edge("Grantaire", "Joly", weight=2)
|
|
500
|
-
G.add_edge("Grantaire", "Gavroche", weight=1)
|
|
501
|
-
G.add_edge("Grantaire", "Bahorel", weight=1)
|
|
502
|
-
G.add_edge("Grantaire", "Feuilly", weight=1)
|
|
503
|
-
G.add_edge("Grantaire", "Prouvaire", weight=1)
|
|
504
|
-
G.add_edge("MotherPlutarch", "Mabeuf", weight=3)
|
|
505
|
-
G.add_edge("Gueulemer", "Thenardier", weight=5)
|
|
506
|
-
G.add_edge("Gueulemer", "Valjean", weight=1)
|
|
507
|
-
G.add_edge("Gueulemer", "MmeThenardier", weight=1)
|
|
508
|
-
G.add_edge("Gueulemer", "Javert", weight=1)
|
|
509
|
-
G.add_edge("Gueulemer", "Gavroche", weight=1)
|
|
510
|
-
G.add_edge("Gueulemer", "Eponine", weight=1)
|
|
511
|
-
G.add_edge("Babet", "Thenardier", weight=6)
|
|
512
|
-
G.add_edge("Babet", "Gueulemer", weight=6)
|
|
513
|
-
G.add_edge("Babet", "Valjean", weight=1)
|
|
514
|
-
G.add_edge("Babet", "MmeThenardier", weight=1)
|
|
515
|
-
G.add_edge("Babet", "Javert", weight=2)
|
|
516
|
-
G.add_edge("Babet", "Gavroche", weight=1)
|
|
517
|
-
G.add_edge("Babet", "Eponine", weight=1)
|
|
518
|
-
G.add_edge("Claquesous", "Thenardier", weight=4)
|
|
519
|
-
G.add_edge("Claquesous", "Babet", weight=4)
|
|
520
|
-
G.add_edge("Claquesous", "Gueulemer", weight=4)
|
|
521
|
-
G.add_edge("Claquesous", "Valjean", weight=1)
|
|
522
|
-
G.add_edge("Claquesous", "MmeThenardier", weight=1)
|
|
523
|
-
G.add_edge("Claquesous", "Javert", weight=1)
|
|
524
|
-
G.add_edge("Claquesous", "Eponine", weight=1)
|
|
525
|
-
G.add_edge("Claquesous", "Enjolras", weight=1)
|
|
526
|
-
G.add_edge("Montparnasse", "Javert", weight=1)
|
|
527
|
-
G.add_edge("Montparnasse", "Babet", weight=2)
|
|
528
|
-
G.add_edge("Montparnasse", "Gueulemer", weight=2)
|
|
529
|
-
G.add_edge("Montparnasse", "Claquesous", weight=2)
|
|
530
|
-
G.add_edge("Montparnasse", "Valjean", weight=1)
|
|
531
|
-
G.add_edge("Montparnasse", "Gavroche", weight=1)
|
|
532
|
-
G.add_edge("Montparnasse", "Eponine", weight=1)
|
|
533
|
-
G.add_edge("Montparnasse", "Thenardier", weight=1)
|
|
534
|
-
G.add_edge("Toussaint", "Cosette", weight=2)
|
|
535
|
-
G.add_edge("Toussaint", "Javert", weight=1)
|
|
536
|
-
G.add_edge("Toussaint", "Valjean", weight=1)
|
|
537
|
-
G.add_edge("Child1", "Gavroche", weight=2)
|
|
538
|
-
G.add_edge("Child2", "Gavroche", weight=2)
|
|
539
|
-
G.add_edge("Child2", "Child1", weight=3)
|
|
540
|
-
G.add_edge("Brujon", "Babet", weight=3)
|
|
541
|
-
G.add_edge("Brujon", "Gueulemer", weight=3)
|
|
542
|
-
G.add_edge("Brujon", "Thenardier", weight=3)
|
|
543
|
-
G.add_edge("Brujon", "Gavroche", weight=1)
|
|
544
|
-
G.add_edge("Brujon", "Eponine", weight=1)
|
|
545
|
-
G.add_edge("Brujon", "Claquesous", weight=1)
|
|
546
|
-
G.add_edge("Brujon", "Montparnasse", weight=1)
|
|
547
|
-
G.add_edge("MmeHucheloup", "Bossuet", weight=1)
|
|
548
|
-
G.add_edge("MmeHucheloup", "Joly", weight=1)
|
|
549
|
-
G.add_edge("MmeHucheloup", "Grantaire", weight=1)
|
|
550
|
-
G.add_edge("MmeHucheloup", "Bahorel", weight=1)
|
|
551
|
-
G.add_edge("MmeHucheloup", "Courfeyrac", weight=1)
|
|
552
|
-
G.add_edge("MmeHucheloup", "Gavroche", weight=1)
|
|
553
|
-
G.add_edge("MmeHucheloup", "Enjolras", weight=1)
|
|
554
|
-
return G
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"""Generates graphs with a given eigenvector structure"""
|
|
2
|
-
|
|
3
|
-
import networkx as nx
|
|
4
|
-
from networkx.utils import np_random_state
|
|
5
|
-
|
|
6
|
-
__all__ = ["spectral_graph_forge"]
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@np_random_state(3)
|
|
10
|
-
@nx._dispatchable(preserve_edge_attrs={"G": {"weight": 1}}, returns_graph=True)
|
|
11
|
-
def spectral_graph_forge(G, alpha, transformation="identity", seed=None):
|
|
12
|
-
"""Returns a random simple graph with spectrum resembling that of `G`
|
|
13
|
-
|
|
14
|
-
This algorithm, called Spectral Graph Forge (SGF), computes the
|
|
15
|
-
eigenvectors of a given graph adjacency matrix, filters them and
|
|
16
|
-
builds a random graph with a similar eigenstructure.
|
|
17
|
-
SGF has been proved to be particularly useful for synthesizing
|
|
18
|
-
realistic social networks and it can also be used to anonymize
|
|
19
|
-
graph sensitive data.
|
|
20
|
-
|
|
21
|
-
Parameters
|
|
22
|
-
----------
|
|
23
|
-
G : Graph
|
|
24
|
-
alpha : float
|
|
25
|
-
Ratio representing the percentage of eigenvectors of G to consider,
|
|
26
|
-
values in [0,1].
|
|
27
|
-
transformation : string, optional
|
|
28
|
-
Represents the intended matrix linear transformation, possible values
|
|
29
|
-
are 'identity' and 'modularity'
|
|
30
|
-
seed : integer, random_state, or None (default)
|
|
31
|
-
Indicator of numpy random number generation state.
|
|
32
|
-
See :ref:`Randomness<randomness>`.
|
|
33
|
-
|
|
34
|
-
Returns
|
|
35
|
-
-------
|
|
36
|
-
H : Graph
|
|
37
|
-
A graph with a similar eigenvector structure of the input one.
|
|
38
|
-
|
|
39
|
-
Raises
|
|
40
|
-
------
|
|
41
|
-
NetworkXError
|
|
42
|
-
If transformation has a value different from 'identity' or 'modularity'
|
|
43
|
-
|
|
44
|
-
Notes
|
|
45
|
-
-----
|
|
46
|
-
Spectral Graph Forge (SGF) generates a random simple graph resembling the
|
|
47
|
-
global properties of the given one.
|
|
48
|
-
It leverages the low-rank approximation of the associated adjacency matrix
|
|
49
|
-
driven by the *alpha* precision parameter.
|
|
50
|
-
SGF preserves the number of nodes of the input graph and their ordering.
|
|
51
|
-
This way, nodes of output graphs resemble the properties of the input one
|
|
52
|
-
and attributes can be directly mapped.
|
|
53
|
-
|
|
54
|
-
It considers the graph adjacency matrices which can optionally be
|
|
55
|
-
transformed to other symmetric real matrices (currently transformation
|
|
56
|
-
options include *identity* and *modularity*).
|
|
57
|
-
The *modularity* transformation, in the sense of Newman's modularity matrix
|
|
58
|
-
allows the focusing on community structure related properties of the graph.
|
|
59
|
-
|
|
60
|
-
SGF applies a low-rank approximation whose fixed rank is computed from the
|
|
61
|
-
ratio *alpha* of the input graph adjacency matrix dimension.
|
|
62
|
-
This step performs a filtering on the input eigenvectors similar to the low
|
|
63
|
-
pass filtering common in telecommunications.
|
|
64
|
-
|
|
65
|
-
The filtered values (after truncation) are used as input to a Bernoulli
|
|
66
|
-
sampling for constructing a random adjacency matrix.
|
|
67
|
-
|
|
68
|
-
References
|
|
69
|
-
----------
|
|
70
|
-
.. [1] L. Baldesi, C. T. Butts, A. Markopoulou, "Spectral Graph Forge:
|
|
71
|
-
Graph Generation Targeting Modularity", IEEE Infocom, '18.
|
|
72
|
-
https://arxiv.org/abs/1801.01715
|
|
73
|
-
.. [2] M. Newman, "Networks: an introduction", Oxford university press,
|
|
74
|
-
2010
|
|
75
|
-
|
|
76
|
-
Examples
|
|
77
|
-
--------
|
|
78
|
-
>>> G = nx.karate_club_graph()
|
|
79
|
-
>>> H = nx.spectral_graph_forge(G, 0.3)
|
|
80
|
-
>>>
|
|
81
|
-
"""
|
|
82
|
-
import numpy as np
|
|
83
|
-
import scipy as sp
|
|
84
|
-
|
|
85
|
-
available_transformations = ["identity", "modularity"]
|
|
86
|
-
alpha = np.clip(alpha, 0, 1)
|
|
87
|
-
A = nx.to_numpy_array(G)
|
|
88
|
-
n = A.shape[1]
|
|
89
|
-
level = round(n * alpha)
|
|
90
|
-
|
|
91
|
-
if transformation not in available_transformations:
|
|
92
|
-
msg = f"{transformation!r} is not a valid transformation. "
|
|
93
|
-
msg += f"Transformations: {available_transformations}"
|
|
94
|
-
raise nx.NetworkXError(msg)
|
|
95
|
-
|
|
96
|
-
K = np.ones((1, n)) @ A
|
|
97
|
-
|
|
98
|
-
B = A
|
|
99
|
-
if transformation == "modularity":
|
|
100
|
-
B -= K.T @ K / K.sum()
|
|
101
|
-
|
|
102
|
-
# Compute low-rank approximation of B
|
|
103
|
-
evals, evecs = np.linalg.eigh(B)
|
|
104
|
-
k = np.argsort(np.abs(evals))[::-1] # indices of evals in descending order
|
|
105
|
-
evecs[:, k[np.arange(level, n)]] = 0 # set smallest eigenvectors to 0
|
|
106
|
-
B = evecs @ np.diag(evals) @ evecs.T
|
|
107
|
-
|
|
108
|
-
if transformation == "modularity":
|
|
109
|
-
B += K.T @ K / K.sum()
|
|
110
|
-
|
|
111
|
-
B = np.clip(B, 0, 1)
|
|
112
|
-
np.fill_diagonal(B, 0)
|
|
113
|
-
|
|
114
|
-
for i in range(n - 1):
|
|
115
|
-
B[i, i + 1 :] = sp.stats.bernoulli.rvs(B[i, i + 1 :], random_state=seed)
|
|
116
|
-
B[i + 1 :, i] = np.transpose(B[i, i + 1 :])
|
|
117
|
-
|
|
118
|
-
H = nx.from_numpy_array(B)
|
|
119
|
-
|
|
120
|
-
return H
|