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
|
File without changes
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import networkx as nx
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def test_is_at_free():
|
|
5
|
-
is_at_free = nx.asteroidal.is_at_free
|
|
6
|
-
|
|
7
|
-
cycle = nx.cycle_graph(6)
|
|
8
|
-
assert not is_at_free(cycle)
|
|
9
|
-
|
|
10
|
-
path = nx.path_graph(6)
|
|
11
|
-
assert is_at_free(path)
|
|
12
|
-
|
|
13
|
-
small_graph = nx.complete_graph(2)
|
|
14
|
-
assert is_at_free(small_graph)
|
|
15
|
-
|
|
16
|
-
petersen = nx.petersen_graph()
|
|
17
|
-
assert not is_at_free(petersen)
|
|
18
|
-
|
|
19
|
-
clique = nx.complete_graph(6)
|
|
20
|
-
assert is_at_free(clique)
|
|
21
|
-
|
|
22
|
-
line_clique = nx.line_graph(clique)
|
|
23
|
-
assert not is_at_free(line_clique)
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
"""Unit tests for the :mod:`networkx.algorithms.boundary` module."""
|
|
2
|
-
|
|
3
|
-
from itertools import combinations
|
|
4
|
-
|
|
5
|
-
import pytest
|
|
6
|
-
|
|
7
|
-
import networkx as nx
|
|
8
|
-
from networkx import convert_node_labels_to_integers as cnlti
|
|
9
|
-
from networkx.utils import edges_equal
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class TestNodeBoundary:
|
|
13
|
-
"""Unit tests for the :func:`~networkx.node_boundary` function."""
|
|
14
|
-
|
|
15
|
-
def test_null_graph(self):
|
|
16
|
-
"""Tests that the null graph has empty node boundaries."""
|
|
17
|
-
null = nx.null_graph()
|
|
18
|
-
assert nx.node_boundary(null, []) == set()
|
|
19
|
-
assert nx.node_boundary(null, [], []) == set()
|
|
20
|
-
assert nx.node_boundary(null, [1, 2, 3]) == set()
|
|
21
|
-
assert nx.node_boundary(null, [1, 2, 3], [4, 5, 6]) == set()
|
|
22
|
-
assert nx.node_boundary(null, [1, 2, 3], [3, 4, 5]) == set()
|
|
23
|
-
|
|
24
|
-
def test_path_graph(self):
|
|
25
|
-
P10 = cnlti(nx.path_graph(10), first_label=1)
|
|
26
|
-
assert nx.node_boundary(P10, []) == set()
|
|
27
|
-
assert nx.node_boundary(P10, [], []) == set()
|
|
28
|
-
assert nx.node_boundary(P10, [1, 2, 3]) == {4}
|
|
29
|
-
assert nx.node_boundary(P10, [4, 5, 6]) == {3, 7}
|
|
30
|
-
assert nx.node_boundary(P10, [3, 4, 5, 6, 7]) == {2, 8}
|
|
31
|
-
assert nx.node_boundary(P10, [8, 9, 10]) == {7}
|
|
32
|
-
assert nx.node_boundary(P10, [4, 5, 6], [9, 10]) == set()
|
|
33
|
-
|
|
34
|
-
def test_complete_graph(self):
|
|
35
|
-
K10 = cnlti(nx.complete_graph(10), first_label=1)
|
|
36
|
-
assert nx.node_boundary(K10, []) == set()
|
|
37
|
-
assert nx.node_boundary(K10, [], []) == set()
|
|
38
|
-
assert nx.node_boundary(K10, [1, 2, 3]) == {4, 5, 6, 7, 8, 9, 10}
|
|
39
|
-
assert nx.node_boundary(K10, [4, 5, 6]) == {1, 2, 3, 7, 8, 9, 10}
|
|
40
|
-
assert nx.node_boundary(K10, [3, 4, 5, 6, 7]) == {1, 2, 8, 9, 10}
|
|
41
|
-
assert nx.node_boundary(K10, [4, 5, 6], []) == set()
|
|
42
|
-
assert nx.node_boundary(K10, K10) == set()
|
|
43
|
-
assert nx.node_boundary(K10, [1, 2, 3], [3, 4, 5]) == {4, 5}
|
|
44
|
-
|
|
45
|
-
def test_petersen(self):
|
|
46
|
-
"""Check boundaries in the petersen graph
|
|
47
|
-
|
|
48
|
-
cheeger(G,k)=min(|bdy(S)|/|S| for |S|=k, 0<k<=|V(G)|/2)
|
|
49
|
-
|
|
50
|
-
"""
|
|
51
|
-
|
|
52
|
-
def cheeger(G, k):
|
|
53
|
-
return min(len(nx.node_boundary(G, nn)) / k for nn in combinations(G, k))
|
|
54
|
-
|
|
55
|
-
P = nx.petersen_graph()
|
|
56
|
-
assert cheeger(P, 1) == pytest.approx(3.00, abs=1e-2)
|
|
57
|
-
assert cheeger(P, 2) == pytest.approx(2.00, abs=1e-2)
|
|
58
|
-
assert cheeger(P, 3) == pytest.approx(1.67, abs=1e-2)
|
|
59
|
-
assert cheeger(P, 4) == pytest.approx(1.00, abs=1e-2)
|
|
60
|
-
assert cheeger(P, 5) == pytest.approx(0.80, abs=1e-2)
|
|
61
|
-
|
|
62
|
-
def test_directed(self):
|
|
63
|
-
"""Tests the node boundary of a directed graph."""
|
|
64
|
-
G = nx.DiGraph([(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)])
|
|
65
|
-
S = {0, 1}
|
|
66
|
-
boundary = nx.node_boundary(G, S)
|
|
67
|
-
expected = {2}
|
|
68
|
-
assert boundary == expected
|
|
69
|
-
|
|
70
|
-
def test_multigraph(self):
|
|
71
|
-
"""Tests the node boundary of a multigraph."""
|
|
72
|
-
G = nx.MultiGraph(list(nx.cycle_graph(5).edges()) * 2)
|
|
73
|
-
S = {0, 1}
|
|
74
|
-
boundary = nx.node_boundary(G, S)
|
|
75
|
-
expected = {2, 4}
|
|
76
|
-
assert boundary == expected
|
|
77
|
-
|
|
78
|
-
def test_multidigraph(self):
|
|
79
|
-
"""Tests the edge boundary of a multidigraph."""
|
|
80
|
-
edges = [(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)]
|
|
81
|
-
G = nx.MultiDiGraph(edges * 2)
|
|
82
|
-
S = {0, 1}
|
|
83
|
-
boundary = nx.node_boundary(G, S)
|
|
84
|
-
expected = {2}
|
|
85
|
-
assert boundary == expected
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
class TestEdgeBoundary:
|
|
89
|
-
"""Unit tests for the :func:`~networkx.edge_boundary` function."""
|
|
90
|
-
|
|
91
|
-
def test_null_graph(self):
|
|
92
|
-
null = nx.null_graph()
|
|
93
|
-
assert list(nx.edge_boundary(null, [])) == []
|
|
94
|
-
assert list(nx.edge_boundary(null, [], [])) == []
|
|
95
|
-
assert list(nx.edge_boundary(null, [1, 2, 3])) == []
|
|
96
|
-
assert list(nx.edge_boundary(null, [1, 2, 3], [4, 5, 6])) == []
|
|
97
|
-
assert list(nx.edge_boundary(null, [1, 2, 3], [3, 4, 5])) == []
|
|
98
|
-
|
|
99
|
-
def test_path_graph(self):
|
|
100
|
-
P10 = cnlti(nx.path_graph(10), first_label=1)
|
|
101
|
-
assert list(nx.edge_boundary(P10, [])) == []
|
|
102
|
-
assert list(nx.edge_boundary(P10, [], [])) == []
|
|
103
|
-
assert list(nx.edge_boundary(P10, [1, 2, 3])) == [(3, 4)]
|
|
104
|
-
assert sorted(nx.edge_boundary(P10, [4, 5, 6])) == [(4, 3), (6, 7)]
|
|
105
|
-
assert sorted(nx.edge_boundary(P10, [3, 4, 5, 6, 7])) == [(3, 2), (7, 8)]
|
|
106
|
-
assert list(nx.edge_boundary(P10, [8, 9, 10])) == [(8, 7)]
|
|
107
|
-
assert sorted(nx.edge_boundary(P10, [4, 5, 6], [9, 10])) == []
|
|
108
|
-
assert list(nx.edge_boundary(P10, [1, 2, 3], [3, 4, 5])) == [(2, 3), (3, 4)]
|
|
109
|
-
|
|
110
|
-
def test_complete_graph(self):
|
|
111
|
-
K10 = cnlti(nx.complete_graph(10), first_label=1)
|
|
112
|
-
|
|
113
|
-
def ilen(iterable):
|
|
114
|
-
return sum(1 for i in iterable)
|
|
115
|
-
|
|
116
|
-
assert list(nx.edge_boundary(K10, [])) == []
|
|
117
|
-
assert list(nx.edge_boundary(K10, [], [])) == []
|
|
118
|
-
assert ilen(nx.edge_boundary(K10, [1, 2, 3])) == 21
|
|
119
|
-
assert ilen(nx.edge_boundary(K10, [4, 5, 6, 7])) == 24
|
|
120
|
-
assert ilen(nx.edge_boundary(K10, [3, 4, 5, 6, 7])) == 25
|
|
121
|
-
assert ilen(nx.edge_boundary(K10, [8, 9, 10])) == 21
|
|
122
|
-
assert edges_equal(
|
|
123
|
-
nx.edge_boundary(K10, [4, 5, 6], [9, 10]),
|
|
124
|
-
[(4, 9), (4, 10), (5, 9), (5, 10), (6, 9), (6, 10)],
|
|
125
|
-
)
|
|
126
|
-
assert edges_equal(
|
|
127
|
-
nx.edge_boundary(K10, [1, 2, 3], [3, 4, 5]),
|
|
128
|
-
[(1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5), (3, 4), (3, 5)],
|
|
129
|
-
)
|
|
130
|
-
|
|
131
|
-
def test_directed(self):
|
|
132
|
-
"""Tests the edge boundary of a directed graph."""
|
|
133
|
-
G = nx.DiGraph([(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)])
|
|
134
|
-
S = {0, 1}
|
|
135
|
-
boundary = list(nx.edge_boundary(G, S))
|
|
136
|
-
expected = [(1, 2)]
|
|
137
|
-
assert boundary == expected
|
|
138
|
-
|
|
139
|
-
def test_multigraph(self):
|
|
140
|
-
"""Tests the edge boundary of a multigraph."""
|
|
141
|
-
G = nx.MultiGraph(list(nx.cycle_graph(5).edges()) * 2)
|
|
142
|
-
S = {0, 1}
|
|
143
|
-
boundary = list(nx.edge_boundary(G, S))
|
|
144
|
-
expected = [(0, 4), (0, 4), (1, 2), (1, 2)]
|
|
145
|
-
assert boundary == expected
|
|
146
|
-
|
|
147
|
-
def test_multidigraph(self):
|
|
148
|
-
"""Tests the edge boundary of a multidigraph."""
|
|
149
|
-
edges = [(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)]
|
|
150
|
-
G = nx.MultiDiGraph(edges * 2)
|
|
151
|
-
S = {0, 1}
|
|
152
|
-
boundary = list(nx.edge_boundary(G, S))
|
|
153
|
-
expected = [(1, 2), (1, 2)]
|
|
154
|
-
assert boundary == expected
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
"""Unit tests for bridge-finding algorithms."""
|
|
2
|
-
|
|
3
|
-
import pytest
|
|
4
|
-
|
|
5
|
-
import networkx as nx
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class TestBridges:
|
|
9
|
-
"""Unit tests for the bridge-finding function."""
|
|
10
|
-
|
|
11
|
-
def test_single_bridge(self):
|
|
12
|
-
edges = [
|
|
13
|
-
# DFS tree edges.
|
|
14
|
-
(1, 2),
|
|
15
|
-
(2, 3),
|
|
16
|
-
(3, 4),
|
|
17
|
-
(3, 5),
|
|
18
|
-
(5, 6),
|
|
19
|
-
(6, 7),
|
|
20
|
-
(7, 8),
|
|
21
|
-
(5, 9),
|
|
22
|
-
(9, 10),
|
|
23
|
-
# Nontree edges.
|
|
24
|
-
(1, 3),
|
|
25
|
-
(1, 4),
|
|
26
|
-
(2, 5),
|
|
27
|
-
(5, 10),
|
|
28
|
-
(6, 8),
|
|
29
|
-
]
|
|
30
|
-
G = nx.Graph(edges)
|
|
31
|
-
source = 1
|
|
32
|
-
bridges = list(nx.bridges(G, source))
|
|
33
|
-
assert bridges == [(5, 6)]
|
|
34
|
-
|
|
35
|
-
def test_barbell_graph(self):
|
|
36
|
-
# The (3, 0) barbell graph has two triangles joined by a single edge.
|
|
37
|
-
G = nx.barbell_graph(3, 0)
|
|
38
|
-
source = 0
|
|
39
|
-
bridges = list(nx.bridges(G, source))
|
|
40
|
-
assert bridges == [(2, 3)]
|
|
41
|
-
|
|
42
|
-
def test_multiedge_bridge(self):
|
|
43
|
-
edges = [
|
|
44
|
-
(0, 1),
|
|
45
|
-
(0, 2),
|
|
46
|
-
(1, 2),
|
|
47
|
-
(1, 2),
|
|
48
|
-
(2, 3),
|
|
49
|
-
(3, 4),
|
|
50
|
-
(3, 4),
|
|
51
|
-
]
|
|
52
|
-
G = nx.MultiGraph(edges)
|
|
53
|
-
assert list(nx.bridges(G)) == [(2, 3)]
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
class TestHasBridges:
|
|
57
|
-
"""Unit tests for the has bridges function."""
|
|
58
|
-
|
|
59
|
-
def test_single_bridge(self):
|
|
60
|
-
edges = [
|
|
61
|
-
# DFS tree edges.
|
|
62
|
-
(1, 2),
|
|
63
|
-
(2, 3),
|
|
64
|
-
(3, 4),
|
|
65
|
-
(3, 5),
|
|
66
|
-
(5, 6), # The only bridge edge
|
|
67
|
-
(6, 7),
|
|
68
|
-
(7, 8),
|
|
69
|
-
(5, 9),
|
|
70
|
-
(9, 10),
|
|
71
|
-
# Nontree edges.
|
|
72
|
-
(1, 3),
|
|
73
|
-
(1, 4),
|
|
74
|
-
(2, 5),
|
|
75
|
-
(5, 10),
|
|
76
|
-
(6, 8),
|
|
77
|
-
]
|
|
78
|
-
G = nx.Graph(edges)
|
|
79
|
-
assert nx.has_bridges(G) # Default root
|
|
80
|
-
assert nx.has_bridges(G, root=1) # arbitrary root in G
|
|
81
|
-
|
|
82
|
-
def test_has_bridges_raises_root_not_in_G(self):
|
|
83
|
-
G = nx.Graph()
|
|
84
|
-
G.add_nodes_from([1, 2, 3])
|
|
85
|
-
with pytest.raises(nx.NodeNotFound):
|
|
86
|
-
nx.has_bridges(G, root=6)
|
|
87
|
-
|
|
88
|
-
def test_multiedge_bridge(self):
|
|
89
|
-
edges = [
|
|
90
|
-
(0, 1),
|
|
91
|
-
(0, 2),
|
|
92
|
-
(1, 2),
|
|
93
|
-
(1, 2),
|
|
94
|
-
(2, 3),
|
|
95
|
-
(3, 4),
|
|
96
|
-
(3, 4),
|
|
97
|
-
]
|
|
98
|
-
G = nx.MultiGraph(edges)
|
|
99
|
-
assert nx.has_bridges(G)
|
|
100
|
-
# Make every edge a multiedge
|
|
101
|
-
G.add_edges_from([(0, 1), (0, 2), (2, 3)])
|
|
102
|
-
assert not nx.has_bridges(G)
|
|
103
|
-
|
|
104
|
-
def test_bridges_multiple_components(self):
|
|
105
|
-
G = nx.Graph()
|
|
106
|
-
nx.add_path(G, [0, 1, 2]) # One connected component
|
|
107
|
-
nx.add_path(G, [4, 5, 6]) # Another connected component
|
|
108
|
-
assert list(nx.bridges(G, root=4)) == [(4, 5), (5, 6)]
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
class TestLocalBridges:
|
|
112
|
-
"""Unit tests for the local_bridge function."""
|
|
113
|
-
|
|
114
|
-
@classmethod
|
|
115
|
-
def setup_class(cls):
|
|
116
|
-
cls.BB = nx.barbell_graph(4, 0)
|
|
117
|
-
cls.square = nx.cycle_graph(4)
|
|
118
|
-
cls.tri = nx.cycle_graph(3)
|
|
119
|
-
|
|
120
|
-
def test_nospan(self):
|
|
121
|
-
expected = {(3, 4), (4, 3)}
|
|
122
|
-
assert next(nx.local_bridges(self.BB, with_span=False)) in expected
|
|
123
|
-
assert set(nx.local_bridges(self.square, with_span=False)) == self.square.edges
|
|
124
|
-
assert list(nx.local_bridges(self.tri, with_span=False)) == []
|
|
125
|
-
|
|
126
|
-
def test_no_weight(self):
|
|
127
|
-
inf = float("inf")
|
|
128
|
-
expected = {(3, 4, inf), (4, 3, inf)}
|
|
129
|
-
assert next(nx.local_bridges(self.BB)) in expected
|
|
130
|
-
expected = {(u, v, 3) for u, v in self.square.edges}
|
|
131
|
-
assert set(nx.local_bridges(self.square)) == expected
|
|
132
|
-
assert list(nx.local_bridges(self.tri)) == []
|
|
133
|
-
|
|
134
|
-
def test_weight(self):
|
|
135
|
-
inf = float("inf")
|
|
136
|
-
G = self.square.copy()
|
|
137
|
-
|
|
138
|
-
G.edges[1, 2]["weight"] = 2
|
|
139
|
-
expected = {(u, v, 5 - wt) for u, v, wt in G.edges(data="weight", default=1)}
|
|
140
|
-
assert set(nx.local_bridges(G, weight="weight")) == expected
|
|
141
|
-
|
|
142
|
-
expected = {(u, v, 6) for u, v in G.edges}
|
|
143
|
-
lb = nx.local_bridges(G, weight=lambda u, v, d: 2)
|
|
144
|
-
assert set(lb) == expected
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"""Unit tests for the broadcasting module."""
|
|
2
|
-
|
|
3
|
-
import math
|
|
4
|
-
|
|
5
|
-
import pytest
|
|
6
|
-
|
|
7
|
-
import networkx as nx
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def test_example_tree_broadcast():
|
|
11
|
-
"""
|
|
12
|
-
Test the BROADCAST algorithm on the example in the paper titled: "Information Dissemination in Trees"
|
|
13
|
-
"""
|
|
14
|
-
edge_list = [
|
|
15
|
-
(0, 1),
|
|
16
|
-
(1, 2),
|
|
17
|
-
(2, 7),
|
|
18
|
-
(3, 4),
|
|
19
|
-
(5, 4),
|
|
20
|
-
(4, 7),
|
|
21
|
-
(6, 7),
|
|
22
|
-
(7, 9),
|
|
23
|
-
(8, 9),
|
|
24
|
-
(9, 13),
|
|
25
|
-
(13, 14),
|
|
26
|
-
(14, 15),
|
|
27
|
-
(14, 16),
|
|
28
|
-
(14, 17),
|
|
29
|
-
(13, 11),
|
|
30
|
-
(11, 10),
|
|
31
|
-
(11, 12),
|
|
32
|
-
(13, 18),
|
|
33
|
-
(18, 19),
|
|
34
|
-
(18, 20),
|
|
35
|
-
]
|
|
36
|
-
G = nx.Graph(edge_list)
|
|
37
|
-
b_T, b_C = nx.tree_broadcast_center(G)
|
|
38
|
-
assert b_T == 6
|
|
39
|
-
assert b_C == {13, 9}
|
|
40
|
-
# test broadcast time from specific vertex
|
|
41
|
-
assert nx.tree_broadcast_time(G, 17) == 8
|
|
42
|
-
assert nx.tree_broadcast_time(G, 3) == 9
|
|
43
|
-
# test broadcast time of entire tree
|
|
44
|
-
assert nx.tree_broadcast_time(G) == 10
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
@pytest.mark.parametrize("n", range(2, 12))
|
|
48
|
-
def test_path_broadcast(n):
|
|
49
|
-
G = nx.path_graph(n)
|
|
50
|
-
b_T, b_C = nx.tree_broadcast_center(G)
|
|
51
|
-
assert b_T == math.ceil(n / 2)
|
|
52
|
-
assert b_C == {
|
|
53
|
-
math.ceil(n / 2),
|
|
54
|
-
n // 2,
|
|
55
|
-
math.ceil(n / 2 - 1),
|
|
56
|
-
n // 2 - 1,
|
|
57
|
-
}
|
|
58
|
-
assert nx.tree_broadcast_time(G) == n - 1
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def test_empty_graph_broadcast():
|
|
62
|
-
H = nx.empty_graph(1)
|
|
63
|
-
b_T, b_C = nx.tree_broadcast_center(H)
|
|
64
|
-
assert b_T == 0
|
|
65
|
-
assert b_C == {0}
|
|
66
|
-
assert nx.tree_broadcast_time(H) == 0
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
@pytest.mark.parametrize("n", range(4, 12))
|
|
70
|
-
def test_star_broadcast(n):
|
|
71
|
-
G = nx.star_graph(n)
|
|
72
|
-
b_T, b_C = nx.tree_broadcast_center(G)
|
|
73
|
-
assert b_T == n
|
|
74
|
-
assert b_C == set(G.nodes())
|
|
75
|
-
assert nx.tree_broadcast_time(G) == b_T
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
@pytest.mark.parametrize("n", range(2, 8))
|
|
79
|
-
def test_binomial_tree_broadcast(n):
|
|
80
|
-
G = nx.binomial_tree(n)
|
|
81
|
-
b_T, b_C = nx.tree_broadcast_center(G)
|
|
82
|
-
assert b_T == n
|
|
83
|
-
assert b_C == {0, 2 ** (n - 1)}
|
|
84
|
-
assert nx.tree_broadcast_time(G) == 2 * n - 1
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
@pytest.mark.parametrize("fn", [nx.tree_broadcast_center, nx.tree_broadcast_time])
|
|
88
|
-
@pytest.mark.parametrize("graph_type", [nx.DiGraph, nx.MultiGraph, nx.MultiDiGraph])
|
|
89
|
-
def test_raises_graph_type(fn, graph_type):
|
|
90
|
-
"""Check that broadcast functions properly raise for directed and multigraph types."""
|
|
91
|
-
G = nx.path_graph(5, create_using=graph_type)
|
|
92
|
-
with pytest.raises(nx.NetworkXNotImplemented, match=r"not implemented for"):
|
|
93
|
-
fn(G)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
@pytest.mark.parametrize("fn", [nx.tree_broadcast_center, nx.tree_broadcast_time])
|
|
97
|
-
@pytest.mark.parametrize("gen", [nx.empty_graph, nx.cycle_graph])
|
|
98
|
-
def test_raises_not_tree(fn, gen):
|
|
99
|
-
"""Check that broadcast functions properly raise for nontree graphs."""
|
|
100
|
-
G = gen(5)
|
|
101
|
-
with pytest.raises(nx.NotATree, match=r"not a tree"):
|
|
102
|
-
fn(G)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def test_raises_node_not_in_G():
|
|
106
|
-
"""Check that `tree_broadcast_time` properly raises for invalid nodes."""
|
|
107
|
-
G = nx.path_graph(5)
|
|
108
|
-
with pytest.raises(nx.NodeNotFound, match=r"node.*not in G"):
|
|
109
|
-
nx.tree_broadcast_time(G, node=10)
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"""Unit tests for the chain decomposition functions."""
|
|
2
|
-
|
|
3
|
-
from itertools import cycle, islice
|
|
4
|
-
|
|
5
|
-
import pytest
|
|
6
|
-
|
|
7
|
-
import networkx as nx
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def cycles(seq):
|
|
11
|
-
"""Yields cyclic permutations of the given sequence.
|
|
12
|
-
|
|
13
|
-
For example::
|
|
14
|
-
|
|
15
|
-
>>> list(cycles("abc"))
|
|
16
|
-
[('a', 'b', 'c'), ('b', 'c', 'a'), ('c', 'a', 'b')]
|
|
17
|
-
|
|
18
|
-
"""
|
|
19
|
-
n = len(seq)
|
|
20
|
-
cycled_seq = cycle(seq)
|
|
21
|
-
for x in seq:
|
|
22
|
-
yield tuple(islice(cycled_seq, n))
|
|
23
|
-
next(cycled_seq)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def cyclic_equals(seq1, seq2):
|
|
27
|
-
"""Decide whether two sequences are equal up to cyclic permutations.
|
|
28
|
-
|
|
29
|
-
For example::
|
|
30
|
-
|
|
31
|
-
>>> cyclic_equals("xyz", "zxy")
|
|
32
|
-
True
|
|
33
|
-
>>> cyclic_equals("xyz", "zyx")
|
|
34
|
-
False
|
|
35
|
-
|
|
36
|
-
"""
|
|
37
|
-
# Cast seq2 to a tuple since `cycles()` yields tuples.
|
|
38
|
-
seq2 = tuple(seq2)
|
|
39
|
-
return any(x == tuple(seq2) for x in cycles(seq1))
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
class TestChainDecomposition:
|
|
43
|
-
"""Unit tests for the chain decomposition function."""
|
|
44
|
-
|
|
45
|
-
def assertContainsChain(self, chain, expected):
|
|
46
|
-
# A cycle could be expressed in two different orientations, one
|
|
47
|
-
# forward and one backward, so we need to check for cyclic
|
|
48
|
-
# equality in both orientations.
|
|
49
|
-
reversed_chain = list(reversed([tuple(reversed(e)) for e in chain]))
|
|
50
|
-
for candidate in expected:
|
|
51
|
-
if cyclic_equals(chain, candidate):
|
|
52
|
-
break
|
|
53
|
-
if cyclic_equals(reversed_chain, candidate):
|
|
54
|
-
break
|
|
55
|
-
else:
|
|
56
|
-
self.fail("chain not found")
|
|
57
|
-
|
|
58
|
-
def test_decomposition(self):
|
|
59
|
-
edges = [
|
|
60
|
-
# DFS tree edges.
|
|
61
|
-
(1, 2),
|
|
62
|
-
(2, 3),
|
|
63
|
-
(3, 4),
|
|
64
|
-
(3, 5),
|
|
65
|
-
(5, 6),
|
|
66
|
-
(6, 7),
|
|
67
|
-
(7, 8),
|
|
68
|
-
(5, 9),
|
|
69
|
-
(9, 10),
|
|
70
|
-
# Nontree edges.
|
|
71
|
-
(1, 3),
|
|
72
|
-
(1, 4),
|
|
73
|
-
(2, 5),
|
|
74
|
-
(5, 10),
|
|
75
|
-
(6, 8),
|
|
76
|
-
]
|
|
77
|
-
G = nx.Graph(edges)
|
|
78
|
-
expected = [
|
|
79
|
-
[(1, 3), (3, 2), (2, 1)],
|
|
80
|
-
[(1, 4), (4, 3)],
|
|
81
|
-
[(2, 5), (5, 3)],
|
|
82
|
-
[(5, 10), (10, 9), (9, 5)],
|
|
83
|
-
[(6, 8), (8, 7), (7, 6)],
|
|
84
|
-
]
|
|
85
|
-
chains = list(nx.chain_decomposition(G, root=1))
|
|
86
|
-
assert len(chains) == len(expected)
|
|
87
|
-
|
|
88
|
-
def test_barbell_graph(self):
|
|
89
|
-
# The (3, 0) barbell graph has two triangles joined by a single edge.
|
|
90
|
-
G = nx.barbell_graph(3, 0)
|
|
91
|
-
chains = list(nx.chain_decomposition(G, root=0))
|
|
92
|
-
expected = [[(0, 1), (1, 2), (2, 0)], [(3, 4), (4, 5), (5, 3)]]
|
|
93
|
-
assert len(chains) == len(expected)
|
|
94
|
-
for chain in chains:
|
|
95
|
-
self.assertContainsChain(chain, expected)
|
|
96
|
-
|
|
97
|
-
def test_disconnected_graph(self):
|
|
98
|
-
"""Test for a graph with multiple connected components."""
|
|
99
|
-
G = nx.barbell_graph(3, 0)
|
|
100
|
-
H = nx.barbell_graph(3, 0)
|
|
101
|
-
mapping = dict(zip(range(6), "abcdef"))
|
|
102
|
-
nx.relabel_nodes(H, mapping, copy=False)
|
|
103
|
-
G = nx.union(G, H)
|
|
104
|
-
chains = list(nx.chain_decomposition(G))
|
|
105
|
-
expected = [
|
|
106
|
-
[(0, 1), (1, 2), (2, 0)],
|
|
107
|
-
[(3, 4), (4, 5), (5, 3)],
|
|
108
|
-
[("a", "b"), ("b", "c"), ("c", "a")],
|
|
109
|
-
[("d", "e"), ("e", "f"), ("f", "d")],
|
|
110
|
-
]
|
|
111
|
-
assert len(chains) == len(expected)
|
|
112
|
-
for chain in chains:
|
|
113
|
-
self.assertContainsChain(chain, expected)
|
|
114
|
-
|
|
115
|
-
def test_disconnected_graph_root_node(self):
|
|
116
|
-
"""Test for a single component of a disconnected graph."""
|
|
117
|
-
G = nx.barbell_graph(3, 0)
|
|
118
|
-
H = nx.barbell_graph(3, 0)
|
|
119
|
-
mapping = dict(zip(range(6), "abcdef"))
|
|
120
|
-
nx.relabel_nodes(H, mapping, copy=False)
|
|
121
|
-
G = nx.union(G, H)
|
|
122
|
-
chains = list(nx.chain_decomposition(G, root="a"))
|
|
123
|
-
expected = [
|
|
124
|
-
[("a", "b"), ("b", "c"), ("c", "a")],
|
|
125
|
-
[("d", "e"), ("e", "f"), ("f", "d")],
|
|
126
|
-
]
|
|
127
|
-
assert len(chains) == len(expected)
|
|
128
|
-
for chain in chains:
|
|
129
|
-
self.assertContainsChain(chain, expected)
|
|
130
|
-
|
|
131
|
-
def test_chain_decomposition_root_not_in_G(self):
|
|
132
|
-
"""Test chain decomposition when root is not in graph"""
|
|
133
|
-
G = nx.Graph()
|
|
134
|
-
G.add_nodes_from([1, 2, 3])
|
|
135
|
-
with pytest.raises(nx.NodeNotFound):
|
|
136
|
-
nx.has_bridges(G, root=6)
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
|
|
3
|
-
import networkx as nx
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class TestMCS:
|
|
7
|
-
@classmethod
|
|
8
|
-
def setup_class(cls):
|
|
9
|
-
# simple graph
|
|
10
|
-
connected_chordal_G = nx.Graph()
|
|
11
|
-
connected_chordal_G.add_edges_from(
|
|
12
|
-
[
|
|
13
|
-
(1, 2),
|
|
14
|
-
(1, 3),
|
|
15
|
-
(2, 3),
|
|
16
|
-
(2, 4),
|
|
17
|
-
(3, 4),
|
|
18
|
-
(3, 5),
|
|
19
|
-
(3, 6),
|
|
20
|
-
(4, 5),
|
|
21
|
-
(4, 6),
|
|
22
|
-
(5, 6),
|
|
23
|
-
]
|
|
24
|
-
)
|
|
25
|
-
cls.connected_chordal_G = connected_chordal_G
|
|
26
|
-
|
|
27
|
-
chordal_G = nx.Graph()
|
|
28
|
-
chordal_G.add_edges_from(
|
|
29
|
-
[
|
|
30
|
-
(1, 2),
|
|
31
|
-
(1, 3),
|
|
32
|
-
(2, 3),
|
|
33
|
-
(2, 4),
|
|
34
|
-
(3, 4),
|
|
35
|
-
(3, 5),
|
|
36
|
-
(3, 6),
|
|
37
|
-
(4, 5),
|
|
38
|
-
(4, 6),
|
|
39
|
-
(5, 6),
|
|
40
|
-
(7, 8),
|
|
41
|
-
]
|
|
42
|
-
)
|
|
43
|
-
chordal_G.add_node(9)
|
|
44
|
-
cls.chordal_G = chordal_G
|
|
45
|
-
|
|
46
|
-
non_chordal_G = nx.Graph()
|
|
47
|
-
non_chordal_G.add_edges_from([(1, 2), (1, 3), (2, 4), (2, 5), (3, 4), (3, 5)])
|
|
48
|
-
cls.non_chordal_G = non_chordal_G
|
|
49
|
-
|
|
50
|
-
self_loop_G = nx.Graph()
|
|
51
|
-
self_loop_G.add_edges_from([(1, 1)])
|
|
52
|
-
cls.self_loop_G = self_loop_G
|
|
53
|
-
|
|
54
|
-
@pytest.mark.parametrize("G", (nx.DiGraph(), nx.MultiGraph(), nx.MultiDiGraph()))
|
|
55
|
-
def test_is_chordal_not_implemented(self, G):
|
|
56
|
-
with pytest.raises(nx.NetworkXNotImplemented):
|
|
57
|
-
nx.is_chordal(G)
|
|
58
|
-
|
|
59
|
-
def test_is_chordal(self):
|
|
60
|
-
assert not nx.is_chordal(self.non_chordal_G)
|
|
61
|
-
assert nx.is_chordal(self.chordal_G)
|
|
62
|
-
assert nx.is_chordal(self.connected_chordal_G)
|
|
63
|
-
assert nx.is_chordal(nx.Graph())
|
|
64
|
-
assert nx.is_chordal(nx.complete_graph(3))
|
|
65
|
-
assert nx.is_chordal(nx.cycle_graph(3))
|
|
66
|
-
assert not nx.is_chordal(nx.cycle_graph(5))
|
|
67
|
-
assert nx.is_chordal(self.self_loop_G)
|
|
68
|
-
|
|
69
|
-
def test_induced_nodes(self):
|
|
70
|
-
G = nx.generators.classic.path_graph(10)
|
|
71
|
-
Induced_nodes = nx.find_induced_nodes(G, 1, 9, 2)
|
|
72
|
-
assert Induced_nodes == {1, 2, 3, 4, 5, 6, 7, 8, 9}
|
|
73
|
-
pytest.raises(
|
|
74
|
-
nx.NetworkXTreewidthBoundExceeded, nx.find_induced_nodes, G, 1, 9, 1
|
|
75
|
-
)
|
|
76
|
-
Induced_nodes = nx.find_induced_nodes(self.chordal_G, 1, 6)
|
|
77
|
-
assert Induced_nodes == {1, 2, 4, 6}
|
|
78
|
-
pytest.raises(nx.NetworkXError, nx.find_induced_nodes, self.non_chordal_G, 1, 5)
|
|
79
|
-
|
|
80
|
-
def test_graph_treewidth(self):
|
|
81
|
-
with pytest.raises(nx.NetworkXError, match="Input graph is not chordal"):
|
|
82
|
-
nx.chordal_graph_treewidth(self.non_chordal_G)
|
|
83
|
-
|
|
84
|
-
def test_chordal_find_cliques(self):
|
|
85
|
-
cliques = {
|
|
86
|
-
frozenset([9]),
|
|
87
|
-
frozenset([7, 8]),
|
|
88
|
-
frozenset([1, 2, 3]),
|
|
89
|
-
frozenset([2, 3, 4]),
|
|
90
|
-
frozenset([3, 4, 5, 6]),
|
|
91
|
-
}
|
|
92
|
-
assert set(nx.chordal_graph_cliques(self.chordal_G)) == cliques
|
|
93
|
-
with pytest.raises(nx.NetworkXError, match="Input graph is not chordal"):
|
|
94
|
-
set(nx.chordal_graph_cliques(self.non_chordal_G))
|
|
95
|
-
with pytest.raises(nx.NetworkXError, match="Input graph is not chordal"):
|
|
96
|
-
set(nx.chordal_graph_cliques(self.self_loop_G))
|
|
97
|
-
|
|
98
|
-
def test_chordal_find_cliques_path(self):
|
|
99
|
-
G = nx.path_graph(10)
|
|
100
|
-
cliqueset = nx.chordal_graph_cliques(G)
|
|
101
|
-
for u, v in G.edges():
|
|
102
|
-
assert frozenset([u, v]) in cliqueset or frozenset([v, u]) in cliqueset
|
|
103
|
-
|
|
104
|
-
def test_chordal_find_cliquesCC(self):
|
|
105
|
-
cliques = {frozenset([1, 2, 3]), frozenset([2, 3, 4]), frozenset([3, 4, 5, 6])}
|
|
106
|
-
cgc = nx.chordal_graph_cliques
|
|
107
|
-
assert set(cgc(self.connected_chordal_G)) == cliques
|
|
108
|
-
|
|
109
|
-
def test_complete_to_chordal_graph(self):
|
|
110
|
-
fgrg = nx.fast_gnp_random_graph
|
|
111
|
-
test_graphs = [
|
|
112
|
-
nx.barbell_graph(6, 2),
|
|
113
|
-
nx.cycle_graph(15),
|
|
114
|
-
nx.wheel_graph(20),
|
|
115
|
-
nx.grid_graph([10, 4]),
|
|
116
|
-
nx.ladder_graph(15),
|
|
117
|
-
nx.star_graph(5),
|
|
118
|
-
nx.bull_graph(),
|
|
119
|
-
fgrg(20, 0.3, seed=1),
|
|
120
|
-
]
|
|
121
|
-
for G in test_graphs:
|
|
122
|
-
H, a = nx.complete_to_chordal_graph(G)
|
|
123
|
-
assert nx.is_chordal(H)
|
|
124
|
-
assert len(a) == H.number_of_nodes()
|
|
125
|
-
if nx.is_chordal(G):
|
|
126
|
-
assert G.number_of_edges() == H.number_of_edges()
|
|
127
|
-
assert set(a.values()) == {0}
|
|
128
|
-
else:
|
|
129
|
-
assert len(set(a.values())) == H.number_of_nodes()
|