okstra 0.114.0 → 0.116.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/docs/kr/architecture.md +2 -2
- package/docs/kr/follow-ups/2026-07-10-final-report-option-3.md +51 -0
- package/package.json +1 -1
- package/runtime/BUILD.json +2 -2
- package/runtime/agents/workers/report-writer-worker.md +1 -0
- package/runtime/prompts/launch.template.md +34 -0
- package/runtime/prompts/lead/convergence.md +2 -0
- package/runtime/prompts/lead/okstra-lead-contract.md +1 -1
- package/runtime/prompts/lead/report-writer.md +1 -1
- package/runtime/prompts/profiles/implementation-planning.md +1 -0
- package/runtime/python/okstra_ctl/implementation_stage.py +46 -39
- package/runtime/python/okstra_ctl/incremental_carry.py +70 -0
- package/runtime/python/okstra_ctl/incremental_scope.py +89 -0
- package/runtime/python/okstra_ctl/report_views.py +151 -12
- package/runtime/python/okstra_ctl/run.py +24 -24
- package/runtime/python/okstra_ctl/stage_targets.py +26 -0
- package/runtime/python/okstra_ctl/worktree.py +1 -1
- package/runtime/python/okstra_token_usage/claude.py +58 -19
- package/runtime/python/okstra_token_usage/collect.py +3 -1
- package/runtime/python/okstra_vendor/__init__.py +3 -0
- package/runtime/schemas/final-report-v1.0.schema.json +39 -0
- package/runtime/templates/reports/final-report.template.md +27 -0
- package/runtime/templates/reports/i18n/en.json +23 -12
- package/runtime/templates/reports/i18n/ko.json +23 -12
- package/runtime/templates/reports/report.css +55 -0
- package/runtime/templates/reports/report.js +53 -1
- package/runtime/validators/validate-run.py +50 -0
- package/src/cli-registry.mjs +14 -0
- package/src/commands/execute/incremental-carry.mjs +20 -0
- package/src/commands/execute/incremental-scope.mjs +20 -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 +0 -41
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_clique.py +0 -112
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_connectivity.py +0 -199
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_density.py +0 -146
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_distance_measures.py +0 -59
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_dominating_set.py +0 -78
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_kcomponents.py +0 -303
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_matching.py +0 -8
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_maxcut.py +0 -94
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_ramsey.py +0 -31
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_steinertree.py +0 -306
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_traveling_salesman.py +0 -1014
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_treewidth.py +0 -274
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_vertex_cover.py +0 -68
- 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 +0 -81
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_connectivity.py +0 -143
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_correlation.py +0 -122
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_mixing.py +0 -174
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_neighbor_degree.py +0 -107
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_pairs.py +0 -87
- 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 +0 -125
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_centrality.py +0 -192
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_cluster.py +0 -84
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_covering.py +0 -33
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_edgelist.py +0 -240
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_extendability.py +0 -334
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_generators.py +0 -407
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_link_analysis.py +0 -218
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_matching.py +0 -327
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_matrix.py +0 -138
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_project.py +0 -409
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_redundancy.py +0 -35
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_spectral_bipartivity.py +0 -80
- 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 +0 -923
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_betweenness_centrality_subset.py +0 -354
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_closeness_centrality.py +0 -274
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality.py +0 -259
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality_subset.py +0 -147
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_closeness.py +0 -43
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_degree_centrality.py +0 -144
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_dispersion.py +0 -73
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_eigenvector_centrality.py +0 -186
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_group.py +0 -277
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_harmonic_centrality.py +0 -122
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_katz_centrality.py +0 -345
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_laplacian_centrality.py +0 -220
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_load_centrality.py +0 -344
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_percolation_centrality.py +0 -87
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_reaching.py +0 -140
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_second_order_centrality.py +0 -82
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_subgraph.py +0 -110
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_trophic.py +0 -302
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_voterank.py +0 -64
- 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 +0 -863
- 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 +0 -147
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_bipartitions.py +0 -157
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_centrality.py +0 -85
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_divisive.py +0 -106
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_kclique.py +0 -91
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_label_propagation.py +0 -241
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_leiden.py +0 -138
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_local.py +0 -76
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_louvain.py +0 -264
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_lukes.py +0 -152
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_modularity_max.py +0 -340
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_quality.py +0 -139
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_utils.py +0 -26
- 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 +0 -70
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_biconnected.py +0 -248
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_connected.py +0 -138
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_semiconnected.py +0 -55
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_strongly_connected.py +0 -193
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_weakly_connected.py +0 -96
- 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 +0 -421
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_cuts.py +0 -309
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_disjoint_paths.py +0 -249
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_edge_augmentation.py +0 -502
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_edge_kcomponents.py +0 -488
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_kcomponents.py +0 -323
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_kcutsets.py +0 -280
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_stoer_wagner.py +0 -102
- 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 +0 -128
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_maxflow.py +0 -573
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_maxflow_large_graph.py +0 -155
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_mincost.py +0 -475
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_networksimplex.py +0 -481
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/wlm3.gpickle.bz2 +0 -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 +0 -719
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_isomorphism.py +0 -103
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_isomorphvf2.py +0 -490
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_match_helpers.py +0 -64
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_temporalisomorphvf2.py +0 -212
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_tree_isomorphism.py +0 -202
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2pp.py +0 -1655
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2pp_helpers.py +0 -3118
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2userfunc.py +0 -196
- 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 +0 -77
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/test_pagerank.py +0 -213
- package/runtime/python/okstra_vendor/networkx/algorithms/minors/tests/test_contraction.py +0 -544
- 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 +0 -328
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_binary.py +0 -451
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_product.py +0 -491
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_unary.py +0 -55
- 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 +0 -254
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_dense.py +0 -212
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_dense_numpy.py +0 -88
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_generic.py +0 -511
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_unweighted.py +0 -149
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_weighted.py +0 -983
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_asteroidal.py +0 -23
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_boundary.py +0 -154
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_bridges.py +0 -144
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_broadcasting.py +0 -109
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_chains.py +0 -136
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_chordal.py +0 -129
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_clique.py +0 -300
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cluster.py +0 -678
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_communicability.py +0 -80
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_core.py +0 -266
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_covering.py +0 -85
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cuts.py +0 -171
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cycles.py +0 -984
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_d_separation.py +0 -340
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dag.py +0 -835
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_distance_measures.py +0 -831
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_distance_regular.py +0 -85
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dominance.py +0 -299
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dominating.py +0 -115
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_efficiency.py +0 -58
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_euler.py +0 -314
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_graph_hashing.py +0 -872
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_graphical.py +0 -163
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_hierarchy.py +0 -46
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_hybrid.py +0 -24
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_isolate.py +0 -26
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_link_prediction.py +0 -615
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_lowest_common_ancestors.py +0 -459
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_matching.py +0 -556
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_max_weight_clique.py +0 -179
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_mis.py +0 -62
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_moral.py +0 -15
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_node_classification.py +0 -140
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_non_randomness.py +0 -60
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_perfect_graph.py +0 -27
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_planar_drawing.py +0 -274
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_planarity.py +0 -556
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_polynomials.py +0 -57
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_reciprocity.py +0 -37
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_regular.py +0 -88
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_richclub.py +0 -149
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_similarity.py +0 -1158
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_simple_paths.py +0 -803
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_smallworld.py +0 -76
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_smetric.py +0 -8
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_sparsifiers.py +0 -138
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_structuralholes.py +0 -191
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_summarization.py +0 -642
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_swap.py +0 -179
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_threshold.py +0 -270
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_time_dependent.py +0 -431
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_tournament.py +0 -161
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_triads.py +0 -248
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_vitality.py +0 -41
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_voronoi.py +0 -103
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_walks.py +0 -54
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_wiener.py +0 -157
- 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 +0 -25
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_bfs.py +0 -203
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_dfs.py +0 -307
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_edgebfs.py +0 -147
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_edgedfs.py +0 -131
- 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 +0 -624
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_coding.py +0 -114
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_decomposition.py +0 -79
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_distance_measures.py +0 -99
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_mst.py +0 -934
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_operations.py +0 -53
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_recognition.py +0 -174
- package/runtime/python/okstra_vendor/networkx/classes/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/dispatch_interface.py +0 -192
- package/runtime/python/okstra_vendor/networkx/classes/tests/historical_tests.py +0 -476
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_coreviews.py +0 -362
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_digraph.py +0 -331
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_digraph_historical.py +0 -110
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_filters.py +0 -177
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_function.py +0 -1045
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_graph.py +0 -950
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_graph_historical.py +0 -12
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_graphviews.py +0 -349
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_multidigraph.py +0 -459
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_multigraph.py +0 -528
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_reportviews.py +0 -1421
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_special.py +0 -131
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_subgraphviews.py +0 -371
- package/runtime/python/okstra_vendor/networkx/conftest.py +0 -261
- 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 +0 -237
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_image_comparison_pylab_mpl.py +0 -229
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_latex.py +0 -285
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_layout.py +0 -631
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_pydot.py +0 -146
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_pylab.py +0 -1582
- package/runtime/python/okstra_vendor/networkx/generators/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_atlas.py +0 -75
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_classic.py +0 -642
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_cographs.py +0 -20
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_community.py +0 -362
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_degree_seq.py +0 -224
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_directed.py +0 -189
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_duplication.py +0 -103
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_ego.py +0 -39
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_expanders.py +0 -182
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_geometric.py +0 -488
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_harary_graph.py +0 -133
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_internet_as_graphs.py +0 -221
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_intersection.py +0 -28
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_interval_graph.py +0 -144
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_joint_degree_seq.py +0 -125
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_lattice.py +0 -264
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_line.py +0 -316
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_mycielski.py +0 -30
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_nonisomorphic_trees.py +0 -82
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_random_clustered.py +0 -33
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_random_graphs.py +0 -495
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_small.py +0 -220
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_spectral_graph_forge.py +0 -49
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_stochastic.py +0 -72
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_sudoku.py +0 -92
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_time_series.py +0 -64
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_trees.py +0 -195
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_triads.py +0 -15
- package/runtime/python/okstra_vendor/networkx/linalg/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_algebraic_connectivity.py +0 -400
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_attrmatrix.py +0 -108
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_bethehessian.py +0 -40
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_graphmatrix.py +0 -275
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_laplacian.py +0 -334
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_modularity.py +0 -86
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_spectrum.py +0 -70
- 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 +0 -78
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_cytoscape.py +0 -78
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_node_link.py +0 -109
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_tree.py +0 -48
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_adjlist.py +0 -354
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_edgelist.py +0 -318
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_gexf.py +0 -612
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_gml.py +0 -744
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_graph6.py +0 -181
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_graphml.py +0 -1531
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_leda.py +0 -30
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_p2g.py +0 -63
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_pajek.py +0 -128
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_sparse6.py +0 -166
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_text.py +0 -1742
- package/runtime/python/okstra_vendor/networkx/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_all_random_functions.py +0 -248
- package/runtime/python/okstra_vendor/networkx/tests/test_convert.py +0 -321
- package/runtime/python/okstra_vendor/networkx/tests/test_convert_numpy.py +0 -531
- package/runtime/python/okstra_vendor/networkx/tests/test_convert_pandas.py +0 -349
- package/runtime/python/okstra_vendor/networkx/tests/test_convert_scipy.py +0 -281
- package/runtime/python/okstra_vendor/networkx/tests/test_exceptions.py +0 -40
- package/runtime/python/okstra_vendor/networkx/tests/test_import.py +0 -11
- package/runtime/python/okstra_vendor/networkx/tests/test_lazy_imports.py +0 -96
- package/runtime/python/okstra_vendor/networkx/tests/test_relabel.py +0 -349
- package/runtime/python/okstra_vendor/networkx/tests/test_removed_functions_exception_messages.py +0 -8
- package/runtime/python/okstra_vendor/networkx/utils/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test__init.py +0 -11
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_backends.py +0 -225
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_config.py +0 -263
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_decorators.py +0 -510
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_heaps.py +0 -131
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_mapped_queue.py +0 -268
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_misc.py +0 -393
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_random_sequence.py +0 -53
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_rcm.py +0 -63
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_unionfind.py +0 -55
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
"""Tests for the :mod:`networkx.algorithms.triads` module."""
|
|
2
|
-
|
|
3
|
-
import itertools
|
|
4
|
-
from collections import defaultdict
|
|
5
|
-
from random import sample
|
|
6
|
-
|
|
7
|
-
import pytest
|
|
8
|
-
|
|
9
|
-
import networkx as nx
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def test_triadic_census():
|
|
13
|
-
"""Tests the triadic_census function."""
|
|
14
|
-
G = nx.DiGraph()
|
|
15
|
-
G.add_edges_from(["01", "02", "03", "04", "05", "12", "16", "51", "56", "65"])
|
|
16
|
-
expected = {
|
|
17
|
-
"030T": 2,
|
|
18
|
-
"120C": 1,
|
|
19
|
-
"210": 0,
|
|
20
|
-
"120U": 0,
|
|
21
|
-
"012": 9,
|
|
22
|
-
"102": 3,
|
|
23
|
-
"021U": 0,
|
|
24
|
-
"111U": 0,
|
|
25
|
-
"003": 8,
|
|
26
|
-
"030C": 0,
|
|
27
|
-
"021D": 9,
|
|
28
|
-
"201": 0,
|
|
29
|
-
"111D": 1,
|
|
30
|
-
"300": 0,
|
|
31
|
-
"120D": 0,
|
|
32
|
-
"021C": 2,
|
|
33
|
-
}
|
|
34
|
-
actual = nx.triadic_census(G)
|
|
35
|
-
assert expected == actual
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def test_is_triad():
|
|
39
|
-
"""Tests the is_triad function"""
|
|
40
|
-
G = nx.karate_club_graph()
|
|
41
|
-
G = G.to_directed()
|
|
42
|
-
for i in range(100):
|
|
43
|
-
nodes = sample(sorted(G.nodes()), 3)
|
|
44
|
-
G2 = G.subgraph(nodes)
|
|
45
|
-
assert nx.is_triad(G2)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
def test_all_triads():
|
|
49
|
-
"""Tests the all_triads function."""
|
|
50
|
-
G = nx.DiGraph()
|
|
51
|
-
G.add_edges_from(["01", "02", "03", "04", "05", "12", "16", "51", "56", "65"])
|
|
52
|
-
expected = [
|
|
53
|
-
f"{i},{j},{k}"
|
|
54
|
-
for i in range(7)
|
|
55
|
-
for j in range(i + 1, 7)
|
|
56
|
-
for k in range(j + 1, 7)
|
|
57
|
-
]
|
|
58
|
-
expected = [G.subgraph(x.split(",")) for x in expected]
|
|
59
|
-
actual = list(nx.all_triads(G))
|
|
60
|
-
assert all(any(nx.is_isomorphic(G1, G2) for G1 in expected) for G2 in actual)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def test_triad_type():
|
|
64
|
-
"""Tests the triad_type function."""
|
|
65
|
-
# 0 edges (1 type)
|
|
66
|
-
G = nx.DiGraph({0: [], 1: [], 2: []})
|
|
67
|
-
assert nx.triad_type(G) == "003"
|
|
68
|
-
# 1 edge (1 type)
|
|
69
|
-
G = nx.DiGraph({0: [1], 1: [], 2: []})
|
|
70
|
-
assert nx.triad_type(G) == "012"
|
|
71
|
-
# 2 edges (4 types)
|
|
72
|
-
G = nx.DiGraph([(0, 1), (0, 2)])
|
|
73
|
-
assert nx.triad_type(G) == "021D"
|
|
74
|
-
G = nx.DiGraph({0: [1], 1: [0], 2: []})
|
|
75
|
-
assert nx.triad_type(G) == "102"
|
|
76
|
-
G = nx.DiGraph([(0, 1), (2, 1)])
|
|
77
|
-
assert nx.triad_type(G) == "021U"
|
|
78
|
-
G = nx.DiGraph([(0, 1), (1, 2)])
|
|
79
|
-
assert nx.triad_type(G) == "021C"
|
|
80
|
-
# 3 edges (4 types)
|
|
81
|
-
G = nx.DiGraph([(0, 1), (1, 0), (2, 1)])
|
|
82
|
-
assert nx.triad_type(G) == "111D"
|
|
83
|
-
G = nx.DiGraph([(0, 1), (1, 0), (1, 2)])
|
|
84
|
-
assert nx.triad_type(G) == "111U"
|
|
85
|
-
G = nx.DiGraph([(0, 1), (1, 2), (0, 2)])
|
|
86
|
-
assert nx.triad_type(G) == "030T"
|
|
87
|
-
G = nx.DiGraph([(0, 1), (1, 2), (2, 0)])
|
|
88
|
-
assert nx.triad_type(G) == "030C"
|
|
89
|
-
# 4 edges (4 types)
|
|
90
|
-
G = nx.DiGraph([(0, 1), (1, 0), (2, 0), (0, 2)])
|
|
91
|
-
assert nx.triad_type(G) == "201"
|
|
92
|
-
G = nx.DiGraph([(0, 1), (1, 0), (2, 0), (2, 1)])
|
|
93
|
-
assert nx.triad_type(G) == "120D"
|
|
94
|
-
G = nx.DiGraph([(0, 1), (1, 0), (0, 2), (1, 2)])
|
|
95
|
-
assert nx.triad_type(G) == "120U"
|
|
96
|
-
G = nx.DiGraph([(0, 1), (1, 0), (0, 2), (2, 1)])
|
|
97
|
-
assert nx.triad_type(G) == "120C"
|
|
98
|
-
# 5 edges (1 type)
|
|
99
|
-
G = nx.DiGraph([(0, 1), (1, 0), (2, 1), (1, 2), (0, 2)])
|
|
100
|
-
assert nx.triad_type(G) == "210"
|
|
101
|
-
# 6 edges (1 type)
|
|
102
|
-
G = nx.DiGraph([(0, 1), (1, 0), (1, 2), (2, 1), (0, 2), (2, 0)])
|
|
103
|
-
assert nx.triad_type(G) == "300"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
def test_triads_by_type():
|
|
107
|
-
G = nx.DiGraph()
|
|
108
|
-
G.add_edges_from(["01", "02", "03", "04", "05", "12", "16", "51", "56", "65"])
|
|
109
|
-
all_triads = nx.all_triads(G)
|
|
110
|
-
expected = defaultdict(list)
|
|
111
|
-
for triad in all_triads:
|
|
112
|
-
name = nx.triad_type(triad)
|
|
113
|
-
expected[name].append(triad)
|
|
114
|
-
actual = nx.triads_by_type(G)
|
|
115
|
-
assert set(actual.keys()) == set(expected.keys())
|
|
116
|
-
for tri_type, actual_Gs in actual.items():
|
|
117
|
-
expected_Gs = expected[tri_type]
|
|
118
|
-
for a in actual_Gs:
|
|
119
|
-
assert any(nx.is_isomorphic(a, e) for e in expected_Gs)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
def test_triadic_census_short_path_nodelist():
|
|
123
|
-
G = nx.path_graph("abc", create_using=nx.DiGraph)
|
|
124
|
-
expected = {"021C": 1}
|
|
125
|
-
for nl in ["a", "b", "c", "ab", "ac", "bc", "abc"]:
|
|
126
|
-
triad_census = nx.triadic_census(G, nodelist=nl)
|
|
127
|
-
assert expected == {typ: cnt for typ, cnt in triad_census.items() if cnt > 0}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
def test_triadic_census_correct_nodelist_values():
|
|
131
|
-
G = nx.path_graph(5, create_using=nx.DiGraph)
|
|
132
|
-
msg = r"nodelist includes duplicate nodes or nodes not in G"
|
|
133
|
-
with pytest.raises(ValueError, match=msg):
|
|
134
|
-
nx.triadic_census(G, [1, 2, 2, 3])
|
|
135
|
-
with pytest.raises(ValueError, match=msg):
|
|
136
|
-
nx.triadic_census(G, [1, 2, "a", 3])
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
def test_triadic_census_tiny_graphs():
|
|
140
|
-
tc = nx.triadic_census(nx.empty_graph(0, create_using=nx.DiGraph))
|
|
141
|
-
assert {} == {typ: cnt for typ, cnt in tc.items() if cnt > 0}
|
|
142
|
-
tc = nx.triadic_census(nx.empty_graph(1, create_using=nx.DiGraph))
|
|
143
|
-
assert {} == {typ: cnt for typ, cnt in tc.items() if cnt > 0}
|
|
144
|
-
tc = nx.triadic_census(nx.empty_graph(2, create_using=nx.DiGraph))
|
|
145
|
-
assert {} == {typ: cnt for typ, cnt in tc.items() if cnt > 0}
|
|
146
|
-
tc = nx.triadic_census(nx.DiGraph([(1, 2)]))
|
|
147
|
-
assert {} == {typ: cnt for typ, cnt in tc.items() if cnt > 0}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
def test_triadic_census_selfloops():
|
|
151
|
-
GG = nx.path_graph("abc", create_using=nx.DiGraph)
|
|
152
|
-
expected = {"021C": 1}
|
|
153
|
-
for n in GG:
|
|
154
|
-
G = GG.copy()
|
|
155
|
-
G.add_edge(n, n)
|
|
156
|
-
tc = nx.triadic_census(G)
|
|
157
|
-
assert expected == {typ: cnt for typ, cnt in tc.items() if cnt > 0}
|
|
158
|
-
|
|
159
|
-
GG = nx.path_graph("abcde", create_using=nx.DiGraph)
|
|
160
|
-
tbt = nx.triads_by_type(GG)
|
|
161
|
-
for n in GG:
|
|
162
|
-
GG.add_edge(n, n)
|
|
163
|
-
tc = nx.triadic_census(GG)
|
|
164
|
-
assert tc == {tt: len(tbt[tt]) for tt in tc}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
def test_triadic_census_four_path():
|
|
168
|
-
G = nx.path_graph("abcd", create_using=nx.DiGraph)
|
|
169
|
-
expected = {"012": 2, "021C": 2}
|
|
170
|
-
triad_census = nx.triadic_census(G)
|
|
171
|
-
assert expected == {typ: cnt for typ, cnt in triad_census.items() if cnt > 0}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
def test_triadic_census_four_path_nodelist():
|
|
175
|
-
G = nx.path_graph("abcd", create_using=nx.DiGraph)
|
|
176
|
-
expected_end = {"012": 2, "021C": 1}
|
|
177
|
-
expected_mid = {"012": 1, "021C": 2}
|
|
178
|
-
a_triad_census = nx.triadic_census(G, nodelist=["a"])
|
|
179
|
-
assert expected_end == {typ: cnt for typ, cnt in a_triad_census.items() if cnt > 0}
|
|
180
|
-
b_triad_census = nx.triadic_census(G, nodelist=["b"])
|
|
181
|
-
assert expected_mid == {typ: cnt for typ, cnt in b_triad_census.items() if cnt > 0}
|
|
182
|
-
c_triad_census = nx.triadic_census(G, nodelist=["c"])
|
|
183
|
-
assert expected_mid == {typ: cnt for typ, cnt in c_triad_census.items() if cnt > 0}
|
|
184
|
-
d_triad_census = nx.triadic_census(G, nodelist=["d"])
|
|
185
|
-
assert expected_end == {typ: cnt for typ, cnt in d_triad_census.items() if cnt > 0}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
def test_triadic_census_nodelist():
|
|
189
|
-
"""Tests the triadic_census function."""
|
|
190
|
-
G = nx.DiGraph()
|
|
191
|
-
G.add_edges_from(["01", "02", "03", "04", "05", "12", "16", "51", "56", "65"])
|
|
192
|
-
expected = {
|
|
193
|
-
"030T": 2,
|
|
194
|
-
"120C": 1,
|
|
195
|
-
"210": 0,
|
|
196
|
-
"120U": 0,
|
|
197
|
-
"012": 9,
|
|
198
|
-
"102": 3,
|
|
199
|
-
"021U": 0,
|
|
200
|
-
"111U": 0,
|
|
201
|
-
"003": 8,
|
|
202
|
-
"030C": 0,
|
|
203
|
-
"021D": 9,
|
|
204
|
-
"201": 0,
|
|
205
|
-
"111D": 1,
|
|
206
|
-
"300": 0,
|
|
207
|
-
"120D": 0,
|
|
208
|
-
"021C": 2,
|
|
209
|
-
}
|
|
210
|
-
actual = {k: 0 for k in expected}
|
|
211
|
-
for node in G.nodes():
|
|
212
|
-
node_triad_census = nx.triadic_census(G, nodelist=[node])
|
|
213
|
-
for triad_key in expected:
|
|
214
|
-
actual[triad_key] += node_triad_census[triad_key]
|
|
215
|
-
# Divide all counts by 3
|
|
216
|
-
for k, v in actual.items():
|
|
217
|
-
actual[k] //= 3
|
|
218
|
-
assert expected == actual
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
@pytest.mark.parametrize("N", [5, 10])
|
|
222
|
-
def test_triadic_census_on_random_graph(N):
|
|
223
|
-
G = nx.binomial_graph(N, 0.3, directed=True, seed=42)
|
|
224
|
-
tc1 = nx.triadic_census(G)
|
|
225
|
-
tbt = nx.triads_by_type(G)
|
|
226
|
-
tc2 = {tt: len(tbt[tt]) for tt in tc1}
|
|
227
|
-
assert tc1 == tc2
|
|
228
|
-
|
|
229
|
-
for n in G:
|
|
230
|
-
tc1 = nx.triadic_census(G, nodelist={n})
|
|
231
|
-
tc2 = {tt: sum(1 for t in tbt.get(tt, []) if n in t) for tt in tc1}
|
|
232
|
-
assert tc1 == tc2
|
|
233
|
-
|
|
234
|
-
for ns in itertools.combinations(G, 2):
|
|
235
|
-
ns = set(ns)
|
|
236
|
-
tc1 = nx.triadic_census(G, nodelist=ns)
|
|
237
|
-
tc2 = {
|
|
238
|
-
tt: sum(1 for t in tbt.get(tt, []) if any(n in ns for n in t)) for tt in tc1
|
|
239
|
-
}
|
|
240
|
-
assert tc1 == tc2
|
|
241
|
-
|
|
242
|
-
for ns in itertools.combinations(G, 3):
|
|
243
|
-
ns = set(ns)
|
|
244
|
-
tc1 = nx.triadic_census(G, nodelist=ns)
|
|
245
|
-
tc2 = {
|
|
246
|
-
tt: sum(1 for t in tbt.get(tt, []) if any(n in ns for n in t)) for tt in tc1
|
|
247
|
-
}
|
|
248
|
-
assert tc1 == tc2
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import networkx as nx
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class TestClosenessVitality:
|
|
5
|
-
def test_unweighted(self):
|
|
6
|
-
G = nx.cycle_graph(3)
|
|
7
|
-
vitality = nx.closeness_vitality(G)
|
|
8
|
-
assert vitality == {0: 2, 1: 2, 2: 2}
|
|
9
|
-
|
|
10
|
-
def test_weighted(self):
|
|
11
|
-
G = nx.Graph()
|
|
12
|
-
nx.add_cycle(G, [0, 1, 2], weight=2)
|
|
13
|
-
vitality = nx.closeness_vitality(G, weight="weight")
|
|
14
|
-
assert vitality == {0: 4, 1: 4, 2: 4}
|
|
15
|
-
|
|
16
|
-
def test_unweighted_digraph(self):
|
|
17
|
-
G = nx.DiGraph(nx.cycle_graph(3))
|
|
18
|
-
vitality = nx.closeness_vitality(G)
|
|
19
|
-
assert vitality == {0: 4, 1: 4, 2: 4}
|
|
20
|
-
|
|
21
|
-
def test_weighted_digraph(self):
|
|
22
|
-
G = nx.DiGraph()
|
|
23
|
-
nx.add_cycle(G, [0, 1, 2], weight=2)
|
|
24
|
-
nx.add_cycle(G, [2, 1, 0], weight=2)
|
|
25
|
-
vitality = nx.closeness_vitality(G, weight="weight")
|
|
26
|
-
assert vitality == {0: 8, 1: 8, 2: 8}
|
|
27
|
-
|
|
28
|
-
def test_weighted_multidigraph(self):
|
|
29
|
-
G = nx.MultiDiGraph()
|
|
30
|
-
nx.add_cycle(G, [0, 1, 2], weight=2)
|
|
31
|
-
nx.add_cycle(G, [2, 1, 0], weight=2)
|
|
32
|
-
vitality = nx.closeness_vitality(G, weight="weight")
|
|
33
|
-
assert vitality == {0: 8, 1: 8, 2: 8}
|
|
34
|
-
|
|
35
|
-
def test_disconnecting_graph(self):
|
|
36
|
-
"""Tests that the closeness vitality of a node whose removal
|
|
37
|
-
disconnects the graph is negative infinity.
|
|
38
|
-
|
|
39
|
-
"""
|
|
40
|
-
G = nx.path_graph(3)
|
|
41
|
-
assert nx.closeness_vitality(G, node=1) == -float("inf")
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import networkx as nx
|
|
2
|
-
from networkx.utils import pairwise
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class TestVoronoiCells:
|
|
6
|
-
"""Unit tests for the Voronoi cells function."""
|
|
7
|
-
|
|
8
|
-
def test_isolates(self):
|
|
9
|
-
"""Tests that a graph with isolated nodes has all isolates in
|
|
10
|
-
one block of the partition.
|
|
11
|
-
|
|
12
|
-
"""
|
|
13
|
-
G = nx.empty_graph(5)
|
|
14
|
-
cells = nx.voronoi_cells(G, {0, 2, 4})
|
|
15
|
-
expected = {0: {0}, 2: {2}, 4: {4}, "unreachable": {1, 3}}
|
|
16
|
-
assert expected == cells
|
|
17
|
-
|
|
18
|
-
def test_undirected_unweighted(self):
|
|
19
|
-
G = nx.cycle_graph(6)
|
|
20
|
-
cells = nx.voronoi_cells(G, {0, 3})
|
|
21
|
-
expected = {0: {0, 1, 5}, 3: {2, 3, 4}}
|
|
22
|
-
assert expected == cells
|
|
23
|
-
|
|
24
|
-
def test_directed_unweighted(self):
|
|
25
|
-
# This is the singly-linked directed cycle graph on six nodes.
|
|
26
|
-
G = nx.DiGraph(pairwise(range(6), cyclic=True))
|
|
27
|
-
cells = nx.voronoi_cells(G, {0, 3})
|
|
28
|
-
expected = {0: {0, 1, 2}, 3: {3, 4, 5}}
|
|
29
|
-
assert expected == cells
|
|
30
|
-
|
|
31
|
-
def test_directed_inward(self):
|
|
32
|
-
"""Tests that reversing the graph gives the "inward" Voronoi
|
|
33
|
-
partition.
|
|
34
|
-
|
|
35
|
-
"""
|
|
36
|
-
# This is the singly-linked reverse directed cycle graph on six nodes.
|
|
37
|
-
G = nx.DiGraph(pairwise(range(6), cyclic=True))
|
|
38
|
-
G = G.reverse(copy=False)
|
|
39
|
-
cells = nx.voronoi_cells(G, {0, 3})
|
|
40
|
-
expected = {0: {0, 4, 5}, 3: {1, 2, 3}}
|
|
41
|
-
assert expected == cells
|
|
42
|
-
|
|
43
|
-
def test_undirected_weighted(self):
|
|
44
|
-
edges = [(0, 1, 10), (1, 2, 1), (2, 3, 1)]
|
|
45
|
-
G = nx.Graph()
|
|
46
|
-
G.add_weighted_edges_from(edges)
|
|
47
|
-
cells = nx.voronoi_cells(G, {0, 3})
|
|
48
|
-
expected = {0: {0}, 3: {1, 2, 3}}
|
|
49
|
-
assert expected == cells
|
|
50
|
-
|
|
51
|
-
def test_directed_weighted(self):
|
|
52
|
-
edges = [(0, 1, 10), (1, 2, 1), (2, 3, 1), (3, 2, 1), (2, 1, 1)]
|
|
53
|
-
G = nx.DiGraph()
|
|
54
|
-
G.add_weighted_edges_from(edges)
|
|
55
|
-
cells = nx.voronoi_cells(G, {0, 3})
|
|
56
|
-
expected = {0: {0}, 3: {1, 2, 3}}
|
|
57
|
-
assert expected == cells
|
|
58
|
-
|
|
59
|
-
def test_multigraph_unweighted(self):
|
|
60
|
-
"""Tests that the Voronoi cells for a multigraph are the same as
|
|
61
|
-
for a simple graph.
|
|
62
|
-
|
|
63
|
-
"""
|
|
64
|
-
edges = [(0, 1), (1, 2), (2, 3)]
|
|
65
|
-
G = nx.MultiGraph(2 * edges)
|
|
66
|
-
H = nx.Graph(G)
|
|
67
|
-
G_cells = nx.voronoi_cells(G, {0, 3})
|
|
68
|
-
H_cells = nx.voronoi_cells(H, {0, 3})
|
|
69
|
-
assert G_cells == H_cells
|
|
70
|
-
|
|
71
|
-
def test_multidigraph_unweighted(self):
|
|
72
|
-
# This is the twice-singly-linked directed cycle graph on six nodes.
|
|
73
|
-
edges = list(pairwise(range(6), cyclic=True))
|
|
74
|
-
G = nx.MultiDiGraph(2 * edges)
|
|
75
|
-
H = nx.DiGraph(G)
|
|
76
|
-
G_cells = nx.voronoi_cells(G, {0, 3})
|
|
77
|
-
H_cells = nx.voronoi_cells(H, {0, 3})
|
|
78
|
-
assert G_cells == H_cells
|
|
79
|
-
|
|
80
|
-
def test_multigraph_weighted(self):
|
|
81
|
-
edges = [(0, 1, 10), (0, 1, 10), (1, 2, 1), (1, 2, 100), (2, 3, 1), (2, 3, 100)]
|
|
82
|
-
G = nx.MultiGraph()
|
|
83
|
-
G.add_weighted_edges_from(edges)
|
|
84
|
-
cells = nx.voronoi_cells(G, {0, 3})
|
|
85
|
-
expected = {0: {0}, 3: {1, 2, 3}}
|
|
86
|
-
assert expected == cells
|
|
87
|
-
|
|
88
|
-
def test_multidigraph_weighted(self):
|
|
89
|
-
edges = [
|
|
90
|
-
(0, 1, 10),
|
|
91
|
-
(0, 1, 10),
|
|
92
|
-
(1, 2, 1),
|
|
93
|
-
(2, 3, 1),
|
|
94
|
-
(3, 2, 10),
|
|
95
|
-
(3, 2, 1),
|
|
96
|
-
(2, 1, 10),
|
|
97
|
-
(2, 1, 1),
|
|
98
|
-
]
|
|
99
|
-
G = nx.MultiDiGraph()
|
|
100
|
-
G.add_weighted_edges_from(edges)
|
|
101
|
-
cells = nx.voronoi_cells(G, {0, 3})
|
|
102
|
-
expected = {0: {0}, 3: {1, 2, 3}}
|
|
103
|
-
assert expected == cells
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"""Unit tests for the :mod:`networkx.algorithms.walks` module."""
|
|
2
|
-
|
|
3
|
-
import pytest
|
|
4
|
-
|
|
5
|
-
import networkx as nx
|
|
6
|
-
|
|
7
|
-
pytest.importorskip("numpy")
|
|
8
|
-
pytest.importorskip("scipy")
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def test_directed():
|
|
12
|
-
G = nx.DiGraph([(0, 1), (1, 2), (2, 0)])
|
|
13
|
-
num_walks = nx.number_of_walks(G, 3)
|
|
14
|
-
expected = {0: {0: 1, 1: 0, 2: 0}, 1: {0: 0, 1: 1, 2: 0}, 2: {0: 0, 1: 0, 2: 1}}
|
|
15
|
-
assert num_walks == expected
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def test_undirected():
|
|
19
|
-
G = nx.cycle_graph(3)
|
|
20
|
-
num_walks = nx.number_of_walks(G, 3)
|
|
21
|
-
expected = {0: {0: 2, 1: 3, 2: 3}, 1: {0: 3, 1: 2, 2: 3}, 2: {0: 3, 1: 3, 2: 2}}
|
|
22
|
-
assert num_walks == expected
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def test_non_integer_nodes():
|
|
26
|
-
G = nx.DiGraph([("A", "B"), ("B", "C"), ("C", "A")])
|
|
27
|
-
num_walks = nx.number_of_walks(G, 2)
|
|
28
|
-
expected = {
|
|
29
|
-
"A": {"A": 0, "B": 0, "C": 1},
|
|
30
|
-
"B": {"A": 1, "B": 0, "C": 0},
|
|
31
|
-
"C": {"A": 0, "B": 1, "C": 0},
|
|
32
|
-
}
|
|
33
|
-
assert num_walks == expected
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def test_zero_length():
|
|
37
|
-
G = nx.cycle_graph(3)
|
|
38
|
-
num_walks = nx.number_of_walks(G, 0)
|
|
39
|
-
expected = {0: {0: 1, 1: 0, 2: 0}, 1: {0: 0, 1: 1, 2: 0}, 2: {0: 0, 1: 0, 2: 1}}
|
|
40
|
-
assert num_walks == expected
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def test_negative_length_exception():
|
|
44
|
-
G = nx.cycle_graph(3)
|
|
45
|
-
with pytest.raises(ValueError):
|
|
46
|
-
nx.number_of_walks(G, -1)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def test_hidden_weight_attr():
|
|
50
|
-
G = nx.cycle_graph(3)
|
|
51
|
-
G.add_edge(1, 2, weight=5)
|
|
52
|
-
num_walks = nx.number_of_walks(G, 3)
|
|
53
|
-
expected = {0: {0: 2, 1: 3, 2: 3}, 1: {0: 3, 1: 2, 2: 3}, 2: {0: 3, 1: 3, 2: 2}}
|
|
54
|
-
assert num_walks == expected
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import networkx as nx
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def test_wiener_index_of_disconnected_graph():
|
|
5
|
-
assert nx.wiener_index(nx.empty_graph(2)) == float("inf")
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def test_wiener_index_of_directed_graph():
|
|
9
|
-
G = nx.complete_graph(3)
|
|
10
|
-
H = nx.DiGraph(G)
|
|
11
|
-
assert (2 * nx.wiener_index(G)) == nx.wiener_index(H)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def test_wiener_index_of_complete_graph():
|
|
15
|
-
n = 10
|
|
16
|
-
G = nx.complete_graph(n)
|
|
17
|
-
assert nx.wiener_index(G) == (n * (n - 1) / 2)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def test_wiener_index_of_path_graph():
|
|
21
|
-
# In P_n, there are n - 1 pairs of vertices at distance one, n -
|
|
22
|
-
# 2 pairs at distance two, n - 3 at distance three, ..., 1 at
|
|
23
|
-
# distance n - 1, so the Wiener index should be
|
|
24
|
-
#
|
|
25
|
-
# 1 * (n - 1) + 2 * (n - 2) + ... + (n - 2) * 2 + (n - 1) * 1
|
|
26
|
-
#
|
|
27
|
-
# For example, in P_5,
|
|
28
|
-
#
|
|
29
|
-
# 1 * 4 + 2 * 3 + 3 * 2 + 4 * 1 = 2 (1 * 4 + 2 * 3)
|
|
30
|
-
#
|
|
31
|
-
# and in P_6,
|
|
32
|
-
#
|
|
33
|
-
# 1 * 5 + 2 * 4 + 3 * 3 + 4 * 2 + 5 * 1 = 2 (1 * 5 + 2 * 4) + 3 * 3
|
|
34
|
-
#
|
|
35
|
-
# assuming n is *odd*, this gives the formula
|
|
36
|
-
#
|
|
37
|
-
# 2 \sum_{i = 1}^{(n - 1) / 2} [i * (n - i)]
|
|
38
|
-
#
|
|
39
|
-
# assuming n is *even*, this gives the formula
|
|
40
|
-
#
|
|
41
|
-
# 2 \sum_{i = 1}^{n / 2} [i * (n - i)] - (n / 2) ** 2
|
|
42
|
-
#
|
|
43
|
-
n = 9
|
|
44
|
-
G = nx.path_graph(n)
|
|
45
|
-
expected = 2 * sum(i * (n - i) for i in range(1, (n // 2) + 1))
|
|
46
|
-
actual = nx.wiener_index(G)
|
|
47
|
-
assert expected == actual
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def test_schultz_and_gutman_index_of_disconnected_graph():
|
|
51
|
-
n = 4
|
|
52
|
-
G = nx.Graph()
|
|
53
|
-
G.add_nodes_from(list(range(1, n + 1)))
|
|
54
|
-
expected = float("inf")
|
|
55
|
-
|
|
56
|
-
G.add_edge(1, 2)
|
|
57
|
-
G.add_edge(3, 4)
|
|
58
|
-
|
|
59
|
-
actual_1 = nx.schultz_index(G)
|
|
60
|
-
actual_2 = nx.gutman_index(G)
|
|
61
|
-
|
|
62
|
-
assert expected == actual_1
|
|
63
|
-
assert expected == actual_2
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
def test_schultz_and_gutman_index_of_complete_bipartite_graph_1():
|
|
67
|
-
n = 3
|
|
68
|
-
m = 3
|
|
69
|
-
cbg = nx.complete_bipartite_graph(n, m)
|
|
70
|
-
|
|
71
|
-
expected_1 = n * m * (n + m) + 2 * n * (n - 1) * m + 2 * m * (m - 1) * n
|
|
72
|
-
actual_1 = nx.schultz_index(cbg)
|
|
73
|
-
|
|
74
|
-
expected_2 = n * m * (n * m) + n * (n - 1) * m * m + m * (m - 1) * n * n
|
|
75
|
-
actual_2 = nx.gutman_index(cbg)
|
|
76
|
-
|
|
77
|
-
assert expected_1 == actual_1
|
|
78
|
-
assert expected_2 == actual_2
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
def test_schultz_and_gutman_index_of_complete_bipartite_graph_2():
|
|
82
|
-
n = 2
|
|
83
|
-
m = 5
|
|
84
|
-
cbg = nx.complete_bipartite_graph(n, m)
|
|
85
|
-
|
|
86
|
-
expected_1 = n * m * (n + m) + 2 * n * (n - 1) * m + 2 * m * (m - 1) * n
|
|
87
|
-
actual_1 = nx.schultz_index(cbg)
|
|
88
|
-
|
|
89
|
-
expected_2 = n * m * (n * m) + n * (n - 1) * m * m + m * (m - 1) * n * n
|
|
90
|
-
actual_2 = nx.gutman_index(cbg)
|
|
91
|
-
|
|
92
|
-
assert expected_1 == actual_1
|
|
93
|
-
assert expected_2 == actual_2
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
def test_schultz_and_gutman_index_of_complete_graph():
|
|
97
|
-
n = 5
|
|
98
|
-
cg = nx.complete_graph(n)
|
|
99
|
-
|
|
100
|
-
expected_1 = n * (n - 1) * (n - 1)
|
|
101
|
-
actual_1 = nx.schultz_index(cg)
|
|
102
|
-
|
|
103
|
-
assert expected_1 == actual_1
|
|
104
|
-
|
|
105
|
-
expected_2 = n * (n - 1) * (n - 1) * (n - 1) / 2
|
|
106
|
-
actual_2 = nx.gutman_index(cg)
|
|
107
|
-
|
|
108
|
-
assert expected_2 == actual_2
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
def test_schultz_and_gutman_index_of_odd_cycle_graph():
|
|
112
|
-
k = 5
|
|
113
|
-
n = 2 * k + 1
|
|
114
|
-
ocg = nx.cycle_graph(n)
|
|
115
|
-
|
|
116
|
-
expected_1 = 2 * n * k * (k + 1)
|
|
117
|
-
actual_1 = nx.schultz_index(ocg)
|
|
118
|
-
|
|
119
|
-
expected_2 = 2 * n * k * (k + 1)
|
|
120
|
-
actual_2 = nx.gutman_index(ocg)
|
|
121
|
-
|
|
122
|
-
assert expected_1 == actual_1
|
|
123
|
-
assert expected_2 == actual_2
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
def test_hyper_wiener_of_complete_graph():
|
|
127
|
-
# In a complete graph K_n, the distance is always 1.
|
|
128
|
-
# For K_n, this term is always (1 + 1^2) = 2.
|
|
129
|
-
#
|
|
130
|
-
# The number of ordered pairs is n * (n - 1).
|
|
131
|
-
# The total sum before division is (n * (n - 1)) * 2.
|
|
132
|
-
# The final result is therefore ((n * (n - 1)) * 2) / 2, which
|
|
133
|
-
# simplifies to n * (n - 1).
|
|
134
|
-
n = 5
|
|
135
|
-
G = nx.complete_graph(n)
|
|
136
|
-
assert nx.hyper_wiener_index(G) == n * (n - 1)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
def test_hyper_wiener_of_path_graph():
|
|
140
|
-
G = nx.path_graph(4)
|
|
141
|
-
assert nx.hyper_wiener_index(G) == 30.0
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
def test_hyper_wiener_of_cycle_graph():
|
|
145
|
-
G = nx.cycle_graph(4)
|
|
146
|
-
assert nx.hyper_wiener_index(G) == 20.0
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
def test_hyper_wiener_of_disconnected_graph():
|
|
150
|
-
G = nx.Graph([(0, 1), (2, 3)])
|
|
151
|
-
assert nx.hyper_wiener_index(G) == float("inf")
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
def test_hyper_wiener_of_weighted_graph():
|
|
155
|
-
G = nx.path_graph(3)
|
|
156
|
-
G.edges[0, 1]["weight"] = 2
|
|
157
|
-
assert nx.hyper_wiener_index(G, weight="weight") == 20.0
|
|
File without changes
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"""Unit tests for the beam search functions."""
|
|
2
|
-
|
|
3
|
-
import pytest
|
|
4
|
-
|
|
5
|
-
import networkx as nx
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def test_narrow():
|
|
9
|
-
"""Tests that a narrow beam width may cause an incomplete search."""
|
|
10
|
-
# In this search, we enqueue only the neighbor 3 at the first
|
|
11
|
-
# step, then only the neighbor 2 at the second step. Once at
|
|
12
|
-
# node 2, the search chooses node 3, since it has a higher value
|
|
13
|
-
# than node 1, but node 3 has already been visited, so the
|
|
14
|
-
# search terminates.
|
|
15
|
-
G = nx.cycle_graph(4)
|
|
16
|
-
edges = nx.bfs_beam_edges(G, source=0, value=lambda n: n, width=1)
|
|
17
|
-
assert list(edges) == [(0, 3), (3, 2)]
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@pytest.mark.parametrize("width", (2, None))
|
|
21
|
-
def test_wide(width):
|
|
22
|
-
"""All nodes are searched when `width` is None or >= max degree"""
|
|
23
|
-
G = nx.cycle_graph(4)
|
|
24
|
-
edges = nx.bfs_beam_edges(G, source=0, value=lambda n: n, width=width)
|
|
25
|
-
assert list(edges) == [(0, 3), (0, 1), (3, 2)]
|