okstra 0.107.2 → 0.109.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/runtime/BUILD.json +2 -2
- package/runtime/prompts/lead/okstra-lead-contract.md +1 -1
- package/runtime/prompts/profiles/_common-contract.md +3 -2
- package/runtime/python/okstra_ctl/graphify_cmd.py +225 -0
- package/runtime/python/okstra_ctl/resolve_task_key.py +15 -9
- package/runtime/python/okstra_ctl/session.py +44 -0
- package/runtime/python/okstra_project/__init__.py +2 -0
- package/runtime/python/okstra_project/state.py +36 -0
- package/runtime/python/okstra_token_usage/claude.py +15 -9
- package/runtime/python/okstra_token_usage/cli.py +23 -0
- package/runtime/python/okstra_token_usage/collect.py +163 -4
- package/runtime/python/okstra_vendor/__init__.py +41 -0
- package/runtime/python/okstra_vendor/graphify/.vendored-version +1 -0
- package/runtime/python/okstra_vendor/graphify/__init__.py +28 -0
- package/runtime/python/okstra_vendor/graphify/__main__.py +1371 -0
- package/runtime/python/okstra_vendor/graphify/analyze.py +540 -0
- package/runtime/python/okstra_vendor/graphify/benchmark.py +129 -0
- package/runtime/python/okstra_vendor/graphify/build.py +107 -0
- package/runtime/python/okstra_vendor/graphify/cache.py +169 -0
- package/runtime/python/okstra_vendor/graphify/cluster.py +137 -0
- package/runtime/python/okstra_vendor/graphify/detect.py +510 -0
- package/runtime/python/okstra_vendor/graphify/export.py +1014 -0
- package/runtime/python/okstra_vendor/graphify/extract.py +3277 -0
- package/runtime/python/okstra_vendor/graphify/hooks.py +220 -0
- package/runtime/python/okstra_vendor/graphify/ingest.py +297 -0
- package/runtime/python/okstra_vendor/graphify/manifest.py +4 -0
- package/runtime/python/okstra_vendor/graphify/report.py +175 -0
- package/runtime/python/okstra_vendor/graphify/security.py +203 -0
- package/runtime/python/okstra_vendor/graphify/serve.py +373 -0
- package/runtime/python/okstra_vendor/graphify/skill-aider.md +1184 -0
- package/runtime/python/okstra_vendor/graphify/skill-claw.md +1184 -0
- package/runtime/python/okstra_vendor/graphify/skill-codex.md +1242 -0
- package/runtime/python/okstra_vendor/graphify/skill-copilot.md +1268 -0
- package/runtime/python/okstra_vendor/graphify/skill-droid.md +1239 -0
- package/runtime/python/okstra_vendor/graphify/skill-kiro.md +1183 -0
- package/runtime/python/okstra_vendor/graphify/skill-opencode.md +1238 -0
- package/runtime/python/okstra_vendor/graphify/skill-trae.md +1208 -0
- package/runtime/python/okstra_vendor/graphify/skill-vscode.md +253 -0
- package/runtime/python/okstra_vendor/graphify/skill-windows.md +1245 -0
- package/runtime/python/okstra_vendor/graphify/skill.md +1319 -0
- package/runtime/python/okstra_vendor/graphify/transcribe.py +182 -0
- package/runtime/python/okstra_vendor/graphify/validate.py +72 -0
- package/runtime/python/okstra_vendor/graphify/watch.py +188 -0
- package/runtime/python/okstra_vendor/graphify/wiki.py +214 -0
- package/runtime/python/okstra_vendor/networkx/__init__.py +62 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/__init__.py +134 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/__init__.py +26 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/clique.py +259 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/clustering_coefficient.py +71 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/connectivity.py +412 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/density.py +396 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/distance_measures.py +150 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/dominating_set.py +149 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/kcomponents.py +369 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/matching.py +44 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/maxcut.py +143 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/ramsey.py +53 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/steinertree.py +265 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_approx_clust_coeff.py +41 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_clique.py +112 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_connectivity.py +199 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_density.py +146 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_distance_measures.py +59 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_dominating_set.py +78 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_kcomponents.py +303 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_matching.py +8 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_maxcut.py +94 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_ramsey.py +31 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_steinertree.py +306 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_traveling_salesman.py +1014 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_treewidth.py +274 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_vertex_cover.py +68 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/traveling_salesman.py +1508 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/treewidth.py +255 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/vertex_cover.py +83 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/__init__.py +5 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/connectivity.py +122 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/correlation.py +302 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/mixing.py +255 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/neighbor_degree.py +160 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/pairs.py +127 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/base_test.py +81 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_connectivity.py +143 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_correlation.py +122 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_mixing.py +174 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_neighbor_degree.py +107 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_pairs.py +87 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/asteroidal.py +164 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/__init__.py +88 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/basic.py +322 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/centrality.py +290 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/cluster.py +289 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/covering.py +57 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/edgelist.py +360 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/extendability.py +105 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/generators.py +603 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/link_analysis.py +316 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/matching.py +590 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/matrix.py +232 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/projection.py +526 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/redundancy.py +112 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/spectral.py +69 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_basic.py +125 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_centrality.py +192 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_cluster.py +84 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_covering.py +33 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_edgelist.py +240 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_extendability.py +334 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_generators.py +407 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_link_analysis.py +218 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_matching.py +327 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_matrix.py +138 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_project.py +409 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_redundancy.py +35 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_spectral_bipartivity.py +80 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/boundary.py +168 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bridges.py +205 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/broadcasting.py +164 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/__init__.py +20 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/betweenness.py +591 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/betweenness_subset.py +236 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/closeness.py +282 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/current_flow_betweenness.py +364 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/current_flow_betweenness_subset.py +227 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/current_flow_closeness.py +96 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/degree_alg.py +150 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/dispersion.py +107 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/eigenvector.py +357 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/flow_matrix.py +130 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/group.py +787 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/harmonic.py +88 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/katz.py +331 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/laplacian.py +150 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/load.py +200 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/percolation.py +128 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/reaching.py +209 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/second_order.py +141 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/subgraph_alg.py +361 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_betweenness_centrality.py +923 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_betweenness_centrality_subset.py +354 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_closeness_centrality.py +274 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality.py +259 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality_subset.py +147 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_closeness.py +43 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_degree_centrality.py +144 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_dispersion.py +73 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_eigenvector_centrality.py +186 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_group.py +277 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_harmonic_centrality.py +122 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_katz_centrality.py +345 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_laplacian_centrality.py +220 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_load_centrality.py +344 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_percolation_centrality.py +87 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_reaching.py +140 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_second_order_centrality.py +82 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_subgraph.py +110 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_trophic.py +302 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_voterank.py +64 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/trophic.py +181 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/voterank_alg.py +95 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/chains.py +172 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/chordal.py +443 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/clique.py +818 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/cluster.py +732 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/coloring/__init__.py +4 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/coloring/equitable_coloring.py +505 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/coloring/greedy_coloring.py +565 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/coloring/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/coloring/tests/test_coloring.py +863 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/communicability_alg.py +163 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/__init__.py +28 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/asyn_fluid.py +153 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/bipartitions.py +354 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/centrality.py +171 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/community_utils.py +30 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/divisive.py +216 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/kclique.py +79 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/label_propagation.py +338 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/leiden.py +162 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/local.py +220 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/louvain.py +384 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/lukes.py +227 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/modularity_max.py +452 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/quality.py +347 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_asyn_fluid.py +147 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_bipartitions.py +157 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_centrality.py +85 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_divisive.py +106 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_kclique.py +91 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_label_propagation.py +241 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_leiden.py +138 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_local.py +76 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_louvain.py +264 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_lukes.py +152 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_modularity_max.py +340 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_quality.py +139 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_utils.py +26 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/__init__.py +6 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/attracting.py +115 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/biconnected.py +394 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/connected.py +282 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/semiconnected.py +71 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/strongly_connected.py +359 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_attracting.py +70 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_biconnected.py +248 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_connected.py +138 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_semiconnected.py +55 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_strongly_connected.py +193 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_weakly_connected.py +96 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/weakly_connected.py +196 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/__init__.py +11 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/connectivity.py +811 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/cuts.py +616 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/disjoint_paths.py +408 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/edge_augmentation.py +1270 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/edge_kcomponents.py +592 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/kcomponents.py +220 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/kcutsets.py +235 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/stoerwagner.py +152 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_connectivity.py +421 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_cuts.py +309 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_disjoint_paths.py +249 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_edge_augmentation.py +502 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_edge_kcomponents.py +488 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_kcomponents.py +323 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_kcutsets.py +280 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_stoer_wagner.py +102 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/utils.py +88 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/core.py +588 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/covering.py +142 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/cuts.py +416 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/cycles.py +1234 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/d_separation.py +677 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/dag.py +1392 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/distance_measures.py +1095 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/distance_regular.py +272 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/dominance.py +142 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/dominating.py +268 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/efficiency_measures.py +167 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/euler.py +470 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/__init__.py +11 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/boykovkolmogorov.py +370 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/capacityscaling.py +407 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/dinitz_alg.py +238 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/edmondskarp.py +241 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/gomory_hu.py +178 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/maxflow.py +611 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/mincost.py +356 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/networksimplex.py +662 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/preflowpush.py +425 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/shortestaugmentingpath.py +300 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/gl1.gpickle.bz2 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/gw1.gpickle.bz2 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/netgen-2.gpickle.bz2 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_gomory_hu.py +128 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_maxflow.py +573 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_maxflow_large_graph.py +155 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_mincost.py +475 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_networksimplex.py +481 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/wlm3.gpickle.bz2 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/utils.py +194 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/graph_hashing.py +435 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/graphical.py +483 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/hierarchy.py +57 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/hybrid.py +196 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isolate.py +107 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/__init__.py +7 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/ismags.py +1306 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/isomorph.py +336 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/isomorphvf2.py +1262 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/matchhelpers.py +352 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/temporalisomorphvf2.py +308 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/iso_r01_s80.A99 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/iso_r01_s80.B99 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/si2_b06_m200.A99 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/si2_b06_m200.B99 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_ismags.py +719 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_isomorphism.py +103 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_isomorphvf2.py +490 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_match_helpers.py +64 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_temporalisomorphvf2.py +212 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_tree_isomorphism.py +202 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2pp.py +1655 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2pp_helpers.py +3118 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2userfunc.py +196 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tree_isomorphism.py +264 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/vf2pp.py +1102 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/vf2userfunc.py +192 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/__init__.py +2 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/hits_alg.py +337 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/pagerank_alg.py +498 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/test_hits.py +77 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/test_pagerank.py +213 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/link_prediction.py +687 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/lowest_common_ancestors.py +280 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/matching.py +1148 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/minors/__init__.py +27 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/minors/contraction.py +738 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/minors/tests/test_contraction.py +544 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/mis.py +78 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/moral.py +59 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/node_classification.py +219 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/non_randomness.py +155 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/__init__.py +4 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/all.py +324 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/binary.py +468 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/product.py +633 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_all.py +328 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_binary.py +451 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_product.py +491 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_unary.py +55 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/unary.py +77 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/perfect_graph.py +73 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/planar_drawing.py +464 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/planarity.py +1463 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/polynomials.py +306 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/reciprocity.py +98 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/regular.py +167 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/richclub.py +138 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/__init__.py +5 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/astar.py +239 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/dense.py +264 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/generic.py +716 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_astar.py +254 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_dense.py +212 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_dense_numpy.py +88 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_generic.py +511 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_unweighted.py +149 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_weighted.py +983 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/unweighted.py +625 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/weighted.py +2542 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/similarity.py +2107 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/simple_paths.py +966 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/smallworld.py +404 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/smetric.py +30 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/sparsifiers.py +296 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/structuralholes.py +374 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/summarization.py +564 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/swap.py +406 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_asteroidal.py +23 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_boundary.py +154 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_bridges.py +144 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_broadcasting.py +109 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_chains.py +136 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_chordal.py +129 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_clique.py +300 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cluster.py +678 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_communicability.py +80 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_core.py +266 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_covering.py +85 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cuts.py +171 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cycles.py +984 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_d_separation.py +340 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dag.py +835 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_distance_measures.py +831 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_distance_regular.py +85 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dominance.py +299 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dominating.py +115 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_efficiency.py +58 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_euler.py +314 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_graph_hashing.py +872 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_graphical.py +163 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_hierarchy.py +46 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_hybrid.py +24 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_isolate.py +26 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_link_prediction.py +615 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_lowest_common_ancestors.py +459 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_matching.py +556 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_max_weight_clique.py +179 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_mis.py +62 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_moral.py +15 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_node_classification.py +140 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_non_randomness.py +60 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_perfect_graph.py +27 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_planar_drawing.py +274 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_planarity.py +556 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_polynomials.py +57 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_reciprocity.py +37 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_regular.py +88 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_richclub.py +149 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_similarity.py +1158 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_simple_paths.py +803 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_smallworld.py +76 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_smetric.py +8 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_sparsifiers.py +138 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_structuralholes.py +191 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_summarization.py +642 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_swap.py +179 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_threshold.py +270 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_time_dependent.py +431 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_tournament.py +161 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_triads.py +248 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_vitality.py +41 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_voronoi.py +103 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_walks.py +54 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_wiener.py +157 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/threshold.py +981 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/time_dependent.py +142 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tournament.py +406 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/__init__.py +5 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/beamsearch.py +90 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/breadth_first_search.py +576 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/depth_first_search.py +529 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/edgebfs.py +185 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/edgedfs.py +182 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_beamsearch.py +25 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_bfs.py +203 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_dfs.py +307 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_edgebfs.py +147 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_edgedfs.py +131 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/__init__.py +7 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/branchings.py +1042 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/coding.py +413 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/decomposition.py +88 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/distance_measures.py +219 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/mst.py +1281 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/operations.py +106 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/recognition.py +273 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_branchings.py +624 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_coding.py +114 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_decomposition.py +79 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_distance_measures.py +99 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_mst.py +934 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_operations.py +53 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_recognition.py +174 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/triads.py +500 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/vitality.py +76 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/voronoi.py +86 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/walks.py +77 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/wiener.py +278 -0
- package/runtime/python/okstra_vendor/networkx/classes/__init__.py +13 -0
- package/runtime/python/okstra_vendor/networkx/classes/coreviews.py +435 -0
- package/runtime/python/okstra_vendor/networkx/classes/digraph.py +1363 -0
- package/runtime/python/okstra_vendor/networkx/classes/filters.py +95 -0
- package/runtime/python/okstra_vendor/networkx/classes/function.py +1549 -0
- package/runtime/python/okstra_vendor/networkx/classes/graph.py +2082 -0
- package/runtime/python/okstra_vendor/networkx/classes/graphviews.py +269 -0
- package/runtime/python/okstra_vendor/networkx/classes/multidigraph.py +977 -0
- package/runtime/python/okstra_vendor/networkx/classes/multigraph.py +1294 -0
- package/runtime/python/okstra_vendor/networkx/classes/reportviews.py +1447 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/dispatch_interface.py +192 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/historical_tests.py +476 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_coreviews.py +362 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_digraph.py +331 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_digraph_historical.py +110 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_filters.py +177 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_function.py +1045 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_graph.py +950 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_graph_historical.py +12 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_graphviews.py +349 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_multidigraph.py +459 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_multigraph.py +528 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_reportviews.py +1421 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_special.py +131 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_subgraphviews.py +371 -0
- package/runtime/python/okstra_vendor/networkx/conftest.py +261 -0
- package/runtime/python/okstra_vendor/networkx/convert.py +502 -0
- package/runtime/python/okstra_vendor/networkx/convert_matrix.py +1314 -0
- package/runtime/python/okstra_vendor/networkx/drawing/__init__.py +7 -0
- package/runtime/python/okstra_vendor/networkx/drawing/layout.py +2036 -0
- package/runtime/python/okstra_vendor/networkx/drawing/nx_agraph.py +470 -0
- package/runtime/python/okstra_vendor/networkx/drawing/nx_latex.py +570 -0
- package/runtime/python/okstra_vendor/networkx/drawing/nx_pydot.py +361 -0
- package/runtime/python/okstra_vendor/networkx/drawing/nx_pylab.py +2978 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_complex.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_empty_graph.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_house_with_colors.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_labels_and_colors.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_shortest_path.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_house_with_colors.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_agraph.py +237 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_image_comparison_pylab_mpl.py +229 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_latex.py +285 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_layout.py +631 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_pydot.py +146 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_pylab.py +1582 -0
- package/runtime/python/okstra_vendor/networkx/exception.py +131 -0
- package/runtime/python/okstra_vendor/networkx/generators/__init__.py +34 -0
- package/runtime/python/okstra_vendor/networkx/generators/atlas.dat.gz +0 -0
- package/runtime/python/okstra_vendor/networkx/generators/atlas.py +227 -0
- package/runtime/python/okstra_vendor/networkx/generators/classic.py +1091 -0
- package/runtime/python/okstra_vendor/networkx/generators/cographs.py +68 -0
- package/runtime/python/okstra_vendor/networkx/generators/community.py +1070 -0
- package/runtime/python/okstra_vendor/networkx/generators/degree_seq.py +886 -0
- package/runtime/python/okstra_vendor/networkx/generators/directed.py +572 -0
- package/runtime/python/okstra_vendor/networkx/generators/duplication.py +174 -0
- package/runtime/python/okstra_vendor/networkx/generators/ego.py +66 -0
- package/runtime/python/okstra_vendor/networkx/generators/expanders.py +499 -0
- package/runtime/python/okstra_vendor/networkx/generators/geometric.py +1037 -0
- package/runtime/python/okstra_vendor/networkx/generators/harary_graph.py +163 -0
- package/runtime/python/okstra_vendor/networkx/generators/internet_as_graphs.py +443 -0
- package/runtime/python/okstra_vendor/networkx/generators/intersection.py +125 -0
- package/runtime/python/okstra_vendor/networkx/generators/interval_graph.py +70 -0
- package/runtime/python/okstra_vendor/networkx/generators/joint_degree_seq.py +664 -0
- package/runtime/python/okstra_vendor/networkx/generators/lattice.py +405 -0
- package/runtime/python/okstra_vendor/networkx/generators/line.py +501 -0
- package/runtime/python/okstra_vendor/networkx/generators/mycielski.py +110 -0
- package/runtime/python/okstra_vendor/networkx/generators/nonisomorphic_trees.py +259 -0
- package/runtime/python/okstra_vendor/networkx/generators/random_clustered.py +117 -0
- package/runtime/python/okstra_vendor/networkx/generators/random_graphs.py +1416 -0
- package/runtime/python/okstra_vendor/networkx/generators/small.py +1070 -0
- package/runtime/python/okstra_vendor/networkx/generators/social.py +554 -0
- package/runtime/python/okstra_vendor/networkx/generators/spectral_graph_forge.py +120 -0
- package/runtime/python/okstra_vendor/networkx/generators/stochastic.py +54 -0
- package/runtime/python/okstra_vendor/networkx/generators/sudoku.py +131 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_atlas.py +75 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_classic.py +642 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_cographs.py +20 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_community.py +362 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_degree_seq.py +224 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_directed.py +189 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_duplication.py +103 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_ego.py +39 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_expanders.py +182 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_geometric.py +488 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_harary_graph.py +133 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_internet_as_graphs.py +221 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_intersection.py +28 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_interval_graph.py +144 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_joint_degree_seq.py +125 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_lattice.py +264 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_line.py +316 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_mycielski.py +30 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_nonisomorphic_trees.py +82 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_random_clustered.py +33 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_random_graphs.py +495 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_small.py +220 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_spectral_graph_forge.py +49 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_stochastic.py +72 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_sudoku.py +92 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_time_series.py +64 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_trees.py +195 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_triads.py +15 -0
- package/runtime/python/okstra_vendor/networkx/generators/time_series.py +74 -0
- package/runtime/python/okstra_vendor/networkx/generators/trees.py +1070 -0
- package/runtime/python/okstra_vendor/networkx/generators/triads.py +94 -0
- package/runtime/python/okstra_vendor/networkx/lazy_imports.py +188 -0
- package/runtime/python/okstra_vendor/networkx/linalg/__init__.py +13 -0
- package/runtime/python/okstra_vendor/networkx/linalg/algebraicconnectivity.py +650 -0
- package/runtime/python/okstra_vendor/networkx/linalg/attrmatrix.py +466 -0
- package/runtime/python/okstra_vendor/networkx/linalg/bethehessianmatrix.py +77 -0
- package/runtime/python/okstra_vendor/networkx/linalg/graphmatrix.py +168 -0
- package/runtime/python/okstra_vendor/networkx/linalg/laplacianmatrix.py +512 -0
- package/runtime/python/okstra_vendor/networkx/linalg/modularitymatrix.py +166 -0
- package/runtime/python/okstra_vendor/networkx/linalg/spectrum.py +186 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_algebraic_connectivity.py +400 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_attrmatrix.py +108 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_bethehessian.py +40 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_graphmatrix.py +275 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_laplacian.py +334 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_modularity.py +86 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_spectrum.py +70 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/__init__.py +17 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/adjlist.py +330 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/edgelist.py +489 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/gexf.py +1084 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/gml.py +879 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/graph6.py +427 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/graphml.py +1053 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/__init__.py +19 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/adjacency.py +156 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/cytoscape.py +190 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/node_link.py +261 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_adjacency.py +78 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_cytoscape.py +78 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_node_link.py +109 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_tree.py +48 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tree.py +137 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/leda.py +108 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/multiline_adjlist.py +393 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/p2g.py +113 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/pajek.py +286 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/sparse6.py +379 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_adjlist.py +354 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_edgelist.py +318 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_gexf.py +612 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_gml.py +744 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_graph6.py +181 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_graphml.py +1531 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_leda.py +30 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_p2g.py +63 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_pajek.py +128 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_sparse6.py +166 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_text.py +1742 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/text.py +851 -0
- package/runtime/python/okstra_vendor/networkx/relabel.py +285 -0
- package/runtime/python/okstra_vendor/networkx/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_all_random_functions.py +248 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_convert.py +321 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_convert_numpy.py +531 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_convert_pandas.py +349 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_convert_scipy.py +281 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_exceptions.py +40 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_import.py +11 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_lazy_imports.py +96 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_relabel.py +349 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_removed_functions_exception_messages.py +8 -0
- package/runtime/python/okstra_vendor/networkx/utils/__init__.py +8 -0
- package/runtime/python/okstra_vendor/networkx/utils/backends.py +2171 -0
- package/runtime/python/okstra_vendor/networkx/utils/configs.py +396 -0
- package/runtime/python/okstra_vendor/networkx/utils/decorators.py +1233 -0
- package/runtime/python/okstra_vendor/networkx/utils/heaps.py +338 -0
- package/runtime/python/okstra_vendor/networkx/utils/mapped_queue.py +297 -0
- package/runtime/python/okstra_vendor/networkx/utils/misc.py +703 -0
- package/runtime/python/okstra_vendor/networkx/utils/random_sequence.py +198 -0
- package/runtime/python/okstra_vendor/networkx/utils/rcm.py +159 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test__init.py +11 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_backends.py +225 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_config.py +263 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_decorators.py +510 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_heaps.py +131 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_mapped_queue.py +268 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_misc.py +393 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_random_sequence.py +53 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_rcm.py +63 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_unionfind.py +55 -0
- package/runtime/python/okstra_vendor/networkx/utils/union_find.py +106 -0
- package/runtime/skills/okstra-graphify/SKILL.md +161 -0
- package/runtime/skills/okstra-inspect/SKILL.md +17 -9
- package/runtime/templates/reports/settings.template.json +4 -0
- package/runtime/validators/forbidden_actions.py +8 -2
- package/runtime/validators/validate_session_conformance.py +26 -5
- package/src/cli-registry.mjs +7 -0
- package/src/commands/graphify.mjs +32 -0
- package/src/commands/lifecycle/doctor.mjs +9 -0
- package/src/lib/skill-catalog.mjs +1 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
"""Functions for computing clustering of pairs"""
|
|
2
|
+
|
|
3
|
+
import itertools
|
|
4
|
+
|
|
5
|
+
import networkx as nx
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"clustering",
|
|
9
|
+
"average_clustering",
|
|
10
|
+
"latapy_clustering",
|
|
11
|
+
"robins_alexander_clustering",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def cc_dot(nu, nv):
|
|
16
|
+
return len(nu & nv) / len(nu | nv)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def cc_max(nu, nv):
|
|
20
|
+
return len(nu & nv) / max(len(nu), len(nv))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def cc_min(nu, nv):
|
|
24
|
+
return len(nu & nv) / min(len(nu), len(nv))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
modes = {"dot": cc_dot, "min": cc_min, "max": cc_max}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@nx._dispatchable
|
|
31
|
+
def latapy_clustering(G, nodes=None, mode="dot"):
|
|
32
|
+
r"""Compute a bipartite clustering coefficient for nodes.
|
|
33
|
+
|
|
34
|
+
The bipartite clustering coefficient is a measure of local density
|
|
35
|
+
of connections defined as [1]_:
|
|
36
|
+
|
|
37
|
+
.. math::
|
|
38
|
+
|
|
39
|
+
c_u = \frac{\sum_{v \in N(N(u))} c_{uv} }{|N(N(u))|}
|
|
40
|
+
|
|
41
|
+
where `N(N(u))` are the second order neighbors of `u` in `G` excluding `u`,
|
|
42
|
+
and `c_{uv}` is the pairwise clustering coefficient between nodes
|
|
43
|
+
`u` and `v`.
|
|
44
|
+
|
|
45
|
+
The mode selects the function for `c_{uv}` which can be:
|
|
46
|
+
|
|
47
|
+
`dot`:
|
|
48
|
+
|
|
49
|
+
.. math::
|
|
50
|
+
|
|
51
|
+
c_{uv}=\frac{|N(u)\cap N(v)|}{|N(u) \cup N(v)|}
|
|
52
|
+
|
|
53
|
+
`min`:
|
|
54
|
+
|
|
55
|
+
.. math::
|
|
56
|
+
|
|
57
|
+
c_{uv}=\frac{|N(u)\cap N(v)|}{min(|N(u)|,|N(v)|)}
|
|
58
|
+
|
|
59
|
+
`max`:
|
|
60
|
+
|
|
61
|
+
.. math::
|
|
62
|
+
|
|
63
|
+
c_{uv}=\frac{|N(u)\cap N(v)|}{max(|N(u)|,|N(v)|)}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
Parameters
|
|
67
|
+
----------
|
|
68
|
+
G : graph
|
|
69
|
+
A bipartite graph
|
|
70
|
+
|
|
71
|
+
nodes : list or iterable (optional)
|
|
72
|
+
Compute bipartite clustering for these nodes. The default
|
|
73
|
+
is all nodes in G.
|
|
74
|
+
|
|
75
|
+
mode : string
|
|
76
|
+
The pairwise bipartite clustering method to be used in the computation.
|
|
77
|
+
It must be "dot", "max", or "min".
|
|
78
|
+
|
|
79
|
+
Returns
|
|
80
|
+
-------
|
|
81
|
+
clustering : dictionary
|
|
82
|
+
A dictionary keyed by node with the clustering coefficient value.
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
Examples
|
|
86
|
+
--------
|
|
87
|
+
>>> from networkx.algorithms import bipartite
|
|
88
|
+
>>> G = nx.path_graph(4) # path graphs are bipartite
|
|
89
|
+
>>> c = bipartite.clustering(G)
|
|
90
|
+
>>> c[0]
|
|
91
|
+
0.5
|
|
92
|
+
>>> c = bipartite.clustering(G, mode="min")
|
|
93
|
+
>>> c[0]
|
|
94
|
+
1.0
|
|
95
|
+
|
|
96
|
+
See Also
|
|
97
|
+
--------
|
|
98
|
+
robins_alexander_clustering
|
|
99
|
+
average_clustering
|
|
100
|
+
networkx.algorithms.cluster.square_clustering
|
|
101
|
+
|
|
102
|
+
References
|
|
103
|
+
----------
|
|
104
|
+
.. [1] Latapy, Matthieu, Clémence Magnien, and Nathalie Del Vecchio (2008).
|
|
105
|
+
Basic notions for the analysis of large two-mode networks.
|
|
106
|
+
Social Networks 30(1), 31--48.
|
|
107
|
+
"""
|
|
108
|
+
if not nx.algorithms.bipartite.is_bipartite(G):
|
|
109
|
+
raise nx.NetworkXError("Graph is not bipartite")
|
|
110
|
+
|
|
111
|
+
try:
|
|
112
|
+
cc_func = modes[mode]
|
|
113
|
+
except KeyError as err:
|
|
114
|
+
raise nx.NetworkXError(
|
|
115
|
+
"Mode for bipartite clustering must be: dot, min or max"
|
|
116
|
+
) from err
|
|
117
|
+
|
|
118
|
+
if nodes is None:
|
|
119
|
+
nodes = G
|
|
120
|
+
ccs = {}
|
|
121
|
+
for v in nodes:
|
|
122
|
+
cc = 0.0
|
|
123
|
+
nbrs2 = {u for nbr in G[v] for u in G[nbr]} - {v}
|
|
124
|
+
for u in nbrs2:
|
|
125
|
+
cc += cc_func(set(G[u]), set(G[v]))
|
|
126
|
+
if cc > 0.0: # len(nbrs2)>0
|
|
127
|
+
cc /= len(nbrs2)
|
|
128
|
+
ccs[v] = cc
|
|
129
|
+
return ccs
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
clustering = latapy_clustering
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
@nx._dispatchable(name="bipartite_average_clustering")
|
|
136
|
+
def average_clustering(G, nodes=None, mode="dot"):
|
|
137
|
+
r"""Compute the average bipartite clustering coefficient.
|
|
138
|
+
|
|
139
|
+
A clustering coefficient for the whole graph is the average,
|
|
140
|
+
|
|
141
|
+
.. math::
|
|
142
|
+
|
|
143
|
+
C = \frac{1}{n}\sum_{v \in G} c_v,
|
|
144
|
+
|
|
145
|
+
where `n` is the number of nodes in `G`.
|
|
146
|
+
|
|
147
|
+
Similar measures for the two bipartite sets can be defined [1]_
|
|
148
|
+
|
|
149
|
+
.. math::
|
|
150
|
+
|
|
151
|
+
C_X = \frac{1}{|X|}\sum_{v \in X} c_v,
|
|
152
|
+
|
|
153
|
+
where `X` is a bipartite set of `G`.
|
|
154
|
+
|
|
155
|
+
Parameters
|
|
156
|
+
----------
|
|
157
|
+
G : graph
|
|
158
|
+
a bipartite graph
|
|
159
|
+
|
|
160
|
+
nodes : list or iterable, optional
|
|
161
|
+
A container of nodes to use in computing the average.
|
|
162
|
+
The nodes should be either the entire graph (the default) or one of the
|
|
163
|
+
bipartite sets.
|
|
164
|
+
|
|
165
|
+
mode : string
|
|
166
|
+
The pairwise bipartite clustering method.
|
|
167
|
+
It must be "dot", "max", or "min"
|
|
168
|
+
|
|
169
|
+
Returns
|
|
170
|
+
-------
|
|
171
|
+
clustering : float
|
|
172
|
+
The average bipartite clustering for the given set of nodes or the
|
|
173
|
+
entire graph if no nodes are specified.
|
|
174
|
+
|
|
175
|
+
Examples
|
|
176
|
+
--------
|
|
177
|
+
>>> from networkx.algorithms import bipartite
|
|
178
|
+
>>> G = nx.star_graph(3) # star graphs are bipartite
|
|
179
|
+
>>> bipartite.average_clustering(G)
|
|
180
|
+
0.75
|
|
181
|
+
>>> X, Y = bipartite.sets(G)
|
|
182
|
+
>>> bipartite.average_clustering(G, X)
|
|
183
|
+
0.0
|
|
184
|
+
>>> bipartite.average_clustering(G, Y)
|
|
185
|
+
1.0
|
|
186
|
+
|
|
187
|
+
See Also
|
|
188
|
+
--------
|
|
189
|
+
clustering
|
|
190
|
+
|
|
191
|
+
Notes
|
|
192
|
+
-----
|
|
193
|
+
The container of nodes passed to this function must contain all of the nodes
|
|
194
|
+
in one of the bipartite sets ("top" or "bottom") in order to compute
|
|
195
|
+
the correct average bipartite clustering coefficients.
|
|
196
|
+
See :mod:`bipartite documentation <networkx.algorithms.bipartite>`
|
|
197
|
+
for further details on how bipartite graphs are handled in NetworkX.
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
References
|
|
201
|
+
----------
|
|
202
|
+
.. [1] Latapy, Matthieu, Clémence Magnien, and Nathalie Del Vecchio (2008).
|
|
203
|
+
Basic notions for the analysis of large two-mode networks.
|
|
204
|
+
Social Networks 30(1), 31--48.
|
|
205
|
+
"""
|
|
206
|
+
if nodes is None:
|
|
207
|
+
nodes = G
|
|
208
|
+
ccs = latapy_clustering(G, nodes=nodes, mode=mode)
|
|
209
|
+
return sum(ccs[v] for v in nodes) / len(nodes)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
@nx._dispatchable
|
|
213
|
+
def robins_alexander_clustering(G):
|
|
214
|
+
r"""Compute the bipartite clustering of G.
|
|
215
|
+
|
|
216
|
+
Robins and Alexander [1]_ defined bipartite clustering coefficient as
|
|
217
|
+
four times the number of four cycles `C_4` divided by the number of
|
|
218
|
+
three paths `L_3` in a bipartite graph:
|
|
219
|
+
|
|
220
|
+
.. math::
|
|
221
|
+
|
|
222
|
+
CC_4 = \frac{4 * C_4}{L_3}
|
|
223
|
+
|
|
224
|
+
Parameters
|
|
225
|
+
----------
|
|
226
|
+
G : graph
|
|
227
|
+
a bipartite graph
|
|
228
|
+
|
|
229
|
+
Returns
|
|
230
|
+
-------
|
|
231
|
+
clustering : float
|
|
232
|
+
The Robins and Alexander bipartite clustering for the input graph.
|
|
233
|
+
|
|
234
|
+
Examples
|
|
235
|
+
--------
|
|
236
|
+
>>> from networkx.algorithms import bipartite
|
|
237
|
+
>>> G = nx.davis_southern_women_graph()
|
|
238
|
+
>>> print(round(bipartite.robins_alexander_clustering(G), 3))
|
|
239
|
+
0.468
|
|
240
|
+
|
|
241
|
+
See Also
|
|
242
|
+
--------
|
|
243
|
+
latapy_clustering
|
|
244
|
+
networkx.algorithms.cluster.square_clustering
|
|
245
|
+
|
|
246
|
+
References
|
|
247
|
+
----------
|
|
248
|
+
.. [1] Robins, G. and M. Alexander (2004). Small worlds among interlocking
|
|
249
|
+
directors: Network structure and distance in bipartite graphs.
|
|
250
|
+
Computational & Mathematical Organization Theory 10(1), 69–94.
|
|
251
|
+
|
|
252
|
+
"""
|
|
253
|
+
if G.order() < 4 or G.size() < 3:
|
|
254
|
+
return 0
|
|
255
|
+
L_3 = _threepaths(G)
|
|
256
|
+
if L_3 == 0:
|
|
257
|
+
return 0
|
|
258
|
+
C_4 = _four_cycles(G)
|
|
259
|
+
return (4.0 * C_4) / L_3
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
def _four_cycles(G):
|
|
263
|
+
# Also see `square_clustering` which counts squares in a similar way
|
|
264
|
+
cycles = 0
|
|
265
|
+
seen = set()
|
|
266
|
+
G_adj = G._adj
|
|
267
|
+
for v in G:
|
|
268
|
+
seen.add(v)
|
|
269
|
+
v_neighbors = set(G_adj[v])
|
|
270
|
+
if len(v_neighbors) < 2:
|
|
271
|
+
# Can't form a square without at least two neighbors
|
|
272
|
+
continue
|
|
273
|
+
two_hop_neighbors = set().union(*(G_adj[u] for u in v_neighbors))
|
|
274
|
+
two_hop_neighbors -= seen
|
|
275
|
+
for x in two_hop_neighbors:
|
|
276
|
+
p2 = len(v_neighbors.intersection(G_adj[x]))
|
|
277
|
+
cycles += p2 * (p2 - 1)
|
|
278
|
+
return cycles / 4
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def _threepaths(G):
|
|
282
|
+
paths = 0
|
|
283
|
+
for v in G:
|
|
284
|
+
for u in G[v]:
|
|
285
|
+
for w in set(G[u]) - {v}:
|
|
286
|
+
paths += len(set(G[w]) - {v, u})
|
|
287
|
+
# Divide by two because we count each three path twice
|
|
288
|
+
# one for each possible starting point
|
|
289
|
+
return paths / 2
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""Functions related to graph covers."""
|
|
2
|
+
|
|
3
|
+
import networkx as nx
|
|
4
|
+
from networkx.algorithms.bipartite.matching import hopcroft_karp_matching
|
|
5
|
+
from networkx.algorithms.covering import min_edge_cover as _min_edge_cover
|
|
6
|
+
from networkx.utils import not_implemented_for
|
|
7
|
+
|
|
8
|
+
__all__ = ["min_edge_cover"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@not_implemented_for("directed")
|
|
12
|
+
@not_implemented_for("multigraph")
|
|
13
|
+
@nx._dispatchable(name="bipartite_min_edge_cover")
|
|
14
|
+
def min_edge_cover(G, matching_algorithm=None):
|
|
15
|
+
"""Returns a set of edges which constitutes
|
|
16
|
+
the minimum edge cover of the graph.
|
|
17
|
+
|
|
18
|
+
The smallest edge cover can be found in polynomial time by finding
|
|
19
|
+
a maximum matching and extending it greedily so that all nodes
|
|
20
|
+
are covered.
|
|
21
|
+
|
|
22
|
+
Parameters
|
|
23
|
+
----------
|
|
24
|
+
G : NetworkX graph
|
|
25
|
+
An undirected bipartite graph.
|
|
26
|
+
|
|
27
|
+
matching_algorithm : function
|
|
28
|
+
A function that returns a maximum cardinality matching in a
|
|
29
|
+
given bipartite graph. The function must take one input, the
|
|
30
|
+
graph ``G``, and return a dictionary mapping each node to its
|
|
31
|
+
mate. If not specified,
|
|
32
|
+
:func:`~networkx.algorithms.bipartite.matching.hopcroft_karp_matching`
|
|
33
|
+
will be used. Other possibilities include
|
|
34
|
+
:func:`~networkx.algorithms.bipartite.matching.eppstein_matching`,
|
|
35
|
+
|
|
36
|
+
Returns
|
|
37
|
+
-------
|
|
38
|
+
set
|
|
39
|
+
A set of the edges in a minimum edge cover of the graph, given as
|
|
40
|
+
pairs of nodes. It contains both the edges `(u, v)` and `(v, u)`
|
|
41
|
+
for given nodes `u` and `v` among the edges of minimum edge cover.
|
|
42
|
+
|
|
43
|
+
Notes
|
|
44
|
+
-----
|
|
45
|
+
An edge cover of a graph is a set of edges such that every node of
|
|
46
|
+
the graph is incident to at least one edge of the set.
|
|
47
|
+
A minimum edge cover is an edge covering of smallest cardinality.
|
|
48
|
+
|
|
49
|
+
Due to its implementation, the worst-case running time of this algorithm
|
|
50
|
+
is bounded by the worst-case running time of the function
|
|
51
|
+
``matching_algorithm``.
|
|
52
|
+
"""
|
|
53
|
+
if G.order() == 0: # Special case for the empty graph
|
|
54
|
+
return set()
|
|
55
|
+
if matching_algorithm is None:
|
|
56
|
+
matching_algorithm = hopcroft_karp_matching
|
|
57
|
+
return _min_edge_cover(G, matching_algorithm=matching_algorithm)
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
"""
|
|
2
|
+
********************
|
|
3
|
+
Bipartite Edge Lists
|
|
4
|
+
********************
|
|
5
|
+
Read and write NetworkX graphs as bipartite edge lists.
|
|
6
|
+
|
|
7
|
+
Format
|
|
8
|
+
------
|
|
9
|
+
You can read or write three formats of edge lists with these functions.
|
|
10
|
+
|
|
11
|
+
Node pairs with no data::
|
|
12
|
+
|
|
13
|
+
1 2
|
|
14
|
+
|
|
15
|
+
Python dictionary as data::
|
|
16
|
+
|
|
17
|
+
1 2 {'weight':7, 'color':'green'}
|
|
18
|
+
|
|
19
|
+
Arbitrary data::
|
|
20
|
+
|
|
21
|
+
1 2 7 green
|
|
22
|
+
|
|
23
|
+
For each edge (u, v) the node u is assigned to part 0 and the node v to part 1.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
__all__ = ["generate_edgelist", "write_edgelist", "parse_edgelist", "read_edgelist"]
|
|
27
|
+
|
|
28
|
+
import networkx as nx
|
|
29
|
+
from networkx.utils import not_implemented_for, open_file
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@open_file(1, mode="wb")
|
|
33
|
+
def write_edgelist(G, path, comments="#", delimiter=" ", data=True, encoding="utf-8"):
|
|
34
|
+
"""Write a bipartite graph as a list of edges.
|
|
35
|
+
|
|
36
|
+
Parameters
|
|
37
|
+
----------
|
|
38
|
+
G : Graph
|
|
39
|
+
A NetworkX bipartite graph
|
|
40
|
+
path : file or string
|
|
41
|
+
File or filename to write. If a file is provided, it must be
|
|
42
|
+
opened in 'wb' mode. Filenames ending in .gz or .bz2 will be compressed.
|
|
43
|
+
comments : string, optional
|
|
44
|
+
The character used to indicate the start of a comment
|
|
45
|
+
delimiter : string, optional
|
|
46
|
+
The string used to separate values. The default is whitespace.
|
|
47
|
+
data : bool or list, optional
|
|
48
|
+
If False write no edge data.
|
|
49
|
+
If True write a string representation of the edge data dictionary..
|
|
50
|
+
If a list (or other iterable) is provided, write the keys specified
|
|
51
|
+
in the list.
|
|
52
|
+
encoding: string, optional
|
|
53
|
+
Specify which encoding to use when writing file.
|
|
54
|
+
|
|
55
|
+
Examples
|
|
56
|
+
--------
|
|
57
|
+
>>> G = nx.path_graph(4)
|
|
58
|
+
>>> G.add_nodes_from([0, 2], bipartite=0)
|
|
59
|
+
>>> G.add_nodes_from([1, 3], bipartite=1)
|
|
60
|
+
>>> nx.write_edgelist(G, "test.edgelist")
|
|
61
|
+
>>> fh = open("test.edgelist_open", "wb")
|
|
62
|
+
>>> nx.write_edgelist(G, fh)
|
|
63
|
+
>>> nx.write_edgelist(G, "test.edgelist.gz")
|
|
64
|
+
>>> nx.write_edgelist(G, "test.edgelist_nodata.gz", data=False)
|
|
65
|
+
|
|
66
|
+
>>> G = nx.Graph()
|
|
67
|
+
>>> G.add_edge(1, 2, weight=7, color="red")
|
|
68
|
+
>>> nx.write_edgelist(G, "test.edgelist_bigger_nodata", data=False)
|
|
69
|
+
>>> nx.write_edgelist(G, "test.edgelist_color", data=["color"])
|
|
70
|
+
>>> nx.write_edgelist(G, "test.edgelist_color_weight", data=["color", "weight"])
|
|
71
|
+
|
|
72
|
+
See Also
|
|
73
|
+
--------
|
|
74
|
+
write_edgelist
|
|
75
|
+
generate_edgelist
|
|
76
|
+
"""
|
|
77
|
+
for line in generate_edgelist(G, delimiter, data):
|
|
78
|
+
line += "\n"
|
|
79
|
+
path.write(line.encode(encoding))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@not_implemented_for("directed")
|
|
83
|
+
def generate_edgelist(G, delimiter=" ", data=True):
|
|
84
|
+
"""Generate a single line of the bipartite graph G in edge list format.
|
|
85
|
+
|
|
86
|
+
Parameters
|
|
87
|
+
----------
|
|
88
|
+
G : NetworkX graph
|
|
89
|
+
The graph is assumed to have node attribute `part` set to 0,1 representing
|
|
90
|
+
the two graph parts
|
|
91
|
+
|
|
92
|
+
delimiter : string, optional
|
|
93
|
+
Separator for node labels
|
|
94
|
+
|
|
95
|
+
data : bool or list of keys
|
|
96
|
+
If False generate no edge data. If True use a dictionary
|
|
97
|
+
representation of edge data. If a list of keys use a list of data
|
|
98
|
+
values corresponding to the keys.
|
|
99
|
+
|
|
100
|
+
Returns
|
|
101
|
+
-------
|
|
102
|
+
lines : string
|
|
103
|
+
Lines of data in adjlist format.
|
|
104
|
+
|
|
105
|
+
Examples
|
|
106
|
+
--------
|
|
107
|
+
>>> from networkx.algorithms import bipartite
|
|
108
|
+
>>> G = nx.path_graph(4)
|
|
109
|
+
>>> G.add_nodes_from([0, 2], bipartite=0)
|
|
110
|
+
>>> G.add_nodes_from([1, 3], bipartite=1)
|
|
111
|
+
>>> G[1][2]["weight"] = 3
|
|
112
|
+
>>> G[2][3]["capacity"] = 12
|
|
113
|
+
>>> for line in bipartite.generate_edgelist(G, data=False):
|
|
114
|
+
... print(line)
|
|
115
|
+
0 1
|
|
116
|
+
2 1
|
|
117
|
+
2 3
|
|
118
|
+
|
|
119
|
+
>>> for line in bipartite.generate_edgelist(G):
|
|
120
|
+
... print(line)
|
|
121
|
+
0 1 {}
|
|
122
|
+
2 1 {'weight': 3}
|
|
123
|
+
2 3 {'capacity': 12}
|
|
124
|
+
|
|
125
|
+
>>> for line in bipartite.generate_edgelist(G, data=["weight"]):
|
|
126
|
+
... print(line)
|
|
127
|
+
0 1
|
|
128
|
+
2 1 3
|
|
129
|
+
2 3
|
|
130
|
+
"""
|
|
131
|
+
try:
|
|
132
|
+
part0 = [n for n, d in G.nodes.items() if d["bipartite"] == 0]
|
|
133
|
+
except BaseException as err:
|
|
134
|
+
raise AttributeError("Missing node attribute `bipartite`") from err
|
|
135
|
+
if data is True or data is False:
|
|
136
|
+
for n in part0:
|
|
137
|
+
for edge in G.edges(n, data=data):
|
|
138
|
+
yield delimiter.join(map(str, edge))
|
|
139
|
+
else:
|
|
140
|
+
for n in part0:
|
|
141
|
+
for u, v, d in G.edges(n, data=True):
|
|
142
|
+
edge = [u, v]
|
|
143
|
+
try:
|
|
144
|
+
edge.extend(d[k] for k in data)
|
|
145
|
+
except KeyError:
|
|
146
|
+
pass # missing data for this edge, should warn?
|
|
147
|
+
yield delimiter.join(map(str, edge))
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
@nx._dispatchable(name="bipartite_parse_edgelist", graphs=None, returns_graph=True)
|
|
151
|
+
def parse_edgelist(
|
|
152
|
+
lines, comments="#", delimiter=None, create_using=None, nodetype=None, data=True
|
|
153
|
+
):
|
|
154
|
+
"""Parse lines of an edge list representation of a bipartite graph.
|
|
155
|
+
|
|
156
|
+
Parameters
|
|
157
|
+
----------
|
|
158
|
+
lines : list or iterator of strings
|
|
159
|
+
Input data in edgelist format
|
|
160
|
+
comments : string, optional
|
|
161
|
+
Marker for comment lines
|
|
162
|
+
delimiter : string, optional
|
|
163
|
+
Separator for node labels
|
|
164
|
+
create_using: NetworkX graph container, optional
|
|
165
|
+
Use given NetworkX graph for holding nodes or edges.
|
|
166
|
+
nodetype : Python type, optional
|
|
167
|
+
Convert nodes to this type.
|
|
168
|
+
data : bool or list of (label,type) tuples
|
|
169
|
+
If False generate no edge data or if True use a dictionary
|
|
170
|
+
representation of edge data or a list tuples specifying dictionary
|
|
171
|
+
key names and types for edge data.
|
|
172
|
+
|
|
173
|
+
Returns
|
|
174
|
+
-------
|
|
175
|
+
G: NetworkX Graph
|
|
176
|
+
The bipartite graph corresponding to lines
|
|
177
|
+
|
|
178
|
+
Examples
|
|
179
|
+
--------
|
|
180
|
+
Edgelist with no data:
|
|
181
|
+
|
|
182
|
+
>>> from networkx.algorithms import bipartite
|
|
183
|
+
>>> lines = ["1 2", "2 3", "3 4"]
|
|
184
|
+
>>> G = bipartite.parse_edgelist(lines, nodetype=int)
|
|
185
|
+
>>> sorted(G.nodes())
|
|
186
|
+
[1, 2, 3, 4]
|
|
187
|
+
>>> sorted(G.nodes(data=True))
|
|
188
|
+
[(1, {'bipartite': 0}), (2, {'bipartite': 0}), (3, {'bipartite': 0}), (4, {'bipartite': 1})]
|
|
189
|
+
>>> sorted(G.edges())
|
|
190
|
+
[(1, 2), (2, 3), (3, 4)]
|
|
191
|
+
|
|
192
|
+
Edgelist with data in Python dictionary representation:
|
|
193
|
+
|
|
194
|
+
>>> lines = ["1 2 {'weight':3}", "2 3 {'weight':27}", "3 4 {'weight':3.0}"]
|
|
195
|
+
>>> G = bipartite.parse_edgelist(lines, nodetype=int)
|
|
196
|
+
>>> sorted(G.nodes())
|
|
197
|
+
[1, 2, 3, 4]
|
|
198
|
+
>>> sorted(G.edges(data=True))
|
|
199
|
+
[(1, 2, {'weight': 3}), (2, 3, {'weight': 27}), (3, 4, {'weight': 3.0})]
|
|
200
|
+
|
|
201
|
+
Edgelist with data in a list:
|
|
202
|
+
|
|
203
|
+
>>> lines = ["1 2 3", "2 3 27", "3 4 3.0"]
|
|
204
|
+
>>> G = bipartite.parse_edgelist(lines, nodetype=int, data=(("weight", float),))
|
|
205
|
+
>>> sorted(G.nodes())
|
|
206
|
+
[1, 2, 3, 4]
|
|
207
|
+
>>> sorted(G.edges(data=True))
|
|
208
|
+
[(1, 2, {'weight': 3.0}), (2, 3, {'weight': 27.0}), (3, 4, {'weight': 3.0})]
|
|
209
|
+
|
|
210
|
+
See Also
|
|
211
|
+
--------
|
|
212
|
+
"""
|
|
213
|
+
from ast import literal_eval
|
|
214
|
+
|
|
215
|
+
G = nx.empty_graph(0, create_using)
|
|
216
|
+
for line in lines:
|
|
217
|
+
p = line.find(comments)
|
|
218
|
+
if p >= 0:
|
|
219
|
+
line = line[:p]
|
|
220
|
+
if not len(line):
|
|
221
|
+
continue
|
|
222
|
+
# split line, should have 2 or more
|
|
223
|
+
s = line.rstrip("\n").split(delimiter)
|
|
224
|
+
if len(s) < 2:
|
|
225
|
+
continue
|
|
226
|
+
u = s.pop(0)
|
|
227
|
+
v = s.pop(0)
|
|
228
|
+
d = s
|
|
229
|
+
if nodetype is not None:
|
|
230
|
+
try:
|
|
231
|
+
u = nodetype(u)
|
|
232
|
+
v = nodetype(v)
|
|
233
|
+
except BaseException as err:
|
|
234
|
+
raise TypeError(
|
|
235
|
+
f"Failed to convert nodes {u},{v} to type {nodetype}."
|
|
236
|
+
) from err
|
|
237
|
+
|
|
238
|
+
if len(d) == 0 or data is False:
|
|
239
|
+
# no data or data type specified
|
|
240
|
+
edgedata = {}
|
|
241
|
+
elif data is True:
|
|
242
|
+
# no edge types specified
|
|
243
|
+
try: # try to evaluate as dictionary
|
|
244
|
+
edgedata = dict(literal_eval(" ".join(d)))
|
|
245
|
+
except BaseException as err:
|
|
246
|
+
raise TypeError(
|
|
247
|
+
f"Failed to convert edge data ({d}) to dictionary."
|
|
248
|
+
) from err
|
|
249
|
+
else:
|
|
250
|
+
# convert edge data to dictionary with specified keys and type
|
|
251
|
+
if len(d) != len(data):
|
|
252
|
+
raise IndexError(
|
|
253
|
+
f"Edge data {d} and data_keys {data} are not the same length"
|
|
254
|
+
)
|
|
255
|
+
edgedata = {}
|
|
256
|
+
for (edge_key, edge_type), edge_value in zip(data, d):
|
|
257
|
+
try:
|
|
258
|
+
edge_value = edge_type(edge_value)
|
|
259
|
+
except BaseException as err:
|
|
260
|
+
raise TypeError(
|
|
261
|
+
f"Failed to convert {edge_key} data "
|
|
262
|
+
f"{edge_value} to type {edge_type}."
|
|
263
|
+
) from err
|
|
264
|
+
edgedata.update({edge_key: edge_value})
|
|
265
|
+
G.add_node(u, bipartite=0)
|
|
266
|
+
G.add_node(v, bipartite=1)
|
|
267
|
+
G.add_edge(u, v, **edgedata)
|
|
268
|
+
return G
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
@open_file(0, mode="rb")
|
|
272
|
+
@nx._dispatchable(name="bipartite_read_edgelist", graphs=None, returns_graph=True)
|
|
273
|
+
def read_edgelist(
|
|
274
|
+
path,
|
|
275
|
+
comments="#",
|
|
276
|
+
delimiter=None,
|
|
277
|
+
create_using=None,
|
|
278
|
+
nodetype=None,
|
|
279
|
+
data=True,
|
|
280
|
+
edgetype=None,
|
|
281
|
+
encoding="utf-8",
|
|
282
|
+
):
|
|
283
|
+
"""Read a bipartite graph from a list of edges.
|
|
284
|
+
|
|
285
|
+
Parameters
|
|
286
|
+
----------
|
|
287
|
+
path : file or string
|
|
288
|
+
File or filename to read. If a file is provided, it must be
|
|
289
|
+
opened in 'rb' mode.
|
|
290
|
+
Filenames ending in .gz or .bz2 will be decompressed.
|
|
291
|
+
comments : string, optional
|
|
292
|
+
The character used to indicate the start of a comment.
|
|
293
|
+
delimiter : string, optional
|
|
294
|
+
The string used to separate values. The default is whitespace.
|
|
295
|
+
create_using : Graph container, optional,
|
|
296
|
+
Use specified container to build graph. The default is networkx.Graph,
|
|
297
|
+
an undirected graph.
|
|
298
|
+
nodetype : int, float, str, Python type, optional
|
|
299
|
+
Convert node data from strings to specified type
|
|
300
|
+
data : bool or list of (label,type) tuples
|
|
301
|
+
Tuples specifying dictionary key names and types for edge data
|
|
302
|
+
edgetype : int, float, str, Python type, optional OBSOLETE
|
|
303
|
+
Convert edge data from strings to specified type and use as 'weight'
|
|
304
|
+
encoding: string, optional
|
|
305
|
+
Specify which encoding to use when reading file.
|
|
306
|
+
|
|
307
|
+
Returns
|
|
308
|
+
-------
|
|
309
|
+
G : graph
|
|
310
|
+
A networkx Graph or other type specified with create_using
|
|
311
|
+
|
|
312
|
+
Examples
|
|
313
|
+
--------
|
|
314
|
+
>>> from networkx.algorithms import bipartite
|
|
315
|
+
>>> G = nx.path_graph(4)
|
|
316
|
+
>>> G.add_nodes_from([0, 2], bipartite=0)
|
|
317
|
+
>>> G.add_nodes_from([1, 3], bipartite=1)
|
|
318
|
+
>>> bipartite.write_edgelist(G, "test.edgelist")
|
|
319
|
+
>>> G = bipartite.read_edgelist("test.edgelist")
|
|
320
|
+
|
|
321
|
+
>>> fh = open("test.edgelist", "rb")
|
|
322
|
+
>>> G = bipartite.read_edgelist(fh)
|
|
323
|
+
>>> fh.close()
|
|
324
|
+
|
|
325
|
+
>>> G = bipartite.read_edgelist("test.edgelist", nodetype=int)
|
|
326
|
+
|
|
327
|
+
Edgelist with data in a list:
|
|
328
|
+
|
|
329
|
+
>>> textline = "1 2 3"
|
|
330
|
+
>>> fh = open("test.edgelist", "w")
|
|
331
|
+
>>> d = fh.write(textline)
|
|
332
|
+
>>> fh.close()
|
|
333
|
+
>>> G = bipartite.read_edgelist(
|
|
334
|
+
... "test.edgelist", nodetype=int, data=(("weight", float),)
|
|
335
|
+
... )
|
|
336
|
+
>>> list(G)
|
|
337
|
+
[1, 2]
|
|
338
|
+
>>> list(G.edges(data=True))
|
|
339
|
+
[(1, 2, {'weight': 3.0})]
|
|
340
|
+
|
|
341
|
+
See parse_edgelist() for more examples of formatting.
|
|
342
|
+
|
|
343
|
+
See Also
|
|
344
|
+
--------
|
|
345
|
+
parse_edgelist
|
|
346
|
+
|
|
347
|
+
Notes
|
|
348
|
+
-----
|
|
349
|
+
Since nodes must be hashable, the function nodetype must return hashable
|
|
350
|
+
types (e.g. int, float, str, frozenset - or tuples of those, etc.)
|
|
351
|
+
"""
|
|
352
|
+
lines = (line.decode(encoding) for line in path)
|
|
353
|
+
return parse_edgelist(
|
|
354
|
+
lines,
|
|
355
|
+
comments=comments,
|
|
356
|
+
delimiter=delimiter,
|
|
357
|
+
create_using=create_using,
|
|
358
|
+
nodetype=nodetype,
|
|
359
|
+
data=data,
|
|
360
|
+
)
|