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,264 +0,0 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
|
|
3
|
-
import networkx as nx
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def test_modularity_increase():
|
|
7
|
-
G = nx.LFR_benchmark_graph(
|
|
8
|
-
250, 3, 1.5, 0.009, average_degree=5, min_community=20, seed=10
|
|
9
|
-
)
|
|
10
|
-
partition = [{u} for u in G.nodes()]
|
|
11
|
-
mod = nx.community.modularity(G, partition)
|
|
12
|
-
partition = nx.community.louvain_communities(G)
|
|
13
|
-
|
|
14
|
-
assert nx.community.modularity(G, partition) > mod
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def test_valid_partition():
|
|
18
|
-
G = nx.LFR_benchmark_graph(
|
|
19
|
-
250, 3, 1.5, 0.009, average_degree=5, min_community=20, seed=10
|
|
20
|
-
)
|
|
21
|
-
H = G.to_directed()
|
|
22
|
-
partition = nx.community.louvain_communities(G)
|
|
23
|
-
partition2 = nx.community.louvain_communities(H)
|
|
24
|
-
|
|
25
|
-
assert nx.community.is_partition(G, partition)
|
|
26
|
-
assert nx.community.is_partition(H, partition2)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def test_karate_club_partition():
|
|
30
|
-
G = nx.karate_club_graph()
|
|
31
|
-
part = [
|
|
32
|
-
{0, 1, 2, 3, 7, 9, 11, 12, 13, 17, 19, 21},
|
|
33
|
-
{16, 4, 5, 6, 10},
|
|
34
|
-
{23, 25, 27, 28, 24, 31},
|
|
35
|
-
{32, 33, 8, 14, 15, 18, 20, 22, 26, 29, 30},
|
|
36
|
-
]
|
|
37
|
-
partition = nx.community.louvain_communities(G, seed=2, weight=None)
|
|
38
|
-
|
|
39
|
-
assert part == partition
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def test_partition_iterator():
|
|
43
|
-
G = nx.path_graph(15)
|
|
44
|
-
parts_iter = nx.community.louvain_partitions(G, seed=42)
|
|
45
|
-
first_part = next(parts_iter)
|
|
46
|
-
first_copy = [s.copy() for s in first_part]
|
|
47
|
-
|
|
48
|
-
# gh-5901 reports sets changing after next partition is yielded
|
|
49
|
-
assert first_copy[0] == first_part[0]
|
|
50
|
-
second_part = next(parts_iter)
|
|
51
|
-
assert first_copy[0] == first_part[0]
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def test_undirected_selfloops():
|
|
55
|
-
G = nx.karate_club_graph()
|
|
56
|
-
expected_partition = nx.community.louvain_communities(G, seed=2, weight=None)
|
|
57
|
-
part = [
|
|
58
|
-
{0, 1, 2, 3, 7, 9, 11, 12, 13, 17, 19, 21},
|
|
59
|
-
{16, 4, 5, 6, 10},
|
|
60
|
-
{23, 25, 27, 28, 24, 31},
|
|
61
|
-
{32, 33, 8, 14, 15, 18, 20, 22, 26, 29, 30},
|
|
62
|
-
]
|
|
63
|
-
assert expected_partition == part
|
|
64
|
-
|
|
65
|
-
G.add_weighted_edges_from([(i, i, i * 1000) for i in range(9)])
|
|
66
|
-
# large self-loop weight impacts partition
|
|
67
|
-
partition = nx.community.louvain_communities(G, seed=2, weight="weight")
|
|
68
|
-
assert part != partition
|
|
69
|
-
|
|
70
|
-
# small self-loop weights aren't enough to impact partition in this graph
|
|
71
|
-
partition = nx.community.louvain_communities(G, seed=2, weight=None)
|
|
72
|
-
assert part == partition
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
def test_directed_selfloops():
|
|
76
|
-
G = nx.DiGraph()
|
|
77
|
-
G.add_nodes_from(range(11))
|
|
78
|
-
G_edges = [
|
|
79
|
-
(0, 2),
|
|
80
|
-
(0, 1),
|
|
81
|
-
(1, 0),
|
|
82
|
-
(2, 1),
|
|
83
|
-
(2, 0),
|
|
84
|
-
(3, 4),
|
|
85
|
-
(4, 3),
|
|
86
|
-
(7, 8),
|
|
87
|
-
(8, 7),
|
|
88
|
-
(9, 10),
|
|
89
|
-
(10, 9),
|
|
90
|
-
]
|
|
91
|
-
G.add_edges_from(G_edges)
|
|
92
|
-
G_expected_partition = nx.community.louvain_communities(G, seed=123, weight=None)
|
|
93
|
-
|
|
94
|
-
G.add_weighted_edges_from([(i, i, i * 1000) for i in range(3)])
|
|
95
|
-
# large self-loop weight impacts partition
|
|
96
|
-
G_partition = nx.community.louvain_communities(G, seed=123, weight="weight")
|
|
97
|
-
assert G_partition != G_expected_partition
|
|
98
|
-
|
|
99
|
-
# small self-loop weights aren't enough to impact partition in this graph
|
|
100
|
-
G_partition = nx.community.louvain_communities(G, seed=123, weight=None)
|
|
101
|
-
assert G_partition == G_expected_partition
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
def test_directed_partition():
|
|
105
|
-
"""
|
|
106
|
-
Test 2 cases that were looping infinitely
|
|
107
|
-
from issues #5175 and #5704
|
|
108
|
-
"""
|
|
109
|
-
G = nx.DiGraph()
|
|
110
|
-
H = nx.DiGraph()
|
|
111
|
-
G.add_nodes_from(range(10))
|
|
112
|
-
H.add_nodes_from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
|
|
113
|
-
G_edges = [
|
|
114
|
-
(0, 2),
|
|
115
|
-
(0, 1),
|
|
116
|
-
(1, 0),
|
|
117
|
-
(2, 1),
|
|
118
|
-
(2, 0),
|
|
119
|
-
(3, 4),
|
|
120
|
-
(4, 3),
|
|
121
|
-
(7, 8),
|
|
122
|
-
(8, 7),
|
|
123
|
-
(9, 10),
|
|
124
|
-
(10, 9),
|
|
125
|
-
]
|
|
126
|
-
H_edges = [
|
|
127
|
-
(1, 2),
|
|
128
|
-
(1, 6),
|
|
129
|
-
(1, 9),
|
|
130
|
-
(2, 3),
|
|
131
|
-
(2, 4),
|
|
132
|
-
(2, 5),
|
|
133
|
-
(3, 4),
|
|
134
|
-
(4, 3),
|
|
135
|
-
(4, 5),
|
|
136
|
-
(5, 4),
|
|
137
|
-
(6, 7),
|
|
138
|
-
(6, 8),
|
|
139
|
-
(9, 10),
|
|
140
|
-
(9, 11),
|
|
141
|
-
(10, 11),
|
|
142
|
-
(11, 10),
|
|
143
|
-
]
|
|
144
|
-
G.add_edges_from(G_edges)
|
|
145
|
-
H.add_edges_from(H_edges)
|
|
146
|
-
|
|
147
|
-
G_expected_partition = [{0, 1, 2}, {3, 4}, {5}, {6}, {8, 7}, {9, 10}]
|
|
148
|
-
G_partition = nx.community.louvain_communities(G, seed=123, weight=None)
|
|
149
|
-
|
|
150
|
-
H_expected_partition = [{2, 3, 4, 5}, {8, 1, 6, 7}, {9, 10, 11}]
|
|
151
|
-
H_partition = nx.community.louvain_communities(H, seed=123, weight=None)
|
|
152
|
-
|
|
153
|
-
assert G_partition == G_expected_partition
|
|
154
|
-
assert H_partition == H_expected_partition
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
def test_none_weight_param():
|
|
158
|
-
G = nx.karate_club_graph()
|
|
159
|
-
nx.set_edge_attributes(
|
|
160
|
-
G, {edge: i * i for i, edge in enumerate(G.edges)}, name="foo"
|
|
161
|
-
)
|
|
162
|
-
|
|
163
|
-
part = [
|
|
164
|
-
{0, 1, 2, 3, 7, 9, 11, 12, 13, 17, 19, 21},
|
|
165
|
-
{16, 4, 5, 6, 10},
|
|
166
|
-
{23, 25, 27, 28, 24, 31},
|
|
167
|
-
{32, 33, 8, 14, 15, 18, 20, 22, 26, 29, 30},
|
|
168
|
-
]
|
|
169
|
-
partition1 = nx.community.louvain_communities(G, weight=None, seed=2)
|
|
170
|
-
partition2 = nx.community.louvain_communities(G, weight="foo", seed=2)
|
|
171
|
-
partition3 = nx.community.louvain_communities(G, weight="weight", seed=2)
|
|
172
|
-
|
|
173
|
-
assert part == partition1
|
|
174
|
-
assert part != partition2
|
|
175
|
-
assert part != partition3
|
|
176
|
-
assert partition2 != partition3
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
def test_quality():
|
|
180
|
-
G = nx.LFR_benchmark_graph(
|
|
181
|
-
250, 3, 1.5, 0.009, average_degree=5, min_community=20, seed=10
|
|
182
|
-
)
|
|
183
|
-
H = nx.gn_graph(200, seed=1234)
|
|
184
|
-
I = nx.MultiGraph(G)
|
|
185
|
-
J = nx.MultiDiGraph(H)
|
|
186
|
-
|
|
187
|
-
partition = nx.community.louvain_communities(G)
|
|
188
|
-
partition2 = nx.community.louvain_communities(H)
|
|
189
|
-
partition3 = nx.community.louvain_communities(I)
|
|
190
|
-
partition4 = nx.community.louvain_communities(J)
|
|
191
|
-
|
|
192
|
-
quality = nx.community.partition_quality(G, partition)[0]
|
|
193
|
-
quality2 = nx.community.partition_quality(H, partition2)[0]
|
|
194
|
-
quality3 = nx.community.partition_quality(I, partition3)[0]
|
|
195
|
-
quality4 = nx.community.partition_quality(J, partition4)[0]
|
|
196
|
-
|
|
197
|
-
assert quality >= 0.65
|
|
198
|
-
assert quality2 >= 0.65
|
|
199
|
-
assert quality3 >= 0.65
|
|
200
|
-
assert quality4 >= 0.65
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
def test_multigraph():
|
|
204
|
-
G = nx.karate_club_graph()
|
|
205
|
-
H = nx.MultiGraph(G)
|
|
206
|
-
G.add_edge(0, 1, weight=10)
|
|
207
|
-
H.add_edge(0, 1, weight=9)
|
|
208
|
-
G.add_edge(0, 9, foo=20)
|
|
209
|
-
H.add_edge(0, 9, foo=20)
|
|
210
|
-
|
|
211
|
-
partition1 = nx.community.louvain_communities(G, seed=1234)
|
|
212
|
-
partition2 = nx.community.louvain_communities(H, seed=1234)
|
|
213
|
-
partition3 = nx.community.louvain_communities(H, weight="foo", seed=1234)
|
|
214
|
-
|
|
215
|
-
assert partition1 == partition2 != partition3
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
def test_resolution():
|
|
219
|
-
G = nx.LFR_benchmark_graph(
|
|
220
|
-
250, 3, 1.5, 0.009, average_degree=5, min_community=20, seed=10
|
|
221
|
-
)
|
|
222
|
-
|
|
223
|
-
partition1 = nx.community.louvain_communities(G, resolution=0.5, seed=12)
|
|
224
|
-
partition2 = nx.community.louvain_communities(G, seed=12)
|
|
225
|
-
partition3 = nx.community.louvain_communities(G, resolution=2, seed=12)
|
|
226
|
-
|
|
227
|
-
assert len(partition1) <= len(partition2) <= len(partition3)
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
def test_threshold():
|
|
231
|
-
G = nx.LFR_benchmark_graph(
|
|
232
|
-
250, 3, 1.5, 0.009, average_degree=5, min_community=20, seed=10
|
|
233
|
-
)
|
|
234
|
-
partition1 = nx.community.louvain_communities(G, threshold=0.3, seed=2)
|
|
235
|
-
partition2 = nx.community.louvain_communities(G, seed=2)
|
|
236
|
-
mod1 = nx.community.modularity(G, partition1)
|
|
237
|
-
mod2 = nx.community.modularity(G, partition2)
|
|
238
|
-
|
|
239
|
-
assert mod1 <= mod2
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
def test_empty_graph():
|
|
243
|
-
G = nx.Graph()
|
|
244
|
-
G.add_nodes_from(range(5))
|
|
245
|
-
expected = [{0}, {1}, {2}, {3}, {4}]
|
|
246
|
-
assert nx.community.louvain_communities(G) == expected
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
def test_max_level():
|
|
250
|
-
G = nx.LFR_benchmark_graph(
|
|
251
|
-
250, 3, 1.5, 0.009, average_degree=5, min_community=20, seed=10
|
|
252
|
-
)
|
|
253
|
-
parts_iter = nx.community.louvain_partitions(G, seed=42)
|
|
254
|
-
for max_level, expected in enumerate(parts_iter, 1):
|
|
255
|
-
partition = nx.community.louvain_communities(G, max_level=max_level, seed=42)
|
|
256
|
-
assert partition == expected
|
|
257
|
-
assert max_level > 1 # Ensure we are actually testing max_level
|
|
258
|
-
# max_level is an upper limit; it's okay if we stop before it's hit.
|
|
259
|
-
partition = nx.community.louvain_communities(G, max_level=max_level + 1, seed=42)
|
|
260
|
-
assert partition == expected
|
|
261
|
-
with pytest.raises(
|
|
262
|
-
ValueError, match="max_level argument must be a positive integer"
|
|
263
|
-
):
|
|
264
|
-
nx.community.louvain_communities(G, max_level=0)
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
from itertools import product
|
|
2
|
-
|
|
3
|
-
import pytest
|
|
4
|
-
|
|
5
|
-
import networkx as nx
|
|
6
|
-
|
|
7
|
-
EWL = "e_weight"
|
|
8
|
-
NWL = "n_weight"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
# first test from the Lukes original paper
|
|
12
|
-
def paper_1_case(float_edge_wt=False, explicit_node_wt=True, directed=False):
|
|
13
|
-
# problem-specific constants
|
|
14
|
-
limit = 3
|
|
15
|
-
|
|
16
|
-
# configuration
|
|
17
|
-
if float_edge_wt:
|
|
18
|
-
shift = 0.001
|
|
19
|
-
else:
|
|
20
|
-
shift = 0
|
|
21
|
-
|
|
22
|
-
if directed:
|
|
23
|
-
example_1 = nx.DiGraph()
|
|
24
|
-
else:
|
|
25
|
-
example_1 = nx.Graph()
|
|
26
|
-
|
|
27
|
-
# graph creation
|
|
28
|
-
example_1.add_edge(1, 2, **{EWL: 3 + shift})
|
|
29
|
-
example_1.add_edge(1, 4, **{EWL: 2 + shift})
|
|
30
|
-
example_1.add_edge(2, 3, **{EWL: 4 + shift})
|
|
31
|
-
example_1.add_edge(2, 5, **{EWL: 6 + shift})
|
|
32
|
-
|
|
33
|
-
# node weights
|
|
34
|
-
if explicit_node_wt:
|
|
35
|
-
nx.set_node_attributes(example_1, 1, NWL)
|
|
36
|
-
wtu = NWL
|
|
37
|
-
else:
|
|
38
|
-
wtu = None
|
|
39
|
-
|
|
40
|
-
# partitioning
|
|
41
|
-
clusters_1 = {
|
|
42
|
-
frozenset(x)
|
|
43
|
-
for x in nx.community.lukes_partitioning(
|
|
44
|
-
example_1, limit, node_weight=wtu, edge_weight=EWL
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return clusters_1
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
# second test from the Lukes original paper
|
|
52
|
-
def paper_2_case(explicit_edge_wt=True, directed=False):
|
|
53
|
-
# problem specific constants
|
|
54
|
-
byte_block_size = 32
|
|
55
|
-
|
|
56
|
-
# configuration
|
|
57
|
-
if directed:
|
|
58
|
-
example_2 = nx.DiGraph()
|
|
59
|
-
else:
|
|
60
|
-
example_2 = nx.Graph()
|
|
61
|
-
|
|
62
|
-
if explicit_edge_wt:
|
|
63
|
-
edic = {EWL: 1}
|
|
64
|
-
wtu = EWL
|
|
65
|
-
else:
|
|
66
|
-
edic = {}
|
|
67
|
-
wtu = None
|
|
68
|
-
|
|
69
|
-
# graph creation
|
|
70
|
-
example_2.add_edge("name", "home_address", **edic)
|
|
71
|
-
example_2.add_edge("name", "education", **edic)
|
|
72
|
-
example_2.add_edge("education", "bs", **edic)
|
|
73
|
-
example_2.add_edge("education", "ms", **edic)
|
|
74
|
-
example_2.add_edge("education", "phd", **edic)
|
|
75
|
-
example_2.add_edge("name", "telephone", **edic)
|
|
76
|
-
example_2.add_edge("telephone", "home", **edic)
|
|
77
|
-
example_2.add_edge("telephone", "office", **edic)
|
|
78
|
-
example_2.add_edge("office", "no1", **edic)
|
|
79
|
-
example_2.add_edge("office", "no2", **edic)
|
|
80
|
-
|
|
81
|
-
example_2.nodes["name"][NWL] = 20
|
|
82
|
-
example_2.nodes["education"][NWL] = 10
|
|
83
|
-
example_2.nodes["bs"][NWL] = 1
|
|
84
|
-
example_2.nodes["ms"][NWL] = 1
|
|
85
|
-
example_2.nodes["phd"][NWL] = 1
|
|
86
|
-
example_2.nodes["home_address"][NWL] = 8
|
|
87
|
-
example_2.nodes["telephone"][NWL] = 8
|
|
88
|
-
example_2.nodes["home"][NWL] = 8
|
|
89
|
-
example_2.nodes["office"][NWL] = 4
|
|
90
|
-
example_2.nodes["no1"][NWL] = 1
|
|
91
|
-
example_2.nodes["no2"][NWL] = 1
|
|
92
|
-
|
|
93
|
-
# partitioning
|
|
94
|
-
clusters_2 = {
|
|
95
|
-
frozenset(x)
|
|
96
|
-
for x in nx.community.lukes_partitioning(
|
|
97
|
-
example_2, byte_block_size, node_weight=NWL, edge_weight=wtu
|
|
98
|
-
)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return clusters_2
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
def test_paper_1_case():
|
|
105
|
-
ground_truth = {frozenset([1, 4]), frozenset([2, 3, 5])}
|
|
106
|
-
|
|
107
|
-
tf = (True, False)
|
|
108
|
-
for flt, nwt, drc in product(tf, tf, tf):
|
|
109
|
-
part = paper_1_case(flt, nwt, drc)
|
|
110
|
-
assert part == ground_truth
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
def test_paper_2_case():
|
|
114
|
-
ground_truth = {
|
|
115
|
-
frozenset(["education", "bs", "ms", "phd"]),
|
|
116
|
-
frozenset(["name", "home_address"]),
|
|
117
|
-
frozenset(["telephone", "home", "office", "no1", "no2"]),
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
tf = (True, False)
|
|
121
|
-
for ewt, drc in product(tf, tf):
|
|
122
|
-
part = paper_2_case(ewt, drc)
|
|
123
|
-
assert part == ground_truth
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
def test_mandatory_tree():
|
|
127
|
-
not_a_tree = nx.complete_graph(4)
|
|
128
|
-
|
|
129
|
-
with pytest.raises(nx.NotATree):
|
|
130
|
-
nx.community.lukes_partitioning(not_a_tree, 5)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
def test_mandatory_integrality():
|
|
134
|
-
byte_block_size = 32
|
|
135
|
-
|
|
136
|
-
ex_1_broken = nx.DiGraph()
|
|
137
|
-
|
|
138
|
-
ex_1_broken.add_edge(1, 2, **{EWL: 3.2})
|
|
139
|
-
ex_1_broken.add_edge(1, 4, **{EWL: 2.4})
|
|
140
|
-
ex_1_broken.add_edge(2, 3, **{EWL: 4.0})
|
|
141
|
-
ex_1_broken.add_edge(2, 5, **{EWL: 6.3})
|
|
142
|
-
|
|
143
|
-
ex_1_broken.nodes[1][NWL] = 1.2 # !
|
|
144
|
-
ex_1_broken.nodes[2][NWL] = 1
|
|
145
|
-
ex_1_broken.nodes[3][NWL] = 1
|
|
146
|
-
ex_1_broken.nodes[4][NWL] = 1
|
|
147
|
-
ex_1_broken.nodes[5][NWL] = 2
|
|
148
|
-
|
|
149
|
-
with pytest.raises(TypeError):
|
|
150
|
-
nx.community.lukes_partitioning(
|
|
151
|
-
ex_1_broken, byte_block_size, node_weight=NWL, edge_weight=EWL
|
|
152
|
-
)
|