okstra 0.108.0 → 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/profiles/_common-contract.md +1 -1
- 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_project/__init__.py +2 -0
- package/runtime/python/okstra_project/state.py +36 -0
- 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/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,182 @@
|
|
|
1
|
+
# Video transcription using faster-whisper
|
|
2
|
+
# Converts video/audio files to text transcripts for graph extraction
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
VIDEO_EXTENSIONS = {'.mp4', '.mov', '.webm', '.mkv', '.avi', '.m4v', '.mp3', '.wav', '.m4a', '.ogg'}
|
|
10
|
+
URL_PREFIXES = ('http://', 'https://', 'www.')
|
|
11
|
+
|
|
12
|
+
_DEFAULT_MODEL = "base"
|
|
13
|
+
_TRANSCRIPTS_DIR = "graphify-out/transcripts"
|
|
14
|
+
_FALLBACK_PROMPT = "Use proper punctuation and paragraph breaks."
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _model_name() -> str:
|
|
18
|
+
return os.environ.get("GRAPHIFY_WHISPER_MODEL", _DEFAULT_MODEL)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _get_whisper():
|
|
22
|
+
try:
|
|
23
|
+
from faster_whisper import WhisperModel
|
|
24
|
+
return WhisperModel
|
|
25
|
+
except ImportError as exc:
|
|
26
|
+
raise ImportError(
|
|
27
|
+
"Video transcription requires faster-whisper. "
|
|
28
|
+
"Run: pip install 'graphifyy[video]'"
|
|
29
|
+
) from exc
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _get_yt_dlp():
|
|
33
|
+
try:
|
|
34
|
+
import yt_dlp
|
|
35
|
+
return yt_dlp
|
|
36
|
+
except ImportError as exc:
|
|
37
|
+
raise ImportError(
|
|
38
|
+
"YouTube/URL download requires yt-dlp. "
|
|
39
|
+
"Run: pip install 'graphifyy[video]'"
|
|
40
|
+
) from exc
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def is_url(path: str) -> bool:
|
|
44
|
+
"""Return True if the string looks like a URL rather than a file path."""
|
|
45
|
+
return any(path.startswith(p) for p in URL_PREFIXES)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def download_audio(url: str, output_dir: Path) -> Path:
|
|
49
|
+
"""Download audio-only stream from a URL using yt-dlp.
|
|
50
|
+
|
|
51
|
+
Returns the path to the downloaded audio file (.m4a or .opus).
|
|
52
|
+
Uses cached file if already downloaded.
|
|
53
|
+
"""
|
|
54
|
+
yt_dlp = _get_yt_dlp()
|
|
55
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
56
|
+
|
|
57
|
+
# yt-dlp uses %(title)s which can be long/weird — use a stable name based on URL hash
|
|
58
|
+
import hashlib
|
|
59
|
+
url_hash = hashlib.sha1(url.encode()).hexdigest()[:12]
|
|
60
|
+
out_template = str(output_dir / f"yt_{url_hash}.%(ext)s")
|
|
61
|
+
|
|
62
|
+
# Check for already-downloaded file
|
|
63
|
+
for ext in ('.m4a', '.opus', '.mp3', '.ogg', '.wav', '.webm'):
|
|
64
|
+
candidate = output_dir / f"yt_{url_hash}{ext}"
|
|
65
|
+
if candidate.exists():
|
|
66
|
+
print(f" cached audio: {candidate.name}")
|
|
67
|
+
return candidate
|
|
68
|
+
|
|
69
|
+
ydl_opts = {
|
|
70
|
+
'format': 'bestaudio[ext=m4a]/bestaudio/best',
|
|
71
|
+
'outtmpl': out_template,
|
|
72
|
+
'quiet': True,
|
|
73
|
+
'no_warnings': True,
|
|
74
|
+
'noplaylist': True,
|
|
75
|
+
'postprocessors': [], # no ffmpeg needed — use native audio
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
print(f" downloading audio: {url[:80]} ...", flush=True)
|
|
79
|
+
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
|
80
|
+
info = ydl.extract_info(url, download=True)
|
|
81
|
+
ext = info.get('ext', 'm4a')
|
|
82
|
+
downloaded = output_dir / f"yt_{url_hash}.{ext}"
|
|
83
|
+
if not downloaded.exists():
|
|
84
|
+
# yt-dlp may have picked a different extension
|
|
85
|
+
for p in output_dir.glob(f"yt_{url_hash}.*"):
|
|
86
|
+
downloaded = p
|
|
87
|
+
break
|
|
88
|
+
return downloaded
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def build_whisper_prompt(god_nodes: list[dict]) -> str:
|
|
92
|
+
"""Build a domain hint for Whisper from god nodes extracted from the corpus.
|
|
93
|
+
|
|
94
|
+
Formats the top god node labels into a topic string for Whisper.
|
|
95
|
+
The coding agent (Claude Code, Codex, etc.) generates the actual one-sentence
|
|
96
|
+
domain hint from these labels and passes it via GRAPHIFY_WHISPER_PROMPT or
|
|
97
|
+
as initial_prompt — no separate API call needed here.
|
|
98
|
+
"""
|
|
99
|
+
if not god_nodes:
|
|
100
|
+
return _FALLBACK_PROMPT
|
|
101
|
+
|
|
102
|
+
override = os.environ.get("GRAPHIFY_WHISPER_PROMPT")
|
|
103
|
+
if override:
|
|
104
|
+
return override
|
|
105
|
+
|
|
106
|
+
labels = [n.get("label", "") for n in god_nodes[:10] if n.get("label")]
|
|
107
|
+
if not labels:
|
|
108
|
+
return _FALLBACK_PROMPT
|
|
109
|
+
|
|
110
|
+
topics = ", ".join(labels[:5])
|
|
111
|
+
return f"Technical discussion about {topics}. Use proper punctuation and paragraph breaks."
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def transcribe(
|
|
115
|
+
video_path: Path | str,
|
|
116
|
+
output_dir: Path | None = None,
|
|
117
|
+
initial_prompt: str | None = None,
|
|
118
|
+
force: bool = False,
|
|
119
|
+
) -> Path:
|
|
120
|
+
"""Transcribe a video/audio file or URL to a .txt transcript.
|
|
121
|
+
|
|
122
|
+
If video_path is a URL, audio is downloaded first via yt-dlp.
|
|
123
|
+
Returns the path to the saved transcript file.
|
|
124
|
+
Uses cached transcript if it exists unless force=True.
|
|
125
|
+
|
|
126
|
+
initial_prompt: domain hint for Whisper (built from corpus god nodes).
|
|
127
|
+
force: re-transcribe even if transcript already exists.
|
|
128
|
+
"""
|
|
129
|
+
out_dir = Path(output_dir) if output_dir else Path(_TRANSCRIPTS_DIR)
|
|
130
|
+
out_dir.mkdir(parents=True, exist_ok=True)
|
|
131
|
+
|
|
132
|
+
if is_url(str(video_path)):
|
|
133
|
+
audio_path = download_audio(str(video_path), out_dir / "downloads")
|
|
134
|
+
else:
|
|
135
|
+
audio_path = Path(video_path)
|
|
136
|
+
|
|
137
|
+
transcript_path = out_dir / (audio_path.stem + ".txt")
|
|
138
|
+
if transcript_path.exists() and not force:
|
|
139
|
+
return transcript_path
|
|
140
|
+
|
|
141
|
+
WhisperModel = _get_whisper()
|
|
142
|
+
model_name = _model_name()
|
|
143
|
+
prompt = initial_prompt or _FALLBACK_PROMPT
|
|
144
|
+
|
|
145
|
+
print(f" transcribing {audio_path.name} (model={model_name}) ...", flush=True)
|
|
146
|
+
model = WhisperModel(model_name, device="cpu", compute_type="int8")
|
|
147
|
+
segments, info = model.transcribe(
|
|
148
|
+
str(audio_path),
|
|
149
|
+
beam_size=5,
|
|
150
|
+
initial_prompt=prompt,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
lines = [segment.text.strip() for segment in segments if segment.text.strip()]
|
|
154
|
+
transcript = "\n".join(lines)
|
|
155
|
+
|
|
156
|
+
transcript_path.write_text(transcript, encoding="utf-8")
|
|
157
|
+
lang = info.language if hasattr(info, "language") else "unknown"
|
|
158
|
+
print(f" transcript saved -> {transcript_path} (lang={lang}, {len(lines)} segments)")
|
|
159
|
+
return transcript_path
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def transcribe_all(
|
|
163
|
+
video_files: list[str],
|
|
164
|
+
output_dir: Path | None = None,
|
|
165
|
+
initial_prompt: str | None = None,
|
|
166
|
+
) -> list[str]:
|
|
167
|
+
"""Transcribe a list of video/audio files or URLs, return paths to transcript .txt files.
|
|
168
|
+
|
|
169
|
+
Already-transcribed files are returned from cache instantly.
|
|
170
|
+
initial_prompt is shared across all files — built once from corpus god nodes.
|
|
171
|
+
"""
|
|
172
|
+
if not video_files:
|
|
173
|
+
return []
|
|
174
|
+
|
|
175
|
+
transcript_paths = []
|
|
176
|
+
for vf in video_files:
|
|
177
|
+
try:
|
|
178
|
+
t = transcribe(vf, output_dir, initial_prompt=initial_prompt)
|
|
179
|
+
transcript_paths.append(str(t))
|
|
180
|
+
except Exception as exc:
|
|
181
|
+
print(f" warning: could not transcribe {vf}: {exc}")
|
|
182
|
+
return transcript_paths
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# validate extraction JSON against the graphify schema before graph assembly
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
VALID_FILE_TYPES = {"code", "document", "paper", "image", "rationale"}
|
|
5
|
+
VALID_CONFIDENCES = {"EXTRACTED", "INFERRED", "AMBIGUOUS"}
|
|
6
|
+
REQUIRED_NODE_FIELDS = {"id", "label", "file_type", "source_file"}
|
|
7
|
+
REQUIRED_EDGE_FIELDS = {"source", "target", "relation", "confidence", "source_file"}
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def validate_extraction(data: dict) -> list[str]:
|
|
11
|
+
"""
|
|
12
|
+
Validate an extraction JSON dict against the graphify schema.
|
|
13
|
+
Returns a list of error strings - empty list means valid.
|
|
14
|
+
"""
|
|
15
|
+
if not isinstance(data, dict):
|
|
16
|
+
return ["Extraction must be a JSON object"]
|
|
17
|
+
|
|
18
|
+
errors: list[str] = []
|
|
19
|
+
|
|
20
|
+
# Nodes
|
|
21
|
+
if "nodes" not in data:
|
|
22
|
+
errors.append("Missing required key 'nodes'")
|
|
23
|
+
elif not isinstance(data["nodes"], list):
|
|
24
|
+
errors.append("'nodes' must be a list")
|
|
25
|
+
else:
|
|
26
|
+
for i, node in enumerate(data["nodes"]):
|
|
27
|
+
if not isinstance(node, dict):
|
|
28
|
+
errors.append(f"Node {i} must be an object")
|
|
29
|
+
continue
|
|
30
|
+
for field in REQUIRED_NODE_FIELDS:
|
|
31
|
+
if field not in node:
|
|
32
|
+
errors.append(f"Node {i} (id={node.get('id', '?')!r}) missing required field '{field}'")
|
|
33
|
+
if "file_type" in node and node["file_type"] not in VALID_FILE_TYPES:
|
|
34
|
+
errors.append(
|
|
35
|
+
f"Node {i} (id={node.get('id', '?')!r}) has invalid file_type "
|
|
36
|
+
f"'{node['file_type']}' - must be one of {sorted(VALID_FILE_TYPES)}"
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
# Edges - accept "links" (NetworkX <= 3.1) as fallback for "edges"
|
|
40
|
+
edge_list = data.get("edges") if "edges" in data else data.get("links")
|
|
41
|
+
if edge_list is None:
|
|
42
|
+
errors.append("Missing required key 'edges'")
|
|
43
|
+
elif not isinstance(edge_list, list):
|
|
44
|
+
errors.append("'edges' must be a list")
|
|
45
|
+
else:
|
|
46
|
+
node_ids = {n["id"] for n in data.get("nodes", []) if isinstance(n, dict) and "id" in n}
|
|
47
|
+
for i, edge in enumerate(edge_list):
|
|
48
|
+
if not isinstance(edge, dict):
|
|
49
|
+
errors.append(f"Edge {i} must be an object")
|
|
50
|
+
continue
|
|
51
|
+
for field in REQUIRED_EDGE_FIELDS:
|
|
52
|
+
if field not in edge:
|
|
53
|
+
errors.append(f"Edge {i} missing required field '{field}'")
|
|
54
|
+
if "confidence" in edge and edge["confidence"] not in VALID_CONFIDENCES:
|
|
55
|
+
errors.append(
|
|
56
|
+
f"Edge {i} has invalid confidence '{edge['confidence']}' "
|
|
57
|
+
f"- must be one of {sorted(VALID_CONFIDENCES)}"
|
|
58
|
+
)
|
|
59
|
+
if "source" in edge and node_ids and edge["source"] not in node_ids:
|
|
60
|
+
errors.append(f"Edge {i} source '{edge['source']}' does not match any node id")
|
|
61
|
+
if "target" in edge and node_ids and edge["target"] not in node_ids:
|
|
62
|
+
errors.append(f"Edge {i} target '{edge['target']}' does not match any node id")
|
|
63
|
+
|
|
64
|
+
return errors
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def assert_valid(data: dict) -> None:
|
|
68
|
+
"""Raise ValueError with all errors if extraction is invalid."""
|
|
69
|
+
errors = validate_extraction(data)
|
|
70
|
+
if errors:
|
|
71
|
+
msg = f"Extraction JSON has {len(errors)} error(s):\n" + "\n".join(f" • {e}" for e in errors)
|
|
72
|
+
raise ValueError(msg)
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# monitor a folder and auto-trigger --update when files change
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
import json
|
|
4
|
+
import sys
|
|
5
|
+
import time
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
from graphify.detect import CODE_EXTENSIONS, DOC_EXTENSIONS, PAPER_EXTENSIONS, IMAGE_EXTENSIONS
|
|
10
|
+
|
|
11
|
+
_WATCHED_EXTENSIONS = CODE_EXTENSIONS | DOC_EXTENSIONS | PAPER_EXTENSIONS | IMAGE_EXTENSIONS
|
|
12
|
+
_CODE_EXTENSIONS = CODE_EXTENSIONS
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _rebuild_code(watch_path: Path, *, follow_symlinks: bool = False) -> bool:
|
|
16
|
+
"""Re-run AST extraction + build + cluster + report for code files. No LLM needed.
|
|
17
|
+
|
|
18
|
+
Returns True on success, False on error.
|
|
19
|
+
"""
|
|
20
|
+
watch_path = watch_path.resolve()
|
|
21
|
+
try:
|
|
22
|
+
from graphify.extract import extract
|
|
23
|
+
from graphify.detect import detect
|
|
24
|
+
from graphify.build import build_from_json
|
|
25
|
+
from graphify.cluster import cluster, score_all
|
|
26
|
+
from graphify.analyze import god_nodes, surprising_connections, suggest_questions
|
|
27
|
+
from graphify.report import generate
|
|
28
|
+
from graphify.export import to_json, to_html
|
|
29
|
+
|
|
30
|
+
detected = detect(watch_path, follow_symlinks=follow_symlinks)
|
|
31
|
+
code_files = [Path(f) for f in detected['files']['code']]
|
|
32
|
+
|
|
33
|
+
if not code_files:
|
|
34
|
+
print("[graphify watch] No code files found - nothing to rebuild.")
|
|
35
|
+
return False
|
|
36
|
+
|
|
37
|
+
result = extract(code_files, cache_root=watch_path)
|
|
38
|
+
|
|
39
|
+
# Preserve semantic nodes/edges from a previous full run.
|
|
40
|
+
# AST-only rebuild replaces code nodes; doc/paper/image nodes are kept.
|
|
41
|
+
out = watch_path / "graphify-out"
|
|
42
|
+
existing_graph = out / "graph.json"
|
|
43
|
+
if existing_graph.exists():
|
|
44
|
+
try:
|
|
45
|
+
existing = json.loads(existing_graph.read_text(encoding="utf-8"))
|
|
46
|
+
code_ids = {n["id"] for n in existing.get("nodes", []) if n.get("file_type") == "code"}
|
|
47
|
+
sem_nodes = [n for n in existing.get("nodes", []) if n.get("file_type") != "code"]
|
|
48
|
+
sem_edges = [e for e in existing.get("links", existing.get("edges", []))
|
|
49
|
+
if e.get("confidence") in ("INFERRED", "AMBIGUOUS")
|
|
50
|
+
or (e.get("source") not in code_ids and e.get("target") not in code_ids)]
|
|
51
|
+
result = {
|
|
52
|
+
"nodes": result["nodes"] + sem_nodes,
|
|
53
|
+
"edges": result["edges"] + sem_edges,
|
|
54
|
+
"hyperedges": existing.get("hyperedges", []),
|
|
55
|
+
"input_tokens": 0,
|
|
56
|
+
"output_tokens": 0,
|
|
57
|
+
}
|
|
58
|
+
except Exception:
|
|
59
|
+
pass # corrupt graph.json - proceed with AST-only
|
|
60
|
+
|
|
61
|
+
detection = {
|
|
62
|
+
"files": {"code": [str(f) for f in code_files], "document": [], "paper": [], "image": []},
|
|
63
|
+
"total_files": len(code_files),
|
|
64
|
+
"total_words": detected.get("total_words", 0),
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
G = build_from_json(result)
|
|
68
|
+
communities = cluster(G)
|
|
69
|
+
cohesion = score_all(G, communities)
|
|
70
|
+
gods = god_nodes(G)
|
|
71
|
+
surprises = surprising_connections(G, communities)
|
|
72
|
+
labels = {cid: "Community " + str(cid) for cid in communities}
|
|
73
|
+
questions = suggest_questions(G, communities, labels)
|
|
74
|
+
|
|
75
|
+
out.mkdir(exist_ok=True)
|
|
76
|
+
|
|
77
|
+
report = generate(G, communities, cohesion, labels, gods, surprises, detection,
|
|
78
|
+
{"input": 0, "output": 0}, str(watch_path), suggested_questions=questions)
|
|
79
|
+
(out / "GRAPH_REPORT.md").write_text(report, encoding="utf-8")
|
|
80
|
+
to_json(G, communities, str(out / "graph.json"))
|
|
81
|
+
to_html(G, communities, str(out / "graph.html"), community_labels=labels or None)
|
|
82
|
+
|
|
83
|
+
# clear stale needs_update flag if present
|
|
84
|
+
flag = out / "needs_update"
|
|
85
|
+
if flag.exists():
|
|
86
|
+
flag.unlink()
|
|
87
|
+
|
|
88
|
+
print(f"[graphify watch] Rebuilt: {G.number_of_nodes()} nodes, "
|
|
89
|
+
f"{G.number_of_edges()} edges, {len(communities)} communities")
|
|
90
|
+
print(f"[graphify watch] graph.json, graph.html and GRAPH_REPORT.md updated in {out}")
|
|
91
|
+
return True
|
|
92
|
+
|
|
93
|
+
except Exception as exc:
|
|
94
|
+
print(f"[graphify watch] Rebuild failed: {exc}")
|
|
95
|
+
return False
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _notify_only(watch_path: Path) -> None:
|
|
99
|
+
"""Write a flag file and print a notification (fallback for non-code-only corpora)."""
|
|
100
|
+
flag = watch_path / "graphify-out" / "needs_update"
|
|
101
|
+
flag.parent.mkdir(parents=True, exist_ok=True)
|
|
102
|
+
flag.write_text("1", encoding="utf-8")
|
|
103
|
+
print(f"\n[graphify watch] New or changed files detected in {watch_path}")
|
|
104
|
+
print("[graphify watch] Non-code files changed - semantic re-extraction requires LLM.")
|
|
105
|
+
print("[graphify watch] Run `/graphify --update` in Claude Code to update the graph.")
|
|
106
|
+
print(f"[graphify watch] Flag written to {flag}")
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _has_non_code(changed_paths: list[Path]) -> bool:
|
|
110
|
+
return any(p.suffix.lower() not in _CODE_EXTENSIONS for p in changed_paths)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def watch(watch_path: Path, debounce: float = 3.0) -> None:
|
|
114
|
+
"""
|
|
115
|
+
Watch watch_path for new or modified files and auto-update the graph.
|
|
116
|
+
|
|
117
|
+
For code-only changes: re-runs AST extraction + rebuild immediately (no LLM).
|
|
118
|
+
For doc/paper/image changes: writes a needs_update flag and notifies the user
|
|
119
|
+
to run /graphify --update (LLM extraction required).
|
|
120
|
+
|
|
121
|
+
debounce: seconds to wait after the last change before triggering (avoids
|
|
122
|
+
running on every keystroke when many files are saved at once).
|
|
123
|
+
"""
|
|
124
|
+
try:
|
|
125
|
+
from watchdog.observers import Observer
|
|
126
|
+
from watchdog.observers.polling import PollingObserver
|
|
127
|
+
from watchdog.events import FileSystemEventHandler
|
|
128
|
+
except ImportError as e:
|
|
129
|
+
raise ImportError("watchdog not installed. Run: pip install watchdog") from e
|
|
130
|
+
|
|
131
|
+
last_trigger: float = 0.0
|
|
132
|
+
pending: bool = False
|
|
133
|
+
changed: set[Path] = set()
|
|
134
|
+
|
|
135
|
+
class Handler(FileSystemEventHandler):
|
|
136
|
+
def on_any_event(self, event):
|
|
137
|
+
nonlocal last_trigger, pending
|
|
138
|
+
if event.is_directory:
|
|
139
|
+
return
|
|
140
|
+
path = Path(event.src_path)
|
|
141
|
+
if path.suffix.lower() not in _WATCHED_EXTENSIONS:
|
|
142
|
+
return
|
|
143
|
+
if any(part.startswith(".") for part in path.parts):
|
|
144
|
+
return
|
|
145
|
+
if "graphify-out" in path.parts:
|
|
146
|
+
return
|
|
147
|
+
last_trigger = time.monotonic()
|
|
148
|
+
pending = True
|
|
149
|
+
changed.add(path)
|
|
150
|
+
|
|
151
|
+
handler = Handler()
|
|
152
|
+
# Use polling observer on macOS — FSEvents can miss rapid saves in some editors
|
|
153
|
+
observer = PollingObserver() if sys.platform == "darwin" else Observer()
|
|
154
|
+
observer.schedule(handler, str(watch_path), recursive=True)
|
|
155
|
+
observer.start()
|
|
156
|
+
|
|
157
|
+
print(f"[graphify watch] Watching {watch_path.resolve()} - press Ctrl+C to stop")
|
|
158
|
+
print(f"[graphify watch] Code changes rebuild graph automatically. "
|
|
159
|
+
f"Doc/image changes require /graphify --update.")
|
|
160
|
+
print(f"[graphify watch] Debounce: {debounce}s")
|
|
161
|
+
|
|
162
|
+
try:
|
|
163
|
+
while True:
|
|
164
|
+
time.sleep(0.5)
|
|
165
|
+
if pending and (time.monotonic() - last_trigger) >= debounce:
|
|
166
|
+
pending = False
|
|
167
|
+
batch = list(changed)
|
|
168
|
+
changed.clear()
|
|
169
|
+
print(f"\n[graphify watch] {len(batch)} file(s) changed")
|
|
170
|
+
if _has_non_code(batch):
|
|
171
|
+
_notify_only(watch_path)
|
|
172
|
+
else:
|
|
173
|
+
_rebuild_code(watch_path)
|
|
174
|
+
except KeyboardInterrupt:
|
|
175
|
+
print("\n[graphify watch] Stopped.")
|
|
176
|
+
finally:
|
|
177
|
+
observer.stop()
|
|
178
|
+
observer.join()
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
if __name__ == "__main__":
|
|
182
|
+
import argparse
|
|
183
|
+
parser = argparse.ArgumentParser(description="Watch a folder and auto-update the graphify graph")
|
|
184
|
+
parser.add_argument("path", nargs="?", default=".", help="Folder to watch (default: .)")
|
|
185
|
+
parser.add_argument("--debounce", type=float, default=3.0,
|
|
186
|
+
help="Seconds to wait after last change before updating (default: 3)")
|
|
187
|
+
args = parser.parse_args()
|
|
188
|
+
watch(Path(args.path), debounce=args.debounce)
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# Wiki export - Wikipedia-style markdown articles from the knowledge graph
|
|
2
|
+
# Generates an agent-crawlable wiki: index.md + one article per community + god node articles
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from collections import Counter
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import networkx as nx
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _safe_filename(name: str) -> str:
|
|
10
|
+
return name.replace("/", "-").replace(" ", "_").replace(":", "-")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _cross_community_links(G: nx.Graph, nodes: list[str], own_cid: int, labels: dict[int, str]) -> list[tuple[str, int]]:
|
|
14
|
+
"""Return (community_label, edge_count) pairs for cross-community connections, sorted descending."""
|
|
15
|
+
counts: dict[str, int] = Counter()
|
|
16
|
+
for nid in nodes:
|
|
17
|
+
for neighbor in G.neighbors(nid):
|
|
18
|
+
nd = G.nodes[neighbor]
|
|
19
|
+
ncid = nd.get("community")
|
|
20
|
+
if ncid is not None and ncid != own_cid:
|
|
21
|
+
counts[labels.get(ncid, f"Community {ncid}")] += 1
|
|
22
|
+
return sorted(counts.items(), key=lambda x: -x[1])
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _community_article(
|
|
26
|
+
G: nx.Graph,
|
|
27
|
+
cid: int,
|
|
28
|
+
nodes: list[str],
|
|
29
|
+
label: str,
|
|
30
|
+
labels: dict[int, str],
|
|
31
|
+
cohesion: float | None,
|
|
32
|
+
) -> str:
|
|
33
|
+
top_nodes = sorted(nodes, key=lambda n: G.degree(n), reverse=True)[:25]
|
|
34
|
+
cross = _cross_community_links(G, nodes, cid, labels)
|
|
35
|
+
|
|
36
|
+
# Edge confidence breakdown
|
|
37
|
+
conf_counts: Counter = Counter()
|
|
38
|
+
for nid in nodes:
|
|
39
|
+
for neighbor in G.neighbors(nid):
|
|
40
|
+
ed = G.edges[nid, neighbor]
|
|
41
|
+
conf_counts[ed.get("confidence", "EXTRACTED")] += 1
|
|
42
|
+
total_edges = sum(conf_counts.values()) or 1
|
|
43
|
+
|
|
44
|
+
sources = sorted({G.nodes[n].get("source_file", "") for n in nodes} - {""})
|
|
45
|
+
|
|
46
|
+
lines: list[str] = []
|
|
47
|
+
lines += [f"# {label}", ""]
|
|
48
|
+
|
|
49
|
+
meta_parts = [f"{len(nodes)} nodes"]
|
|
50
|
+
if cohesion is not None:
|
|
51
|
+
meta_parts.append(f"cohesion {cohesion:.2f}")
|
|
52
|
+
lines += [f"> {' · '.join(meta_parts)}", ""]
|
|
53
|
+
|
|
54
|
+
lines += ["## Key Concepts", ""]
|
|
55
|
+
for nid in top_nodes:
|
|
56
|
+
d = G.nodes[nid]
|
|
57
|
+
node_label = d.get("label", nid)
|
|
58
|
+
src = d.get("source_file", "")
|
|
59
|
+
degree = G.degree(nid)
|
|
60
|
+
src_str = f" — `{src}`" if src else ""
|
|
61
|
+
lines.append(f"- **{node_label}** ({degree} connections){src_str}")
|
|
62
|
+
remaining = len(nodes) - len(top_nodes)
|
|
63
|
+
if remaining > 0:
|
|
64
|
+
lines.append(f"- *... and {remaining} more nodes in this community*")
|
|
65
|
+
lines.append("")
|
|
66
|
+
|
|
67
|
+
lines += ["## Relationships", ""]
|
|
68
|
+
if cross:
|
|
69
|
+
for other_label, count in cross[:12]:
|
|
70
|
+
lines.append(f"- [[{other_label}]] ({count} shared connections)")
|
|
71
|
+
else:
|
|
72
|
+
lines.append("- No strong cross-community connections detected")
|
|
73
|
+
lines.append("")
|
|
74
|
+
|
|
75
|
+
if sources:
|
|
76
|
+
lines += ["## Source Files", ""]
|
|
77
|
+
for src in sources[:20]:
|
|
78
|
+
lines.append(f"- `{src}`")
|
|
79
|
+
lines.append("")
|
|
80
|
+
|
|
81
|
+
lines += ["## Audit Trail", ""]
|
|
82
|
+
for conf in ("EXTRACTED", "INFERRED", "AMBIGUOUS"):
|
|
83
|
+
n = conf_counts.get(conf, 0)
|
|
84
|
+
pct = round(n / total_edges * 100)
|
|
85
|
+
lines.append(f"- {conf}: {n} ({pct}%)")
|
|
86
|
+
lines.append("")
|
|
87
|
+
|
|
88
|
+
lines += ["---", "", "*Part of the graphify knowledge wiki. See [[index]] to navigate.*"]
|
|
89
|
+
return "\n".join(lines)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _god_node_article(G: nx.Graph, nid: str, labels: dict[int, str]) -> str:
|
|
93
|
+
d = G.nodes[nid]
|
|
94
|
+
node_label = d.get("label", nid)
|
|
95
|
+
src = d.get("source_file", "")
|
|
96
|
+
cid = d.get("community")
|
|
97
|
+
community_name = labels.get(cid, f"Community {cid}") if cid is not None else None
|
|
98
|
+
|
|
99
|
+
lines: list[str] = []
|
|
100
|
+
lines += [f"# {node_label}", ""]
|
|
101
|
+
lines += [f"> God node · {G.degree(nid)} connections · `{src}`", ""]
|
|
102
|
+
|
|
103
|
+
if community_name:
|
|
104
|
+
lines += [f"**Community:** [[{community_name}]]", ""]
|
|
105
|
+
|
|
106
|
+
# Group neighbors by relation type
|
|
107
|
+
by_relation: dict[str, list[str]] = {}
|
|
108
|
+
for neighbor in sorted(G.neighbors(nid), key=lambda n: G.degree(n), reverse=True):
|
|
109
|
+
nd = G.nodes[neighbor]
|
|
110
|
+
ed = G.edges[nid, neighbor]
|
|
111
|
+
rel = ed.get("relation", "related")
|
|
112
|
+
neighbor_label = nd.get("label", neighbor)
|
|
113
|
+
conf = ed.get("confidence", "")
|
|
114
|
+
conf_str = f" `{conf}`" if conf else ""
|
|
115
|
+
by_relation.setdefault(rel, []).append(f"[[{neighbor_label}]]{conf_str}")
|
|
116
|
+
|
|
117
|
+
lines += ["## Connections by Relation", ""]
|
|
118
|
+
for rel, targets in sorted(by_relation.items()):
|
|
119
|
+
lines.append(f"### {rel}")
|
|
120
|
+
for t in targets[:20]:
|
|
121
|
+
lines.append(f"- {t}")
|
|
122
|
+
lines.append("")
|
|
123
|
+
|
|
124
|
+
lines += ["---", "", "*Part of the graphify knowledge wiki. See [[index]] to navigate.*"]
|
|
125
|
+
return "\n".join(lines)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _index_md(
|
|
129
|
+
communities: dict[int, list[str]],
|
|
130
|
+
labels: dict[int, str],
|
|
131
|
+
god_nodes_data: list[dict],
|
|
132
|
+
total_nodes: int,
|
|
133
|
+
total_edges: int,
|
|
134
|
+
) -> str:
|
|
135
|
+
lines: list[str] = [
|
|
136
|
+
"# Knowledge Graph Index",
|
|
137
|
+
"",
|
|
138
|
+
"> Auto-generated by graphify. Start here — read community articles for context, then drill into god nodes for detail.",
|
|
139
|
+
"",
|
|
140
|
+
f"**{total_nodes} nodes · {total_edges} edges · {len(communities)} communities**",
|
|
141
|
+
"",
|
|
142
|
+
"---",
|
|
143
|
+
"",
|
|
144
|
+
"## Communities",
|
|
145
|
+
"(sorted by size, largest first)",
|
|
146
|
+
"",
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
for cid, nodes in sorted(communities.items(), key=lambda x: -len(x[1])):
|
|
150
|
+
label = labels.get(cid, f"Community {cid}")
|
|
151
|
+
lines.append(f"- [[{label}]] — {len(nodes)} nodes")
|
|
152
|
+
lines.append("")
|
|
153
|
+
|
|
154
|
+
if god_nodes_data:
|
|
155
|
+
lines += ["## God Nodes", "(most connected concepts — the load-bearing abstractions)", ""]
|
|
156
|
+
for node in god_nodes_data:
|
|
157
|
+
lines.append(f"- [[{node['label']}]] — {node['degree']} connections")
|
|
158
|
+
lines.append("")
|
|
159
|
+
|
|
160
|
+
lines += [
|
|
161
|
+
"---",
|
|
162
|
+
"",
|
|
163
|
+
"*Generated by [graphify](https://github.com/safishamsi/graphify)*",
|
|
164
|
+
]
|
|
165
|
+
return "\n".join(lines)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def to_wiki(
|
|
169
|
+
G: nx.Graph,
|
|
170
|
+
communities: dict[int, list[str]],
|
|
171
|
+
output_dir: str | Path,
|
|
172
|
+
community_labels: dict[int, str] | None = None,
|
|
173
|
+
cohesion: dict[int, float] | None = None,
|
|
174
|
+
god_nodes_data: list[dict] | None = None,
|
|
175
|
+
) -> int:
|
|
176
|
+
"""Generate a Wikipedia-style wiki from the graph.
|
|
177
|
+
|
|
178
|
+
Writes:
|
|
179
|
+
- index.md — agent entry point, catalog of all articles
|
|
180
|
+
- <CommunityName>.md — one article per community
|
|
181
|
+
- <GodNodeLabel>.md — one article per god node
|
|
182
|
+
|
|
183
|
+
Returns the number of articles written (excluding index.md).
|
|
184
|
+
"""
|
|
185
|
+
out = Path(output_dir)
|
|
186
|
+
out.mkdir(parents=True, exist_ok=True)
|
|
187
|
+
|
|
188
|
+
labels = community_labels or {cid: f"Community {cid}" for cid in communities}
|
|
189
|
+
cohesion = cohesion or {}
|
|
190
|
+
god_nodes_data = god_nodes_data or []
|
|
191
|
+
|
|
192
|
+
count = 0
|
|
193
|
+
|
|
194
|
+
# Community articles
|
|
195
|
+
for cid, nodes in communities.items():
|
|
196
|
+
label = labels.get(cid, f"Community {cid}")
|
|
197
|
+
article = _community_article(G, cid, nodes, label, labels, cohesion.get(cid))
|
|
198
|
+
(out / f"{_safe_filename(label)}.md").write_text(article)
|
|
199
|
+
count += 1
|
|
200
|
+
|
|
201
|
+
# God node articles
|
|
202
|
+
for node_data in god_nodes_data:
|
|
203
|
+
nid = node_data.get("id")
|
|
204
|
+
if nid and nid in G:
|
|
205
|
+
article = _god_node_article(G, nid, labels)
|
|
206
|
+
(out / f"{_safe_filename(node_data['label'])}.md").write_text(article)
|
|
207
|
+
count += 1
|
|
208
|
+
|
|
209
|
+
# Index
|
|
210
|
+
(out / "index.md").write_text(
|
|
211
|
+
_index_md(communities, labels, god_nodes_data, G.number_of_nodes(), G.number_of_edges())
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
return count
|