|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Tests Ore's sufficient condition for Hamiltonian graphs. More...
#include <hamiltonian.H>
Public Member Functions | |
| Test_Hamiltonian_Sufficiency (SN &&__sn=SN(), SA &&__sa=SA()) | |
| Construct a Hamiltonian sufficiency tester. | |
| bool | operator() (GT &g) |
| Test if a graph satisfies Ore's Hamiltonian condition. | |
Private Member Functions | |
| bool | test_graph (GT &g) |
| Test Ore's condition for undirected graphs. | |
| bool | test_digraph (GT &g) |
| Test Ore-like condition for directed graphs. | |
Private Attributes | |
| Kept_Filter< SN > | sn |
| Kept_Filter< SA > | sa |
Tests Ore's sufficient condition for Hamiltonian graphs.
This class tests whether a graph satisfies Ore's theorem, which provides a sufficient (but not necessary) condition for a graph to be Hamiltonian.
For an undirected graph G with n ≥ 3 vertices: if for every pair of non-adjacent vertices u and v, deg(u) + deg(v) ≥ n, then G has a Hamiltonian cycle.
For directed graphs, the condition is extended to in-degree + out-degree.
| GT | Graph type (List_Graph, Array_Graph, etc.) |
| SN | Node filter for iteration (default: show all nodes) |
| SA | Arc filter for iteration (default: show all arcs) |
Definition at line 184 of file hamiltonian.H.
|
inline |
Construct a Hamiltonian sufficiency tester.
| __sn | Node filter (default: show all nodes) |
| __sa | Arc filter (default: show all arcs) |
Definition at line 288 of file hamiltonian.H.
|
inline |
Test if a graph satisfies Ore's Hamiltonian condition.
Automatically detects directed vs undirected and applies the appropriate test.
| g | Graph to test |
Definition at line 306 of file hamiltonian.H.
References GraphCommon< GT, Node, Arc >::is_digraph(), Aleph::Test_Hamiltonian_Sufficiency< GT, SN, SA >::test_digraph(), and test_graph().
|
inlineprivate |
Test Ore-like condition for directed graphs.
For digraphs, checks that for each pair (u,v) without arc u→v: out-deg(u) + in-deg(v) ≥ n, in the simple digraph of the arcs that the filter shows
This is Woodall's theorem, the extension of Ore's to digraphs.
| g | Directed graph to test |
Definition at line 249 of file hamiltonian.H.
References Aleph::hamiltonian_detail::Simple_Graph< GT, SA >::degree(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::hamiltonian_detail::Simple_Graph< GT, SA >::in_degree(), GraphCommon< GT, Node, Arc >::is_digraph(), Aleph::hamiltonian_detail::Simple_Graph< GT, SA >::joined(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), Aleph::Test_Hamiltonian_Sufficiency< GT, SN, SA >::sa, and Aleph::Test_Hamiltonian_Sufficiency< GT, SN, SA >::sn.
Referenced by Aleph::Test_Hamiltonian_Sufficiency< GT, SN, SA >::operator()().
|
inlineprivate |
Test Ore's condition for undirected graphs.
Checks that for all pairs of NON-ADJACENT vertices u, v: deg(u) + deg(v) ≥ n, in the simple graph of the arcs that the filter shows
| g | Undirected graph to test |
Definition at line 199 of file hamiltonian.H.
References Aleph::hamiltonian_detail::Simple_Graph< GT, SA >::degree(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::is_digraph(), Aleph::hamiltonian_detail::Simple_Graph< GT, SA >::joined(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), Aleph::Test_Hamiltonian_Sufficiency< GT, SN, SA >::sa, and Aleph::Test_Hamiltonian_Sufficiency< GT, SN, SA >::sn.
|
private |
Definition at line 187 of file hamiltonian.H.
Referenced by Aleph::Test_Hamiltonian_Sufficiency< GT, SN, SA >::test_digraph(), and Aleph::Test_Hamiltonian_Sufficiency< GT, SN, SA >::test_graph().
|
private |
Definition at line 186 of file hamiltonian.H.
Referenced by Aleph::Test_Hamiltonian_Sufficiency< GT, SN, SA >::test_digraph(), and Aleph::Test_Hamiltonian_Sufficiency< GT, SN, SA >::test_graph().