okstra 0.114.0 → 0.115.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/lead/okstra-lead-contract.md +1 -1
- package/runtime/python/okstra_ctl/implementation_stage.py +46 -39
- package/runtime/python/okstra_ctl/report_views.py +151 -12
- package/runtime/python/okstra_ctl/run.py +24 -24
- 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 +20 -0
- package/runtime/templates/reports/final-report.template.md +14 -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/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,354 +0,0 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
|
|
3
|
-
import networkx as nx
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class TestSubsetBetweennessCentrality:
|
|
7
|
-
def test_K5(self):
|
|
8
|
-
"""Betweenness Centrality Subset: K5"""
|
|
9
|
-
G = nx.complete_graph(5)
|
|
10
|
-
b = nx.betweenness_centrality_subset(
|
|
11
|
-
G, sources=[0], targets=[1, 3], weight=None
|
|
12
|
-
)
|
|
13
|
-
b_answer = {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0}
|
|
14
|
-
for n in sorted(G):
|
|
15
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
16
|
-
|
|
17
|
-
def test_P5_directed(self):
|
|
18
|
-
"""Betweenness Centrality Subset: P5 directed"""
|
|
19
|
-
G = nx.DiGraph()
|
|
20
|
-
nx.add_path(G, range(5))
|
|
21
|
-
b_answer = {0: 0, 1: 1, 2: 1, 3: 0, 4: 0, 5: 0}
|
|
22
|
-
b = nx.betweenness_centrality_subset(G, sources=[0], targets=[3], weight=None)
|
|
23
|
-
for n in sorted(G):
|
|
24
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
25
|
-
|
|
26
|
-
def test_P5(self):
|
|
27
|
-
"""Betweenness Centrality Subset: P5"""
|
|
28
|
-
G = nx.Graph()
|
|
29
|
-
nx.add_path(G, range(5))
|
|
30
|
-
b_answer = {0: 0, 1: 0.5, 2: 0.5, 3: 0, 4: 0, 5: 0}
|
|
31
|
-
b = nx.betweenness_centrality_subset(G, sources=[0], targets=[3], weight=None)
|
|
32
|
-
for n in sorted(G):
|
|
33
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
34
|
-
|
|
35
|
-
def test_P5_multiple_target(self):
|
|
36
|
-
"""Betweenness Centrality Subset: P5 multiple target"""
|
|
37
|
-
G = nx.Graph()
|
|
38
|
-
nx.add_path(G, range(5))
|
|
39
|
-
b_answer = {0: 0, 1: 1, 2: 1, 3: 0.5, 4: 0, 5: 0}
|
|
40
|
-
b = nx.betweenness_centrality_subset(
|
|
41
|
-
G, sources=[0], targets=[3, 4], weight=None
|
|
42
|
-
)
|
|
43
|
-
for n in sorted(G):
|
|
44
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
45
|
-
|
|
46
|
-
def test_box(self):
|
|
47
|
-
"""Betweenness Centrality Subset: box"""
|
|
48
|
-
G = nx.Graph()
|
|
49
|
-
G.add_edges_from([(0, 1), (0, 2), (1, 3), (2, 3)])
|
|
50
|
-
b_answer = {0: 0, 1: 0.25, 2: 0.25, 3: 0}
|
|
51
|
-
b = nx.betweenness_centrality_subset(G, sources=[0], targets=[3], weight=None)
|
|
52
|
-
for n in sorted(G):
|
|
53
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
54
|
-
|
|
55
|
-
def test_box_and_path(self):
|
|
56
|
-
"""Betweenness Centrality Subset: box and path"""
|
|
57
|
-
G = nx.Graph()
|
|
58
|
-
G.add_edges_from([(0, 1), (0, 2), (1, 3), (2, 3), (3, 4), (4, 5)])
|
|
59
|
-
b_answer = {0: 0, 1: 0.5, 2: 0.5, 3: 0.5, 4: 0, 5: 0}
|
|
60
|
-
b = nx.betweenness_centrality_subset(
|
|
61
|
-
G, sources=[0], targets=[3, 4], weight=None
|
|
62
|
-
)
|
|
63
|
-
for n in sorted(G):
|
|
64
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
65
|
-
|
|
66
|
-
def test_box_and_path2(self):
|
|
67
|
-
"""Betweenness Centrality Subset: box and path multiple target"""
|
|
68
|
-
G = nx.Graph()
|
|
69
|
-
G.add_edges_from([(0, 1), (1, 2), (2, 3), (1, 20), (20, 3), (3, 4)])
|
|
70
|
-
b_answer = {0: 0, 1: 1.0, 2: 0.5, 20: 0.5, 3: 0.5, 4: 0}
|
|
71
|
-
b = nx.betweenness_centrality_subset(
|
|
72
|
-
G, sources=[0], targets=[3, 4], weight=None
|
|
73
|
-
)
|
|
74
|
-
for n in sorted(G):
|
|
75
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
76
|
-
|
|
77
|
-
def test_diamond_multi_path(self):
|
|
78
|
-
"""Betweenness Centrality Subset: Diamond Multi Path"""
|
|
79
|
-
G = nx.Graph()
|
|
80
|
-
G.add_edges_from(
|
|
81
|
-
[
|
|
82
|
-
(1, 2),
|
|
83
|
-
(1, 3),
|
|
84
|
-
(1, 4),
|
|
85
|
-
(1, 5),
|
|
86
|
-
(1, 10),
|
|
87
|
-
(10, 11),
|
|
88
|
-
(11, 12),
|
|
89
|
-
(12, 9),
|
|
90
|
-
(2, 6),
|
|
91
|
-
(3, 6),
|
|
92
|
-
(4, 6),
|
|
93
|
-
(5, 7),
|
|
94
|
-
(7, 8),
|
|
95
|
-
(6, 8),
|
|
96
|
-
(8, 9),
|
|
97
|
-
]
|
|
98
|
-
)
|
|
99
|
-
b = nx.betweenness_centrality_subset(G, sources=[1], targets=[9], weight=None)
|
|
100
|
-
|
|
101
|
-
expected_b = {
|
|
102
|
-
1: 0,
|
|
103
|
-
2: 1.0 / 10,
|
|
104
|
-
3: 1.0 / 10,
|
|
105
|
-
4: 1.0 / 10,
|
|
106
|
-
5: 1.0 / 10,
|
|
107
|
-
6: 3.0 / 10,
|
|
108
|
-
7: 1.0 / 10,
|
|
109
|
-
8: 4.0 / 10,
|
|
110
|
-
9: 0,
|
|
111
|
-
10: 1.0 / 10,
|
|
112
|
-
11: 1.0 / 10,
|
|
113
|
-
12: 1.0 / 10,
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
for n in sorted(G):
|
|
117
|
-
assert b[n] == pytest.approx(expected_b[n], abs=1e-7)
|
|
118
|
-
|
|
119
|
-
def test_normalized_p2(self):
|
|
120
|
-
"""
|
|
121
|
-
Betweenness Centrality Subset: Normalized P2
|
|
122
|
-
if n <= 2: no normalization, betweenness centrality should be 0 for all nodes.
|
|
123
|
-
"""
|
|
124
|
-
G = nx.Graph()
|
|
125
|
-
nx.add_path(G, range(2))
|
|
126
|
-
b_answer = {0: 0, 1: 0.0}
|
|
127
|
-
b = nx.betweenness_centrality_subset(
|
|
128
|
-
G, sources=[0], targets=[1], normalized=True, weight=None
|
|
129
|
-
)
|
|
130
|
-
for n in sorted(G):
|
|
131
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
132
|
-
|
|
133
|
-
def test_normalized_P5_directed(self):
|
|
134
|
-
"""Betweenness Centrality Subset: Normalized Directed P5"""
|
|
135
|
-
G = nx.DiGraph()
|
|
136
|
-
nx.add_path(G, range(5))
|
|
137
|
-
b_answer = {0: 0, 1: 1.0 / 12.0, 2: 1.0 / 12.0, 3: 0, 4: 0, 5: 0}
|
|
138
|
-
b = nx.betweenness_centrality_subset(
|
|
139
|
-
G, sources=[0], targets=[3], normalized=True, weight=None
|
|
140
|
-
)
|
|
141
|
-
for n in sorted(G):
|
|
142
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
143
|
-
|
|
144
|
-
def test_weighted_graph(self):
|
|
145
|
-
"""Betweenness Centrality Subset: Weighted Graph"""
|
|
146
|
-
G = nx.DiGraph()
|
|
147
|
-
G.add_edge(0, 1, weight=3)
|
|
148
|
-
G.add_edge(0, 2, weight=2)
|
|
149
|
-
G.add_edge(0, 3, weight=6)
|
|
150
|
-
G.add_edge(0, 4, weight=4)
|
|
151
|
-
G.add_edge(1, 3, weight=5)
|
|
152
|
-
G.add_edge(1, 5, weight=5)
|
|
153
|
-
G.add_edge(2, 4, weight=1)
|
|
154
|
-
G.add_edge(3, 4, weight=2)
|
|
155
|
-
G.add_edge(3, 5, weight=1)
|
|
156
|
-
G.add_edge(4, 5, weight=4)
|
|
157
|
-
b_answer = {0: 0.0, 1: 0.0, 2: 0.5, 3: 0.5, 4: 0.5, 5: 0.0}
|
|
158
|
-
b = nx.betweenness_centrality_subset(
|
|
159
|
-
G, sources=[0], targets=[5], normalized=False, weight="weight"
|
|
160
|
-
)
|
|
161
|
-
for n in sorted(G):
|
|
162
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
class TestEdgeSubsetBetweennessCentrality:
|
|
166
|
-
def test_K5(self):
|
|
167
|
-
"""Edge betweenness subset centrality: K5"""
|
|
168
|
-
G = nx.complete_graph(5)
|
|
169
|
-
b = nx.edge_betweenness_centrality_subset(
|
|
170
|
-
G, sources=[0], targets=[1, 3], weight=None
|
|
171
|
-
)
|
|
172
|
-
b_answer = dict.fromkeys(G.edges(), 0)
|
|
173
|
-
b_answer[(0, 3)] = b_answer[(0, 1)] = 0.5
|
|
174
|
-
for n in sorted(G.edges()):
|
|
175
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
176
|
-
|
|
177
|
-
def test_P5_directed(self):
|
|
178
|
-
"""Edge betweenness subset centrality: P5 directed"""
|
|
179
|
-
G = nx.DiGraph()
|
|
180
|
-
nx.add_path(G, range(5))
|
|
181
|
-
b_answer = dict.fromkeys(G.edges(), 0)
|
|
182
|
-
b_answer[(0, 1)] = b_answer[(1, 2)] = b_answer[(2, 3)] = 1
|
|
183
|
-
b = nx.edge_betweenness_centrality_subset(
|
|
184
|
-
G, sources=[0], targets=[3], weight=None
|
|
185
|
-
)
|
|
186
|
-
for n in sorted(G.edges()):
|
|
187
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
188
|
-
|
|
189
|
-
def test_P5(self):
|
|
190
|
-
"""Edge betweenness subset centrality: P5"""
|
|
191
|
-
G = nx.Graph()
|
|
192
|
-
nx.add_path(G, range(5))
|
|
193
|
-
b_answer = dict.fromkeys(G.edges(), 0)
|
|
194
|
-
b_answer[(0, 1)] = b_answer[(1, 2)] = b_answer[(2, 3)] = 0.5
|
|
195
|
-
b = nx.edge_betweenness_centrality_subset(
|
|
196
|
-
G, sources=[0], targets=[3], weight=None
|
|
197
|
-
)
|
|
198
|
-
for n in sorted(G.edges()):
|
|
199
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
200
|
-
|
|
201
|
-
def test_P5_multiple_target(self):
|
|
202
|
-
"""Edge betweenness subset centrality: P5 multiple target"""
|
|
203
|
-
G = nx.Graph()
|
|
204
|
-
nx.add_path(G, range(5))
|
|
205
|
-
b_answer = dict.fromkeys(G.edges(), 0)
|
|
206
|
-
b_answer[(0, 1)] = b_answer[(1, 2)] = b_answer[(2, 3)] = 1
|
|
207
|
-
b_answer[(3, 4)] = 0.5
|
|
208
|
-
b = nx.edge_betweenness_centrality_subset(
|
|
209
|
-
G, sources=[0], targets=[3, 4], weight=None
|
|
210
|
-
)
|
|
211
|
-
for n in sorted(G.edges()):
|
|
212
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
213
|
-
|
|
214
|
-
def test_box(self):
|
|
215
|
-
"""Edge betweenness subset centrality: box"""
|
|
216
|
-
G = nx.Graph()
|
|
217
|
-
G.add_edges_from([(0, 1), (0, 2), (1, 3), (2, 3)])
|
|
218
|
-
b_answer = dict.fromkeys(G.edges(), 0)
|
|
219
|
-
b_answer[(0, 1)] = b_answer[(0, 2)] = 0.25
|
|
220
|
-
b_answer[(1, 3)] = b_answer[(2, 3)] = 0.25
|
|
221
|
-
b = nx.edge_betweenness_centrality_subset(
|
|
222
|
-
G, sources=[0], targets=[3], weight=None
|
|
223
|
-
)
|
|
224
|
-
for n in sorted(G.edges()):
|
|
225
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
226
|
-
|
|
227
|
-
def test_box_and_path(self):
|
|
228
|
-
"""Edge betweenness subset centrality: box and path"""
|
|
229
|
-
G = nx.Graph()
|
|
230
|
-
G.add_edges_from([(0, 1), (0, 2), (1, 3), (2, 3), (3, 4), (4, 5)])
|
|
231
|
-
b_answer = dict.fromkeys(G.edges(), 0)
|
|
232
|
-
b_answer[(0, 1)] = b_answer[(0, 2)] = 0.5
|
|
233
|
-
b_answer[(1, 3)] = b_answer[(2, 3)] = 0.5
|
|
234
|
-
b_answer[(3, 4)] = 0.5
|
|
235
|
-
b = nx.edge_betweenness_centrality_subset(
|
|
236
|
-
G, sources=[0], targets=[3, 4], weight=None
|
|
237
|
-
)
|
|
238
|
-
for n in sorted(G.edges()):
|
|
239
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
240
|
-
|
|
241
|
-
def test_box_and_path2(self):
|
|
242
|
-
"""Edge betweenness subset centrality: box and path multiple target"""
|
|
243
|
-
G = nx.Graph()
|
|
244
|
-
G.add_edges_from([(0, 1), (1, 2), (2, 3), (1, 20), (20, 3), (3, 4)])
|
|
245
|
-
b_answer = dict.fromkeys(G.edges(), 0)
|
|
246
|
-
b_answer[(0, 1)] = 1.0
|
|
247
|
-
b_answer[(1, 20)] = b_answer[(3, 20)] = 0.5
|
|
248
|
-
b_answer[(1, 2)] = b_answer[(2, 3)] = 0.5
|
|
249
|
-
b_answer[(3, 4)] = 0.5
|
|
250
|
-
b = nx.edge_betweenness_centrality_subset(
|
|
251
|
-
G, sources=[0], targets=[3, 4], weight=None
|
|
252
|
-
)
|
|
253
|
-
for n in sorted(G.edges()):
|
|
254
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
255
|
-
|
|
256
|
-
def test_diamond_multi_path(self):
|
|
257
|
-
"""Edge betweenness subset centrality: Diamond Multi Path"""
|
|
258
|
-
G = nx.Graph()
|
|
259
|
-
G.add_edges_from(
|
|
260
|
-
[
|
|
261
|
-
(1, 2),
|
|
262
|
-
(1, 3),
|
|
263
|
-
(1, 4),
|
|
264
|
-
(1, 5),
|
|
265
|
-
(1, 10),
|
|
266
|
-
(10, 11),
|
|
267
|
-
(11, 12),
|
|
268
|
-
(12, 9),
|
|
269
|
-
(2, 6),
|
|
270
|
-
(3, 6),
|
|
271
|
-
(4, 6),
|
|
272
|
-
(5, 7),
|
|
273
|
-
(7, 8),
|
|
274
|
-
(6, 8),
|
|
275
|
-
(8, 9),
|
|
276
|
-
]
|
|
277
|
-
)
|
|
278
|
-
b_answer = dict.fromkeys(G.edges(), 0)
|
|
279
|
-
b_answer[(8, 9)] = 0.4
|
|
280
|
-
b_answer[(6, 8)] = b_answer[(7, 8)] = 0.2
|
|
281
|
-
b_answer[(2, 6)] = b_answer[(3, 6)] = b_answer[(4, 6)] = 0.2 / 3.0
|
|
282
|
-
b_answer[(1, 2)] = b_answer[(1, 3)] = b_answer[(1, 4)] = 0.2 / 3.0
|
|
283
|
-
b_answer[(5, 7)] = 0.2
|
|
284
|
-
b_answer[(1, 5)] = 0.2
|
|
285
|
-
b_answer[(9, 12)] = 0.1
|
|
286
|
-
b_answer[(11, 12)] = b_answer[(10, 11)] = b_answer[(1, 10)] = 0.1
|
|
287
|
-
b = nx.edge_betweenness_centrality_subset(
|
|
288
|
-
G, sources=[1], targets=[9], weight=None
|
|
289
|
-
)
|
|
290
|
-
for n in G.edges():
|
|
291
|
-
sort_n = tuple(sorted(n))
|
|
292
|
-
assert b[n] == pytest.approx(b_answer[sort_n], abs=1e-7)
|
|
293
|
-
|
|
294
|
-
def test_normalized_p1(self):
|
|
295
|
-
"""
|
|
296
|
-
Edge betweenness subset centrality: P1
|
|
297
|
-
if n <= 1: no normalization b=0 for all nodes
|
|
298
|
-
"""
|
|
299
|
-
G = nx.Graph()
|
|
300
|
-
nx.add_path(G, range(1))
|
|
301
|
-
b_answer = dict.fromkeys(G.edges(), 0)
|
|
302
|
-
b = nx.edge_betweenness_centrality_subset(
|
|
303
|
-
G, sources=[0], targets=[0], normalized=True, weight=None
|
|
304
|
-
)
|
|
305
|
-
for n in G.edges():
|
|
306
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
307
|
-
|
|
308
|
-
def test_normalized_P5_directed(self):
|
|
309
|
-
"""Edge betweenness subset centrality: Normalized Directed P5"""
|
|
310
|
-
G = nx.DiGraph()
|
|
311
|
-
nx.add_path(G, range(5))
|
|
312
|
-
b_answer = dict.fromkeys(G.edges(), 0)
|
|
313
|
-
b_answer[(0, 1)] = b_answer[(1, 2)] = b_answer[(2, 3)] = 0.05
|
|
314
|
-
b = nx.edge_betweenness_centrality_subset(
|
|
315
|
-
G, sources=[0], targets=[3], normalized=True, weight=None
|
|
316
|
-
)
|
|
317
|
-
for n in G.edges():
|
|
318
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
319
|
-
|
|
320
|
-
def test_weighted_graph(self):
|
|
321
|
-
"""Edge betweenness subset centrality: Weighted Graph"""
|
|
322
|
-
G = nx.DiGraph()
|
|
323
|
-
G.add_edge(0, 1, weight=3)
|
|
324
|
-
G.add_edge(0, 2, weight=2)
|
|
325
|
-
G.add_edge(0, 3, weight=6)
|
|
326
|
-
G.add_edge(0, 4, weight=4)
|
|
327
|
-
G.add_edge(1, 3, weight=5)
|
|
328
|
-
G.add_edge(1, 5, weight=5)
|
|
329
|
-
G.add_edge(2, 4, weight=1)
|
|
330
|
-
G.add_edge(3, 4, weight=2)
|
|
331
|
-
G.add_edge(3, 5, weight=1)
|
|
332
|
-
G.add_edge(4, 5, weight=4)
|
|
333
|
-
b_answer = dict.fromkeys(G.edges(), 0)
|
|
334
|
-
b_answer[(0, 2)] = b_answer[(2, 4)] = b_answer[(4, 5)] = 0.5
|
|
335
|
-
b_answer[(0, 3)] = b_answer[(3, 5)] = 0.5
|
|
336
|
-
b = nx.edge_betweenness_centrality_subset(
|
|
337
|
-
G, sources=[0], targets=[5], normalized=False, weight="weight"
|
|
338
|
-
)
|
|
339
|
-
for n in G.edges():
|
|
340
|
-
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
def test_equivalence_non_subset():
|
|
344
|
-
"""Assert that subset betweenness centrality with all nodes in the
|
|
345
|
-
subset is equivalent to full betweenness centrality.
|
|
346
|
-
"""
|
|
347
|
-
G = nx.path_graph(10, create_using=nx.DiGraph)
|
|
348
|
-
|
|
349
|
-
assert nx.betweenness_centrality(G) == nx.betweenness_centrality_subset(
|
|
350
|
-
G, sources=G.nodes(), targets=G.nodes(), normalized=True
|
|
351
|
-
)
|
|
352
|
-
assert nx.edge_betweenness_centrality(G) == nx.edge_betweenness_centrality_subset(
|
|
353
|
-
G, sources=G.nodes(), targets=G.nodes(), normalized=True
|
|
354
|
-
)
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Tests for closeness centrality.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
import pytest
|
|
6
|
-
|
|
7
|
-
import networkx as nx
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@pytest.fixture()
|
|
11
|
-
def undirected_G():
|
|
12
|
-
G = nx.fast_gnp_random_graph(n=100, p=0.6, seed=123)
|
|
13
|
-
cc = nx.closeness_centrality(G)
|
|
14
|
-
return G, cc
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class TestClosenessCentrality:
|
|
18
|
-
def test_wf_improved(self):
|
|
19
|
-
G = nx.union(nx.path_graph(4), nx.path_graph([4, 5, 6]))
|
|
20
|
-
c = nx.closeness_centrality(G)
|
|
21
|
-
cwf = nx.closeness_centrality(G, wf_improved=False)
|
|
22
|
-
res = {0: 0.25, 1: 0.375, 2: 0.375, 3: 0.25, 4: 0.222, 5: 0.333, 6: 0.222}
|
|
23
|
-
wf_res = {0: 0.5, 1: 0.75, 2: 0.75, 3: 0.5, 4: 0.667, 5: 1.0, 6: 0.667}
|
|
24
|
-
for n in G:
|
|
25
|
-
assert c[n] == pytest.approx(res[n], abs=1e-3)
|
|
26
|
-
assert cwf[n] == pytest.approx(wf_res[n], abs=1e-3)
|
|
27
|
-
|
|
28
|
-
def test_digraph(self):
|
|
29
|
-
G = nx.path_graph(3, create_using=nx.DiGraph)
|
|
30
|
-
c = nx.closeness_centrality(G)
|
|
31
|
-
cr = nx.closeness_centrality(G.reverse())
|
|
32
|
-
d = {0: 0.0, 1: 0.500, 2: 0.667}
|
|
33
|
-
dr = {0: 0.667, 1: 0.500, 2: 0.0}
|
|
34
|
-
for n in G:
|
|
35
|
-
assert c[n] == pytest.approx(d[n], abs=1e-3)
|
|
36
|
-
assert cr[n] == pytest.approx(dr[n], abs=1e-3)
|
|
37
|
-
|
|
38
|
-
def test_k5_closeness(self):
|
|
39
|
-
G = nx.complete_graph(5)
|
|
40
|
-
c = nx.closeness_centrality(G)
|
|
41
|
-
d = {0: 1.000, 1: 1.000, 2: 1.000, 3: 1.000, 4: 1.000}
|
|
42
|
-
for n in G:
|
|
43
|
-
assert c[n] == pytest.approx(d[n], abs=1e-3)
|
|
44
|
-
|
|
45
|
-
def test_p3_closeness(self):
|
|
46
|
-
G = nx.path_graph(3)
|
|
47
|
-
c = nx.closeness_centrality(G)
|
|
48
|
-
d = {0: 0.667, 1: 1.000, 2: 0.667}
|
|
49
|
-
for n in G:
|
|
50
|
-
assert c[n] == pytest.approx(d[n], abs=1e-3)
|
|
51
|
-
|
|
52
|
-
def test_krackhardt_closeness(self):
|
|
53
|
-
G = nx.krackhardt_kite_graph()
|
|
54
|
-
c = nx.closeness_centrality(G)
|
|
55
|
-
d = {
|
|
56
|
-
0: 0.529,
|
|
57
|
-
1: 0.529,
|
|
58
|
-
2: 0.500,
|
|
59
|
-
3: 0.600,
|
|
60
|
-
4: 0.500,
|
|
61
|
-
5: 0.643,
|
|
62
|
-
6: 0.643,
|
|
63
|
-
7: 0.600,
|
|
64
|
-
8: 0.429,
|
|
65
|
-
9: 0.310,
|
|
66
|
-
}
|
|
67
|
-
for n in G:
|
|
68
|
-
assert c[n] == pytest.approx(d[n], abs=1e-3)
|
|
69
|
-
|
|
70
|
-
def test_florentine_families_closeness(self):
|
|
71
|
-
G = nx.florentine_families_graph()
|
|
72
|
-
c = nx.closeness_centrality(G)
|
|
73
|
-
d = {
|
|
74
|
-
"Acciaiuoli": 0.368,
|
|
75
|
-
"Albizzi": 0.483,
|
|
76
|
-
"Barbadori": 0.4375,
|
|
77
|
-
"Bischeri": 0.400,
|
|
78
|
-
"Castellani": 0.389,
|
|
79
|
-
"Ginori": 0.333,
|
|
80
|
-
"Guadagni": 0.467,
|
|
81
|
-
"Lamberteschi": 0.326,
|
|
82
|
-
"Medici": 0.560,
|
|
83
|
-
"Pazzi": 0.286,
|
|
84
|
-
"Peruzzi": 0.368,
|
|
85
|
-
"Ridolfi": 0.500,
|
|
86
|
-
"Salviati": 0.389,
|
|
87
|
-
"Strozzi": 0.4375,
|
|
88
|
-
"Tornabuoni": 0.483,
|
|
89
|
-
}
|
|
90
|
-
for n in G:
|
|
91
|
-
assert c[n] == pytest.approx(d[n], abs=1e-3)
|
|
92
|
-
|
|
93
|
-
def test_les_miserables_closeness(self):
|
|
94
|
-
G = nx.les_miserables_graph()
|
|
95
|
-
c = nx.closeness_centrality(G)
|
|
96
|
-
d = {
|
|
97
|
-
"Napoleon": 0.302,
|
|
98
|
-
"Myriel": 0.429,
|
|
99
|
-
"MlleBaptistine": 0.413,
|
|
100
|
-
"MmeMagloire": 0.413,
|
|
101
|
-
"CountessDeLo": 0.302,
|
|
102
|
-
"Geborand": 0.302,
|
|
103
|
-
"Champtercier": 0.302,
|
|
104
|
-
"Cravatte": 0.302,
|
|
105
|
-
"Count": 0.302,
|
|
106
|
-
"OldMan": 0.302,
|
|
107
|
-
"Valjean": 0.644,
|
|
108
|
-
"Labarre": 0.394,
|
|
109
|
-
"Marguerite": 0.413,
|
|
110
|
-
"MmeDeR": 0.394,
|
|
111
|
-
"Isabeau": 0.394,
|
|
112
|
-
"Gervais": 0.394,
|
|
113
|
-
"Listolier": 0.341,
|
|
114
|
-
"Tholomyes": 0.392,
|
|
115
|
-
"Fameuil": 0.341,
|
|
116
|
-
"Blacheville": 0.341,
|
|
117
|
-
"Favourite": 0.341,
|
|
118
|
-
"Dahlia": 0.341,
|
|
119
|
-
"Zephine": 0.341,
|
|
120
|
-
"Fantine": 0.461,
|
|
121
|
-
"MmeThenardier": 0.461,
|
|
122
|
-
"Thenardier": 0.517,
|
|
123
|
-
"Cosette": 0.478,
|
|
124
|
-
"Javert": 0.517,
|
|
125
|
-
"Fauchelevent": 0.402,
|
|
126
|
-
"Bamatabois": 0.427,
|
|
127
|
-
"Perpetue": 0.318,
|
|
128
|
-
"Simplice": 0.418,
|
|
129
|
-
"Scaufflaire": 0.394,
|
|
130
|
-
"Woman1": 0.396,
|
|
131
|
-
"Judge": 0.404,
|
|
132
|
-
"Champmathieu": 0.404,
|
|
133
|
-
"Brevet": 0.404,
|
|
134
|
-
"Chenildieu": 0.404,
|
|
135
|
-
"Cochepaille": 0.404,
|
|
136
|
-
"Pontmercy": 0.373,
|
|
137
|
-
"Boulatruelle": 0.342,
|
|
138
|
-
"Eponine": 0.396,
|
|
139
|
-
"Anzelma": 0.352,
|
|
140
|
-
"Woman2": 0.402,
|
|
141
|
-
"MotherInnocent": 0.398,
|
|
142
|
-
"Gribier": 0.288,
|
|
143
|
-
"MmeBurgon": 0.344,
|
|
144
|
-
"Jondrette": 0.257,
|
|
145
|
-
"Gavroche": 0.514,
|
|
146
|
-
"Gillenormand": 0.442,
|
|
147
|
-
"Magnon": 0.335,
|
|
148
|
-
"MlleGillenormand": 0.442,
|
|
149
|
-
"MmePontmercy": 0.315,
|
|
150
|
-
"MlleVaubois": 0.308,
|
|
151
|
-
"LtGillenormand": 0.365,
|
|
152
|
-
"Marius": 0.531,
|
|
153
|
-
"BaronessT": 0.352,
|
|
154
|
-
"Mabeuf": 0.396,
|
|
155
|
-
"Enjolras": 0.481,
|
|
156
|
-
"Combeferre": 0.392,
|
|
157
|
-
"Prouvaire": 0.357,
|
|
158
|
-
"Feuilly": 0.392,
|
|
159
|
-
"Courfeyrac": 0.400,
|
|
160
|
-
"Bahorel": 0.394,
|
|
161
|
-
"Bossuet": 0.475,
|
|
162
|
-
"Joly": 0.394,
|
|
163
|
-
"Grantaire": 0.358,
|
|
164
|
-
"MotherPlutarch": 0.285,
|
|
165
|
-
"Gueulemer": 0.463,
|
|
166
|
-
"Babet": 0.463,
|
|
167
|
-
"Claquesous": 0.452,
|
|
168
|
-
"Montparnasse": 0.458,
|
|
169
|
-
"Toussaint": 0.402,
|
|
170
|
-
"Child1": 0.342,
|
|
171
|
-
"Child2": 0.342,
|
|
172
|
-
"Brujon": 0.380,
|
|
173
|
-
"MmeHucheloup": 0.353,
|
|
174
|
-
}
|
|
175
|
-
for n in G:
|
|
176
|
-
assert c[n] == pytest.approx(d[n], abs=1e-3)
|
|
177
|
-
|
|
178
|
-
def test_weighted_closeness(self):
|
|
179
|
-
edges = [
|
|
180
|
-
("s", "u", 10),
|
|
181
|
-
("s", "x", 5),
|
|
182
|
-
("u", "v", 1),
|
|
183
|
-
("u", "x", 2),
|
|
184
|
-
("v", "y", 1),
|
|
185
|
-
("x", "u", 3),
|
|
186
|
-
("x", "v", 5),
|
|
187
|
-
("x", "y", 2),
|
|
188
|
-
("y", "s", 7),
|
|
189
|
-
("y", "v", 6),
|
|
190
|
-
]
|
|
191
|
-
XG = nx.Graph()
|
|
192
|
-
XG.add_weighted_edges_from(edges)
|
|
193
|
-
c = nx.closeness_centrality(XG, distance="weight")
|
|
194
|
-
d = {"y": 0.200, "x": 0.286, "s": 0.138, "u": 0.235, "v": 0.200}
|
|
195
|
-
for n in sorted(XG):
|
|
196
|
-
assert c[n] == pytest.approx(d[n], abs=1e-3)
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
class TestIncrementalClosenessCentrality:
|
|
200
|
-
@staticmethod
|
|
201
|
-
def pick_add_edge(G):
|
|
202
|
-
u = nx.utils.arbitrary_element(G)
|
|
203
|
-
possible_nodes = set(G) - (set(G.neighbors(u)) | {u})
|
|
204
|
-
v = nx.utils.arbitrary_element(possible_nodes)
|
|
205
|
-
return (u, v)
|
|
206
|
-
|
|
207
|
-
@staticmethod
|
|
208
|
-
def pick_remove_edge(G):
|
|
209
|
-
u = nx.utils.arbitrary_element(G)
|
|
210
|
-
possible_nodes = list(G.neighbors(u))
|
|
211
|
-
v = nx.utils.arbitrary_element(possible_nodes)
|
|
212
|
-
return (u, v)
|
|
213
|
-
|
|
214
|
-
def test_directed_raises(self):
|
|
215
|
-
dir_G = nx.gn_graph(n=5)
|
|
216
|
-
prev_cc = None
|
|
217
|
-
edge = self.pick_add_edge(dir_G)
|
|
218
|
-
with pytest.raises(nx.NetworkXNotImplemented):
|
|
219
|
-
nx.incremental_closeness_centrality(dir_G, edge, prev_cc, insertion=True)
|
|
220
|
-
|
|
221
|
-
def test_wrong_size_prev_cc_raises(self, undirected_G):
|
|
222
|
-
G, prev_cc = undirected_G
|
|
223
|
-
edge = self.pick_add_edge(G)
|
|
224
|
-
prev_cc.pop(0)
|
|
225
|
-
with pytest.raises(nx.NetworkXError):
|
|
226
|
-
nx.incremental_closeness_centrality(G, edge, prev_cc, insertion=True)
|
|
227
|
-
|
|
228
|
-
def test_wrong_nodes_prev_cc_raises(self, undirected_G):
|
|
229
|
-
G, prev_cc = undirected_G
|
|
230
|
-
|
|
231
|
-
edge = self.pick_add_edge(G)
|
|
232
|
-
num_nodes = len(prev_cc)
|
|
233
|
-
prev_cc.pop(0)
|
|
234
|
-
prev_cc[num_nodes] = 0.5
|
|
235
|
-
with pytest.raises(nx.NetworkXError):
|
|
236
|
-
nx.incremental_closeness_centrality(G, edge, prev_cc, insertion=True)
|
|
237
|
-
|
|
238
|
-
def test_zero_centrality(self):
|
|
239
|
-
G = nx.path_graph(3)
|
|
240
|
-
prev_cc = nx.closeness_centrality(G)
|
|
241
|
-
edge = self.pick_remove_edge(G)
|
|
242
|
-
test_cc = nx.incremental_closeness_centrality(G, edge, prev_cc, insertion=False)
|
|
243
|
-
G.remove_edges_from([edge])
|
|
244
|
-
real_cc = nx.closeness_centrality(G)
|
|
245
|
-
shared_items = set(test_cc.items()) & set(real_cc.items())
|
|
246
|
-
assert len(shared_items) == len(real_cc)
|
|
247
|
-
assert 0 in test_cc.values()
|
|
248
|
-
|
|
249
|
-
def test_incremental(self, undirected_G):
|
|
250
|
-
# Check that incremental and regular give same output
|
|
251
|
-
G, _ = undirected_G
|
|
252
|
-
prev_cc = None
|
|
253
|
-
for i in range(5):
|
|
254
|
-
if i % 2 == 0:
|
|
255
|
-
# Remove an edge
|
|
256
|
-
insert = False
|
|
257
|
-
edge = self.pick_remove_edge(G)
|
|
258
|
-
else:
|
|
259
|
-
# Add an edge
|
|
260
|
-
insert = True
|
|
261
|
-
edge = self.pick_add_edge(G)
|
|
262
|
-
|
|
263
|
-
test_cc = nx.incremental_closeness_centrality(G, edge, prev_cc, insert)
|
|
264
|
-
|
|
265
|
-
if insert:
|
|
266
|
-
G.add_edges_from([edge])
|
|
267
|
-
else:
|
|
268
|
-
G.remove_edges_from([edge])
|
|
269
|
-
|
|
270
|
-
real_cc = nx.closeness_centrality(G)
|
|
271
|
-
|
|
272
|
-
assert set(test_cc.items()) == set(real_cc.items())
|
|
273
|
-
|
|
274
|
-
prev_cc = test_cc
|