okstra 0.113.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/README.kr.md +2 -2
- package/README.md +2 -2
- package/docs/for-ai/README.md +2 -2
- package/docs/for-ai/skills/{okstra-brief.md → okstra-brief-gen.md} +3 -3
- package/docs/for-ai/skills/okstra-inspect.md +1 -1
- package/docs/kr/architecture.md +11 -11
- package/docs/kr/cli.md +1 -1
- package/docs/kr/follow-ups/2026-07-10-final-report-option-3.md +51 -0
- package/docs/project-structure-overview.md +2 -2
- 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/context-loader.md +2 -2
- package/runtime/prompts/lead/okstra-lead-contract.md +1 -1
- package/runtime/prompts/profiles/_common-contract.md +3 -3
- package/runtime/prompts/profiles/implementation-planning.md +1 -1
- package/runtime/prompts/profiles/requirements-discovery.md +2 -2
- package/runtime/python/okstra_ctl/fix_cycles.py +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/wizard.py +3 -3
- 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/skills/{okstra-brief → okstra-brief-gen}/SKILL.md +6 -6
- package/runtime/skills/{okstra-brief → okstra-brief-gen}/references/reporter-confirmations.md +1 -1
- package/runtime/skills/{okstra-brief → okstra-brief-gen}/references/tracker-recursion.md +1 -1
- package/runtime/skills/okstra-inspect/SKILL.md +2 -2
- package/runtime/templates/reports/brief.template.md +2 -2
- 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/validators/validate-brief.py +5 -5
- package/runtime/validators/validate-brief.sh +1 -1
- package/src/commands/lifecycle/uninstall.mjs +2 -1
- package/src/lib/skill-catalog.mjs +2 -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
package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_treewidth.py
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import itertools
|
|
2
|
-
|
|
3
|
-
import networkx as nx
|
|
4
|
-
from networkx.algorithms.approximation import (
|
|
5
|
-
treewidth_min_degree,
|
|
6
|
-
treewidth_min_fill_in,
|
|
7
|
-
)
|
|
8
|
-
from networkx.algorithms.approximation.treewidth import (
|
|
9
|
-
MinDegreeHeuristic,
|
|
10
|
-
min_fill_in_heuristic,
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def is_tree_decomp(graph, decomp):
|
|
15
|
-
"""Check if the given tree decomposition is valid."""
|
|
16
|
-
for x in graph.nodes():
|
|
17
|
-
appear_once = False
|
|
18
|
-
for bag in decomp.nodes():
|
|
19
|
-
if x in bag:
|
|
20
|
-
appear_once = True
|
|
21
|
-
break
|
|
22
|
-
assert appear_once
|
|
23
|
-
|
|
24
|
-
# Check if each connected pair of nodes are at least once together in a bag
|
|
25
|
-
for x, y in graph.edges():
|
|
26
|
-
appear_together = False
|
|
27
|
-
for bag in decomp.nodes():
|
|
28
|
-
if x in bag and y in bag:
|
|
29
|
-
appear_together = True
|
|
30
|
-
break
|
|
31
|
-
assert appear_together
|
|
32
|
-
|
|
33
|
-
# Check if the nodes associated with vertex v form a connected subset of T
|
|
34
|
-
for v in graph.nodes():
|
|
35
|
-
subset = []
|
|
36
|
-
for bag in decomp.nodes():
|
|
37
|
-
if v in bag:
|
|
38
|
-
subset.append(bag)
|
|
39
|
-
sub_graph = decomp.subgraph(subset)
|
|
40
|
-
assert nx.is_connected(sub_graph)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
class TestTreewidthMinDegree:
|
|
44
|
-
"""Unit tests for the min_degree function"""
|
|
45
|
-
|
|
46
|
-
@classmethod
|
|
47
|
-
def setup_class(cls):
|
|
48
|
-
"""Setup for different kinds of trees"""
|
|
49
|
-
cls.complete = nx.Graph()
|
|
50
|
-
cls.complete.add_edge(1, 2)
|
|
51
|
-
cls.complete.add_edge(2, 3)
|
|
52
|
-
cls.complete.add_edge(1, 3)
|
|
53
|
-
|
|
54
|
-
cls.small_tree = nx.Graph()
|
|
55
|
-
cls.small_tree.add_edge(1, 3)
|
|
56
|
-
cls.small_tree.add_edge(4, 3)
|
|
57
|
-
cls.small_tree.add_edge(2, 3)
|
|
58
|
-
cls.small_tree.add_edge(3, 5)
|
|
59
|
-
cls.small_tree.add_edge(5, 6)
|
|
60
|
-
cls.small_tree.add_edge(5, 7)
|
|
61
|
-
cls.small_tree.add_edge(6, 7)
|
|
62
|
-
|
|
63
|
-
cls.deterministic_graph = nx.Graph()
|
|
64
|
-
cls.deterministic_graph.add_edge(0, 1) # deg(0) = 1
|
|
65
|
-
|
|
66
|
-
cls.deterministic_graph.add_edge(1, 2) # deg(1) = 2
|
|
67
|
-
|
|
68
|
-
cls.deterministic_graph.add_edge(2, 3)
|
|
69
|
-
cls.deterministic_graph.add_edge(2, 4) # deg(2) = 3
|
|
70
|
-
|
|
71
|
-
cls.deterministic_graph.add_edge(3, 4)
|
|
72
|
-
cls.deterministic_graph.add_edge(3, 5)
|
|
73
|
-
cls.deterministic_graph.add_edge(3, 6) # deg(3) = 4
|
|
74
|
-
|
|
75
|
-
cls.deterministic_graph.add_edge(4, 5)
|
|
76
|
-
cls.deterministic_graph.add_edge(4, 6)
|
|
77
|
-
cls.deterministic_graph.add_edge(4, 7) # deg(4) = 5
|
|
78
|
-
|
|
79
|
-
cls.deterministic_graph.add_edge(5, 6)
|
|
80
|
-
cls.deterministic_graph.add_edge(5, 7)
|
|
81
|
-
cls.deterministic_graph.add_edge(5, 8)
|
|
82
|
-
cls.deterministic_graph.add_edge(5, 9) # deg(5) = 6
|
|
83
|
-
|
|
84
|
-
cls.deterministic_graph.add_edge(6, 7)
|
|
85
|
-
cls.deterministic_graph.add_edge(6, 8)
|
|
86
|
-
cls.deterministic_graph.add_edge(6, 9) # deg(6) = 6
|
|
87
|
-
|
|
88
|
-
cls.deterministic_graph.add_edge(7, 8)
|
|
89
|
-
cls.deterministic_graph.add_edge(7, 9) # deg(7) = 5
|
|
90
|
-
|
|
91
|
-
cls.deterministic_graph.add_edge(8, 9) # deg(8) = 4
|
|
92
|
-
|
|
93
|
-
def test_petersen_graph(self):
|
|
94
|
-
"""Test Petersen graph tree decomposition result"""
|
|
95
|
-
G = nx.petersen_graph()
|
|
96
|
-
_, decomp = treewidth_min_degree(G)
|
|
97
|
-
is_tree_decomp(G, decomp)
|
|
98
|
-
|
|
99
|
-
def test_small_tree_treewidth(self):
|
|
100
|
-
"""Test small tree
|
|
101
|
-
|
|
102
|
-
Test if the computed treewidth of the known self.small_tree is 2.
|
|
103
|
-
As we know which value we can expect from our heuristic, values other
|
|
104
|
-
than two are regressions
|
|
105
|
-
"""
|
|
106
|
-
G = self.small_tree
|
|
107
|
-
# the order of removal should be [1,2,4]3[5,6,7]
|
|
108
|
-
# (with [] denoting any order of the containing nodes)
|
|
109
|
-
# resulting in treewidth 2 for the heuristic
|
|
110
|
-
treewidth, _ = treewidth_min_fill_in(G)
|
|
111
|
-
assert treewidth == 2
|
|
112
|
-
|
|
113
|
-
def test_heuristic_abort(self):
|
|
114
|
-
"""Test heuristic abort condition for fully connected graph"""
|
|
115
|
-
graph = {}
|
|
116
|
-
for u in self.complete:
|
|
117
|
-
graph[u] = set()
|
|
118
|
-
for v in self.complete[u]:
|
|
119
|
-
if u != v: # ignore self-loop
|
|
120
|
-
graph[u].add(v)
|
|
121
|
-
|
|
122
|
-
deg_heuristic = MinDegreeHeuristic(graph)
|
|
123
|
-
node = deg_heuristic.best_node(graph)
|
|
124
|
-
if node is None:
|
|
125
|
-
pass
|
|
126
|
-
else:
|
|
127
|
-
assert False
|
|
128
|
-
|
|
129
|
-
def test_empty_graph(self):
|
|
130
|
-
"""Test empty graph"""
|
|
131
|
-
G = nx.Graph()
|
|
132
|
-
_, _ = treewidth_min_degree(G)
|
|
133
|
-
|
|
134
|
-
def test_two_component_graph(self):
|
|
135
|
-
G = nx.Graph()
|
|
136
|
-
G.add_node(1)
|
|
137
|
-
G.add_node(2)
|
|
138
|
-
treewidth, _ = treewidth_min_degree(G)
|
|
139
|
-
assert treewidth == 0
|
|
140
|
-
|
|
141
|
-
def test_not_sortable_nodes(self):
|
|
142
|
-
G = nx.Graph([(0, "a")])
|
|
143
|
-
treewidth_min_degree(G)
|
|
144
|
-
|
|
145
|
-
def test_heuristic_first_steps(self):
|
|
146
|
-
"""Test first steps of min_degree heuristic"""
|
|
147
|
-
graph = {
|
|
148
|
-
n: set(self.deterministic_graph[n]) - {n} for n in self.deterministic_graph
|
|
149
|
-
}
|
|
150
|
-
deg_heuristic = MinDegreeHeuristic(graph)
|
|
151
|
-
elim_node = deg_heuristic.best_node(graph)
|
|
152
|
-
steps = []
|
|
153
|
-
|
|
154
|
-
while elim_node is not None:
|
|
155
|
-
steps.append(elim_node)
|
|
156
|
-
nbrs = graph[elim_node]
|
|
157
|
-
|
|
158
|
-
for u, v in itertools.permutations(nbrs, 2):
|
|
159
|
-
if v not in graph[u]:
|
|
160
|
-
graph[u].add(v)
|
|
161
|
-
|
|
162
|
-
for u in graph:
|
|
163
|
-
if elim_node in graph[u]:
|
|
164
|
-
graph[u].remove(elim_node)
|
|
165
|
-
|
|
166
|
-
del graph[elim_node]
|
|
167
|
-
elim_node = deg_heuristic.best_node(graph)
|
|
168
|
-
|
|
169
|
-
# check only the first 5 elements for equality
|
|
170
|
-
assert steps[:5] == [0, 1, 2, 3, 4]
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
class TestTreewidthMinFillIn:
|
|
174
|
-
"""Unit tests for the treewidth_min_fill_in function."""
|
|
175
|
-
|
|
176
|
-
@classmethod
|
|
177
|
-
def setup_class(cls):
|
|
178
|
-
"""Setup for different kinds of trees"""
|
|
179
|
-
cls.complete = nx.Graph()
|
|
180
|
-
cls.complete.add_edge(1, 2)
|
|
181
|
-
cls.complete.add_edge(2, 3)
|
|
182
|
-
cls.complete.add_edge(1, 3)
|
|
183
|
-
|
|
184
|
-
cls.small_tree = nx.Graph()
|
|
185
|
-
cls.small_tree.add_edge(1, 2)
|
|
186
|
-
cls.small_tree.add_edge(2, 3)
|
|
187
|
-
cls.small_tree.add_edge(3, 4)
|
|
188
|
-
cls.small_tree.add_edge(1, 4)
|
|
189
|
-
cls.small_tree.add_edge(2, 4)
|
|
190
|
-
cls.small_tree.add_edge(4, 5)
|
|
191
|
-
cls.small_tree.add_edge(5, 6)
|
|
192
|
-
cls.small_tree.add_edge(5, 7)
|
|
193
|
-
cls.small_tree.add_edge(6, 7)
|
|
194
|
-
|
|
195
|
-
cls.deterministic_graph = nx.Graph()
|
|
196
|
-
cls.deterministic_graph.add_edge(1, 2)
|
|
197
|
-
cls.deterministic_graph.add_edge(1, 3)
|
|
198
|
-
cls.deterministic_graph.add_edge(3, 4)
|
|
199
|
-
cls.deterministic_graph.add_edge(2, 4)
|
|
200
|
-
cls.deterministic_graph.add_edge(3, 5)
|
|
201
|
-
cls.deterministic_graph.add_edge(4, 5)
|
|
202
|
-
cls.deterministic_graph.add_edge(3, 6)
|
|
203
|
-
cls.deterministic_graph.add_edge(5, 6)
|
|
204
|
-
|
|
205
|
-
def test_petersen_graph(self):
|
|
206
|
-
"""Test Petersen graph tree decomposition result"""
|
|
207
|
-
G = nx.petersen_graph()
|
|
208
|
-
_, decomp = treewidth_min_fill_in(G)
|
|
209
|
-
is_tree_decomp(G, decomp)
|
|
210
|
-
|
|
211
|
-
def test_small_tree_treewidth(self):
|
|
212
|
-
"""Test if the computed treewidth of the known self.small_tree is 2"""
|
|
213
|
-
G = self.small_tree
|
|
214
|
-
# the order of removal should be [1,2,4]3[5,6,7]
|
|
215
|
-
# (with [] denoting any order of the containing nodes)
|
|
216
|
-
# resulting in treewidth 2 for the heuristic
|
|
217
|
-
treewidth, _ = treewidth_min_fill_in(G)
|
|
218
|
-
assert treewidth == 2
|
|
219
|
-
|
|
220
|
-
def test_heuristic_abort(self):
|
|
221
|
-
"""Test if min_fill_in returns None for fully connected graph"""
|
|
222
|
-
graph = {}
|
|
223
|
-
for u in self.complete:
|
|
224
|
-
graph[u] = set()
|
|
225
|
-
for v in self.complete[u]:
|
|
226
|
-
if u != v: # ignore self-loop
|
|
227
|
-
graph[u].add(v)
|
|
228
|
-
next_node = min_fill_in_heuristic(graph)
|
|
229
|
-
if next_node is None:
|
|
230
|
-
pass
|
|
231
|
-
else:
|
|
232
|
-
assert False
|
|
233
|
-
|
|
234
|
-
def test_empty_graph(self):
|
|
235
|
-
"""Test empty graph"""
|
|
236
|
-
G = nx.Graph()
|
|
237
|
-
_, _ = treewidth_min_fill_in(G)
|
|
238
|
-
|
|
239
|
-
def test_two_component_graph(self):
|
|
240
|
-
G = nx.Graph()
|
|
241
|
-
G.add_node(1)
|
|
242
|
-
G.add_node(2)
|
|
243
|
-
treewidth, _ = treewidth_min_fill_in(G)
|
|
244
|
-
assert treewidth == 0
|
|
245
|
-
|
|
246
|
-
def test_not_sortable_nodes(self):
|
|
247
|
-
G = nx.Graph([(0, "a")])
|
|
248
|
-
treewidth_min_fill_in(G)
|
|
249
|
-
|
|
250
|
-
def test_heuristic_first_steps(self):
|
|
251
|
-
"""Test first steps of min_fill_in heuristic"""
|
|
252
|
-
graph = {
|
|
253
|
-
n: set(self.deterministic_graph[n]) - {n} for n in self.deterministic_graph
|
|
254
|
-
}
|
|
255
|
-
elim_node = min_fill_in_heuristic(graph)
|
|
256
|
-
steps = []
|
|
257
|
-
|
|
258
|
-
while elim_node is not None:
|
|
259
|
-
steps.append(elim_node)
|
|
260
|
-
nbrs = graph[elim_node]
|
|
261
|
-
|
|
262
|
-
for u, v in itertools.permutations(nbrs, 2):
|
|
263
|
-
if v not in graph[u]:
|
|
264
|
-
graph[u].add(v)
|
|
265
|
-
|
|
266
|
-
for u in graph:
|
|
267
|
-
if elim_node in graph[u]:
|
|
268
|
-
graph[u].remove(elim_node)
|
|
269
|
-
|
|
270
|
-
del graph[elim_node]
|
|
271
|
-
elim_node = min_fill_in_heuristic(graph)
|
|
272
|
-
|
|
273
|
-
# check only the first 2 elements for equality
|
|
274
|
-
assert steps[:2] == [6, 5]
|
package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_vertex_cover.py
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import networkx as nx
|
|
2
|
-
from networkx.algorithms.approximation import min_weighted_vertex_cover
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
def is_cover(G, node_cover):
|
|
6
|
-
return all({u, v} & node_cover for u, v in G.edges())
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class TestMWVC:
|
|
10
|
-
"""Unit tests for the approximate minimum weighted vertex cover
|
|
11
|
-
function,
|
|
12
|
-
:func:`~networkx.algorithms.approximation.vertex_cover.min_weighted_vertex_cover`.
|
|
13
|
-
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
def test_unweighted_directed(self):
|
|
17
|
-
# Create a star graph in which half the nodes are directed in
|
|
18
|
-
# and half are directed out.
|
|
19
|
-
G = nx.DiGraph()
|
|
20
|
-
G.add_edges_from((0, v) for v in range(1, 26))
|
|
21
|
-
G.add_edges_from((v, 0) for v in range(26, 51))
|
|
22
|
-
cover = min_weighted_vertex_cover(G)
|
|
23
|
-
assert 1 == len(cover)
|
|
24
|
-
assert is_cover(G, cover)
|
|
25
|
-
|
|
26
|
-
def test_unweighted_undirected(self):
|
|
27
|
-
# create a simple star graph
|
|
28
|
-
size = 50
|
|
29
|
-
sg = nx.star_graph(size)
|
|
30
|
-
cover = min_weighted_vertex_cover(sg)
|
|
31
|
-
assert 1 == len(cover)
|
|
32
|
-
assert is_cover(sg, cover)
|
|
33
|
-
|
|
34
|
-
def test_weighted(self):
|
|
35
|
-
wg = nx.Graph()
|
|
36
|
-
wg.add_node(0, weight=10)
|
|
37
|
-
wg.add_node(1, weight=1)
|
|
38
|
-
wg.add_node(2, weight=1)
|
|
39
|
-
wg.add_node(3, weight=1)
|
|
40
|
-
wg.add_node(4, weight=1)
|
|
41
|
-
|
|
42
|
-
wg.add_edge(0, 1)
|
|
43
|
-
wg.add_edge(0, 2)
|
|
44
|
-
wg.add_edge(0, 3)
|
|
45
|
-
wg.add_edge(0, 4)
|
|
46
|
-
|
|
47
|
-
wg.add_edge(1, 2)
|
|
48
|
-
wg.add_edge(2, 3)
|
|
49
|
-
wg.add_edge(3, 4)
|
|
50
|
-
wg.add_edge(4, 1)
|
|
51
|
-
|
|
52
|
-
cover = min_weighted_vertex_cover(wg, weight="weight")
|
|
53
|
-
csum = sum(wg.nodes[node]["weight"] for node in cover)
|
|
54
|
-
assert 4 == csum
|
|
55
|
-
assert is_cover(wg, cover)
|
|
56
|
-
|
|
57
|
-
def test_unweighted_self_loop(self):
|
|
58
|
-
slg = nx.Graph()
|
|
59
|
-
slg.add_node(0)
|
|
60
|
-
slg.add_node(1)
|
|
61
|
-
slg.add_node(2)
|
|
62
|
-
|
|
63
|
-
slg.add_edge(0, 1)
|
|
64
|
-
slg.add_edge(2, 2)
|
|
65
|
-
|
|
66
|
-
cover = min_weighted_vertex_cover(slg)
|
|
67
|
-
assert 2 == len(cover)
|
|
68
|
-
assert is_cover(slg, cover)
|
|
File without changes
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import networkx as nx
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class BaseTestAttributeMixing:
|
|
5
|
-
@classmethod
|
|
6
|
-
def setup_class(cls):
|
|
7
|
-
G = nx.Graph()
|
|
8
|
-
G.add_nodes_from([0, 1], fish="one")
|
|
9
|
-
G.add_nodes_from([2, 3], fish="two")
|
|
10
|
-
G.add_nodes_from([4], fish="red")
|
|
11
|
-
G.add_nodes_from([5], fish="blue")
|
|
12
|
-
G.add_edges_from([(0, 1), (2, 3), (0, 4), (2, 5)])
|
|
13
|
-
cls.G = G
|
|
14
|
-
|
|
15
|
-
D = nx.DiGraph()
|
|
16
|
-
D.add_nodes_from([0, 1], fish="one")
|
|
17
|
-
D.add_nodes_from([2, 3], fish="two")
|
|
18
|
-
D.add_nodes_from([4], fish="red")
|
|
19
|
-
D.add_nodes_from([5], fish="blue")
|
|
20
|
-
D.add_edges_from([(0, 1), (2, 3), (0, 4), (2, 5)])
|
|
21
|
-
cls.D = D
|
|
22
|
-
|
|
23
|
-
M = nx.MultiGraph()
|
|
24
|
-
M.add_nodes_from([0, 1], fish="one")
|
|
25
|
-
M.add_nodes_from([2, 3], fish="two")
|
|
26
|
-
M.add_nodes_from([4], fish="red")
|
|
27
|
-
M.add_nodes_from([5], fish="blue")
|
|
28
|
-
M.add_edges_from([(0, 1), (0, 1), (2, 3)])
|
|
29
|
-
cls.M = M
|
|
30
|
-
|
|
31
|
-
S = nx.Graph()
|
|
32
|
-
S.add_nodes_from([0, 1], fish="one")
|
|
33
|
-
S.add_nodes_from([2, 3], fish="two")
|
|
34
|
-
S.add_nodes_from([4], fish="red")
|
|
35
|
-
S.add_nodes_from([5], fish="blue")
|
|
36
|
-
S.add_edge(0, 0)
|
|
37
|
-
S.add_edge(2, 2)
|
|
38
|
-
cls.S = S
|
|
39
|
-
|
|
40
|
-
N = nx.Graph()
|
|
41
|
-
N.add_nodes_from([0, 1], margin=-2)
|
|
42
|
-
N.add_nodes_from([2, 3], margin=-2)
|
|
43
|
-
N.add_nodes_from([4], margin=-3)
|
|
44
|
-
N.add_nodes_from([5], margin=-4)
|
|
45
|
-
N.add_edges_from([(0, 1), (2, 3), (0, 4), (2, 5)])
|
|
46
|
-
cls.N = N
|
|
47
|
-
|
|
48
|
-
F = nx.Graph()
|
|
49
|
-
F.add_edges_from([(0, 3), (1, 3), (2, 3)], weight=0.5)
|
|
50
|
-
F.add_edge(0, 2, weight=1)
|
|
51
|
-
nx.set_node_attributes(F, dict(F.degree(weight="weight")), "margin")
|
|
52
|
-
cls.F = F
|
|
53
|
-
|
|
54
|
-
K = nx.Graph()
|
|
55
|
-
K.add_nodes_from([1, 2], margin=-1)
|
|
56
|
-
K.add_nodes_from([3], margin=1)
|
|
57
|
-
K.add_nodes_from([4], margin=2)
|
|
58
|
-
K.add_edges_from([(3, 4), (1, 2), (1, 3)])
|
|
59
|
-
cls.K = K
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
class BaseTestDegreeMixing:
|
|
63
|
-
@classmethod
|
|
64
|
-
def setup_class(cls):
|
|
65
|
-
cls.P4 = nx.path_graph(4)
|
|
66
|
-
cls.D = nx.DiGraph()
|
|
67
|
-
cls.D.add_edges_from([(0, 2), (0, 3), (1, 3), (2, 3)])
|
|
68
|
-
cls.D2 = nx.DiGraph()
|
|
69
|
-
cls.D2.add_edges_from([(0, 3), (1, 0), (1, 2), (2, 4), (4, 1), (4, 3), (4, 2)])
|
|
70
|
-
cls.M = nx.MultiGraph()
|
|
71
|
-
nx.add_path(cls.M, range(4))
|
|
72
|
-
cls.M.add_edge(0, 1)
|
|
73
|
-
cls.S = nx.Graph()
|
|
74
|
-
cls.S.add_edges_from([(0, 0), (1, 1)])
|
|
75
|
-
cls.W = nx.Graph()
|
|
76
|
-
cls.W.add_edges_from([(0, 3), (1, 3), (2, 3)], weight=0.5)
|
|
77
|
-
cls.W.add_edge(0, 2, weight=1)
|
|
78
|
-
S1 = nx.star_graph(4)
|
|
79
|
-
S2 = nx.star_graph(4)
|
|
80
|
-
cls.DS = nx.disjoint_union(S1, S2)
|
|
81
|
-
cls.DS.add_edge(4, 5)
|
package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_connectivity.py
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
from itertools import permutations
|
|
2
|
-
|
|
3
|
-
import pytest
|
|
4
|
-
|
|
5
|
-
import networkx as nx
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class TestNeighborConnectivity:
|
|
9
|
-
def test_degree_p4(self):
|
|
10
|
-
G = nx.path_graph(4)
|
|
11
|
-
answer = {1: 2.0, 2: 1.5}
|
|
12
|
-
nd = nx.average_degree_connectivity(G)
|
|
13
|
-
assert nd == answer
|
|
14
|
-
|
|
15
|
-
D = G.to_directed()
|
|
16
|
-
answer = {2: 2.0, 4: 1.5}
|
|
17
|
-
nd = nx.average_degree_connectivity(D)
|
|
18
|
-
assert nd == answer
|
|
19
|
-
|
|
20
|
-
answer = {1: 2.0, 2: 1.5}
|
|
21
|
-
D = G.to_directed()
|
|
22
|
-
nd = nx.average_degree_connectivity(D, source="in", target="in")
|
|
23
|
-
assert nd == answer
|
|
24
|
-
|
|
25
|
-
D = G.to_directed()
|
|
26
|
-
nd = nx.average_degree_connectivity(D, source="in", target="in")
|
|
27
|
-
assert nd == answer
|
|
28
|
-
|
|
29
|
-
def test_degree_p4_weighted(self):
|
|
30
|
-
G = nx.path_graph(4)
|
|
31
|
-
G[1][2]["weight"] = 4
|
|
32
|
-
answer = {1: 2.0, 2: 1.8}
|
|
33
|
-
nd = nx.average_degree_connectivity(G, weight="weight")
|
|
34
|
-
assert nd == answer
|
|
35
|
-
answer = {1: 2.0, 2: 1.5}
|
|
36
|
-
nd = nx.average_degree_connectivity(G)
|
|
37
|
-
assert nd == answer
|
|
38
|
-
|
|
39
|
-
D = G.to_directed()
|
|
40
|
-
answer = {2: 2.0, 4: 1.8}
|
|
41
|
-
nd = nx.average_degree_connectivity(D, weight="weight")
|
|
42
|
-
assert nd == answer
|
|
43
|
-
|
|
44
|
-
answer = {1: 2.0, 2: 1.8}
|
|
45
|
-
D = G.to_directed()
|
|
46
|
-
nd = nx.average_degree_connectivity(
|
|
47
|
-
D, weight="weight", source="in", target="in"
|
|
48
|
-
)
|
|
49
|
-
assert nd == answer
|
|
50
|
-
|
|
51
|
-
D = G.to_directed()
|
|
52
|
-
nd = nx.average_degree_connectivity(
|
|
53
|
-
D, source="in", target="out", weight="weight"
|
|
54
|
-
)
|
|
55
|
-
assert nd == answer
|
|
56
|
-
|
|
57
|
-
def test_weight_keyword(self):
|
|
58
|
-
G = nx.path_graph(4)
|
|
59
|
-
G[1][2]["other"] = 4
|
|
60
|
-
answer = {1: 2.0, 2: 1.8}
|
|
61
|
-
nd = nx.average_degree_connectivity(G, weight="other")
|
|
62
|
-
assert nd == answer
|
|
63
|
-
answer = {1: 2.0, 2: 1.5}
|
|
64
|
-
nd = nx.average_degree_connectivity(G, weight=None)
|
|
65
|
-
assert nd == answer
|
|
66
|
-
|
|
67
|
-
D = G.to_directed()
|
|
68
|
-
answer = {2: 2.0, 4: 1.8}
|
|
69
|
-
nd = nx.average_degree_connectivity(D, weight="other")
|
|
70
|
-
assert nd == answer
|
|
71
|
-
|
|
72
|
-
answer = {1: 2.0, 2: 1.8}
|
|
73
|
-
D = G.to_directed()
|
|
74
|
-
nd = nx.average_degree_connectivity(D, weight="other", source="in", target="in")
|
|
75
|
-
assert nd == answer
|
|
76
|
-
|
|
77
|
-
D = G.to_directed()
|
|
78
|
-
nd = nx.average_degree_connectivity(D, weight="other", source="in", target="in")
|
|
79
|
-
assert nd == answer
|
|
80
|
-
|
|
81
|
-
def test_degree_barrat(self):
|
|
82
|
-
G = nx.star_graph(5)
|
|
83
|
-
G.add_edges_from([(5, 6), (5, 7), (5, 8), (5, 9)])
|
|
84
|
-
G[0][5]["weight"] = 5
|
|
85
|
-
nd = nx.average_degree_connectivity(G)[5]
|
|
86
|
-
assert nd == 1.8
|
|
87
|
-
nd = nx.average_degree_connectivity(G, weight="weight")[5]
|
|
88
|
-
assert nd == pytest.approx(3.222222, abs=1e-5)
|
|
89
|
-
|
|
90
|
-
def test_zero_deg(self):
|
|
91
|
-
G = nx.DiGraph()
|
|
92
|
-
G.add_edge(1, 2)
|
|
93
|
-
G.add_edge(1, 3)
|
|
94
|
-
G.add_edge(1, 4)
|
|
95
|
-
c = nx.average_degree_connectivity(G)
|
|
96
|
-
assert c == {1: 0, 3: 1}
|
|
97
|
-
c = nx.average_degree_connectivity(G, source="in", target="in")
|
|
98
|
-
assert c == {0: 0, 1: 0}
|
|
99
|
-
c = nx.average_degree_connectivity(G, source="in", target="out")
|
|
100
|
-
assert c == {0: 0, 1: 3}
|
|
101
|
-
c = nx.average_degree_connectivity(G, source="in", target="in+out")
|
|
102
|
-
assert c == {0: 0, 1: 3}
|
|
103
|
-
c = nx.average_degree_connectivity(G, source="out", target="out")
|
|
104
|
-
assert c == {0: 0, 3: 0}
|
|
105
|
-
c = nx.average_degree_connectivity(G, source="out", target="in")
|
|
106
|
-
assert c == {0: 0, 3: 1}
|
|
107
|
-
c = nx.average_degree_connectivity(G, source="out", target="in+out")
|
|
108
|
-
assert c == {0: 0, 3: 1}
|
|
109
|
-
|
|
110
|
-
def test_in_out_weight(self):
|
|
111
|
-
G = nx.DiGraph()
|
|
112
|
-
G.add_edge(1, 2, weight=1)
|
|
113
|
-
G.add_edge(1, 3, weight=1)
|
|
114
|
-
G.add_edge(3, 1, weight=1)
|
|
115
|
-
for s, t in permutations(["in", "out", "in+out"], 2):
|
|
116
|
-
c = nx.average_degree_connectivity(G, source=s, target=t)
|
|
117
|
-
cw = nx.average_degree_connectivity(G, source=s, target=t, weight="weight")
|
|
118
|
-
assert c == cw
|
|
119
|
-
|
|
120
|
-
def test_invalid_source(self):
|
|
121
|
-
with pytest.raises(nx.NetworkXError):
|
|
122
|
-
G = nx.DiGraph()
|
|
123
|
-
nx.average_degree_connectivity(G, source="bogus")
|
|
124
|
-
|
|
125
|
-
def test_invalid_target(self):
|
|
126
|
-
with pytest.raises(nx.NetworkXError):
|
|
127
|
-
G = nx.DiGraph()
|
|
128
|
-
nx.average_degree_connectivity(G, target="bogus")
|
|
129
|
-
|
|
130
|
-
def test_invalid_undirected_graph(self):
|
|
131
|
-
G = nx.Graph()
|
|
132
|
-
with pytest.raises(nx.NetworkXError):
|
|
133
|
-
nx.average_degree_connectivity(G, target="bogus")
|
|
134
|
-
with pytest.raises(nx.NetworkXError):
|
|
135
|
-
nx.average_degree_connectivity(G, source="bogus")
|
|
136
|
-
|
|
137
|
-
def test_single_node(self):
|
|
138
|
-
# TODO Is this really the intended behavior for providing a
|
|
139
|
-
# single node as the argument `nodes`? Shouldn't the function
|
|
140
|
-
# just return the connectivity value itself?
|
|
141
|
-
G = nx.trivial_graph()
|
|
142
|
-
conn = nx.average_degree_connectivity(G, nodes=0)
|
|
143
|
-
assert conn == {0: 0}
|
package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_correlation.py
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
|
|
3
|
-
import networkx as nx
|
|
4
|
-
from networkx.algorithms.assortativity.correlation import attribute_ac
|
|
5
|
-
|
|
6
|
-
from .base_test import BaseTestAttributeMixing, BaseTestDegreeMixing
|
|
7
|
-
|
|
8
|
-
np = pytest.importorskip("numpy")
|
|
9
|
-
pytest.importorskip("scipy")
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class TestDegreeMixingCorrelation(BaseTestDegreeMixing):
|
|
13
|
-
def test_degree_assortativity_undirected(self):
|
|
14
|
-
r = nx.degree_assortativity_coefficient(self.P4)
|
|
15
|
-
np.testing.assert_almost_equal(r, -1.0 / 2, decimal=4)
|
|
16
|
-
|
|
17
|
-
def test_degree_assortativity_node_kwargs(self):
|
|
18
|
-
G = nx.Graph()
|
|
19
|
-
edges = [(0, 1), (0, 3), (1, 2), (1, 3), (1, 4), (5, 9), (9, 0)]
|
|
20
|
-
G.add_edges_from(edges)
|
|
21
|
-
r = nx.degree_assortativity_coefficient(G, nodes=[1, 2, 4])
|
|
22
|
-
np.testing.assert_almost_equal(r, -1.0, decimal=4)
|
|
23
|
-
|
|
24
|
-
def test_degree_assortativity_directed(self):
|
|
25
|
-
r = nx.degree_assortativity_coefficient(self.D)
|
|
26
|
-
np.testing.assert_almost_equal(r, -0.57735, decimal=4)
|
|
27
|
-
|
|
28
|
-
def test_degree_assortativity_directed2(self):
|
|
29
|
-
"""Test degree assortativity for a directed graph where the set of
|
|
30
|
-
in/out degree does not equal the total degree."""
|
|
31
|
-
r = nx.degree_assortativity_coefficient(self.D2)
|
|
32
|
-
np.testing.assert_almost_equal(r, 0.14852, decimal=4)
|
|
33
|
-
|
|
34
|
-
def test_degree_assortativity_multigraph(self):
|
|
35
|
-
r = nx.degree_assortativity_coefficient(self.M)
|
|
36
|
-
np.testing.assert_almost_equal(r, -1.0 / 7.0, decimal=4)
|
|
37
|
-
|
|
38
|
-
def test_degree_pearson_assortativity_undirected(self):
|
|
39
|
-
r = nx.degree_pearson_correlation_coefficient(self.P4)
|
|
40
|
-
np.testing.assert_almost_equal(r, -1.0 / 2, decimal=4)
|
|
41
|
-
|
|
42
|
-
def test_degree_pearson_assortativity_directed(self):
|
|
43
|
-
r = nx.degree_pearson_correlation_coefficient(self.D)
|
|
44
|
-
np.testing.assert_almost_equal(r, -0.57735, decimal=4)
|
|
45
|
-
|
|
46
|
-
def test_degree_pearson_assortativity_directed2(self):
|
|
47
|
-
"""Test degree assortativity with Pearson for a directed graph where
|
|
48
|
-
the set of in/out degree does not equal the total degree."""
|
|
49
|
-
r = nx.degree_pearson_correlation_coefficient(self.D2)
|
|
50
|
-
np.testing.assert_almost_equal(r, 0.14852, decimal=4)
|
|
51
|
-
|
|
52
|
-
def test_degree_pearson_assortativity_multigraph(self):
|
|
53
|
-
r = nx.degree_pearson_correlation_coefficient(self.M)
|
|
54
|
-
np.testing.assert_almost_equal(r, -1.0 / 7.0, decimal=4)
|
|
55
|
-
|
|
56
|
-
def test_degree_assortativity_weighted(self):
|
|
57
|
-
r = nx.degree_assortativity_coefficient(self.W, weight="weight")
|
|
58
|
-
np.testing.assert_almost_equal(r, -0.1429, decimal=4)
|
|
59
|
-
|
|
60
|
-
def test_degree_assortativity_double_star(self):
|
|
61
|
-
r = nx.degree_assortativity_coefficient(self.DS)
|
|
62
|
-
np.testing.assert_almost_equal(r, -0.9339, decimal=4)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
class TestAttributeMixingCorrelation(BaseTestAttributeMixing):
|
|
66
|
-
def test_attribute_assortativity_undirected(self):
|
|
67
|
-
r = nx.attribute_assortativity_coefficient(self.G, "fish")
|
|
68
|
-
assert r == 6.0 / 22.0
|
|
69
|
-
|
|
70
|
-
def test_attribute_assortativity_directed(self):
|
|
71
|
-
r = nx.attribute_assortativity_coefficient(self.D, "fish")
|
|
72
|
-
assert r == 1.0 / 3.0
|
|
73
|
-
|
|
74
|
-
def test_attribute_assortativity_multigraph(self):
|
|
75
|
-
r = nx.attribute_assortativity_coefficient(self.M, "fish")
|
|
76
|
-
assert r == 1.0
|
|
77
|
-
|
|
78
|
-
def test_attribute_assortativity_coefficient(self):
|
|
79
|
-
# from "Mixing patterns in networks"
|
|
80
|
-
# fmt: off
|
|
81
|
-
a = np.array([[0.258, 0.016, 0.035, 0.013],
|
|
82
|
-
[0.012, 0.157, 0.058, 0.019],
|
|
83
|
-
[0.013, 0.023, 0.306, 0.035],
|
|
84
|
-
[0.005, 0.007, 0.024, 0.016]])
|
|
85
|
-
# fmt: on
|
|
86
|
-
r = attribute_ac(a)
|
|
87
|
-
np.testing.assert_almost_equal(r, 0.623, decimal=3)
|
|
88
|
-
|
|
89
|
-
def test_attribute_assortativity_coefficient2(self):
|
|
90
|
-
# fmt: off
|
|
91
|
-
a = np.array([[0.18, 0.02, 0.01, 0.03],
|
|
92
|
-
[0.02, 0.20, 0.03, 0.02],
|
|
93
|
-
[0.01, 0.03, 0.16, 0.01],
|
|
94
|
-
[0.03, 0.02, 0.01, 0.22]])
|
|
95
|
-
# fmt: on
|
|
96
|
-
r = attribute_ac(a)
|
|
97
|
-
np.testing.assert_almost_equal(r, 0.68, decimal=2)
|
|
98
|
-
|
|
99
|
-
def test_attribute_assortativity(self):
|
|
100
|
-
a = np.array([[50, 50, 0], [50, 50, 0], [0, 0, 2]])
|
|
101
|
-
r = attribute_ac(a)
|
|
102
|
-
np.testing.assert_almost_equal(r, 0.029, decimal=3)
|
|
103
|
-
|
|
104
|
-
def test_attribute_assortativity_negative(self):
|
|
105
|
-
r = nx.numeric_assortativity_coefficient(self.N, "margin")
|
|
106
|
-
np.testing.assert_almost_equal(r, -0.2903, decimal=4)
|
|
107
|
-
|
|
108
|
-
def test_assortativity_node_kwargs(self):
|
|
109
|
-
G = nx.Graph()
|
|
110
|
-
G.add_nodes_from([0, 1], size=2)
|
|
111
|
-
G.add_nodes_from([2, 3], size=3)
|
|
112
|
-
G.add_edges_from([(0, 1), (2, 3)])
|
|
113
|
-
r = nx.numeric_assortativity_coefficient(G, "size", nodes=[0, 3])
|
|
114
|
-
np.testing.assert_almost_equal(r, 1.0, decimal=4)
|
|
115
|
-
|
|
116
|
-
def test_attribute_assortativity_float(self):
|
|
117
|
-
r = nx.numeric_assortativity_coefficient(self.F, "margin")
|
|
118
|
-
np.testing.assert_almost_equal(r, -0.1429, decimal=4)
|
|
119
|
-
|
|
120
|
-
def test_attribute_assortativity_mixed(self):
|
|
121
|
-
r = nx.numeric_assortativity_coefficient(self.K, "margin")
|
|
122
|
-
np.testing.assert_almost_equal(r, 0.4340, decimal=4)
|