96namespace hamiltonian_detail
106 template <
class GT,
class SA>
123 Node * p = it.get_curr();
124 auto & to =
out.find(p);
126 if (
Node * q = a.get_tgt_node_ne(); q != p
and to.insert(q) !=
nullptr)
181template <AlephGraph
GT,
214 typename GT::Node * src = i.get_curr();
220 for (; j.has_curr(); j.
next_ne())
222 typename GT::Node * tgt = j.get_curr();
225 if (simple.
joined(src, tgt))
264 typename GT::Node * src = i.get_curr();
267 typename GT::Node * tgt = j.get_curr();
268 if (src == tgt or simple.
joined(src, tgt))
354template <AlephGraph
GT,
381 const size_t min_degree = (n + 1) / 2;
385 if (simple.
degree(it.get_curr()) < min_degree)
408 const size_t min_degree = (n + 1) / 2;
414 typename GT::Node * p = it.get_curr();
476 size_t min_deg = std::numeric_limits<size_t>::max();
477 typename GT::Node * min_node =
nullptr;
482 typename GT::Node * p = it.get_curr();
483 size_t deg = simple.
degree(p);
485 deg = std::min(deg, simple.
in_degree(p));
493 return {min_deg, min_node};
C++20 concepts for the protocol shared by graph algorithms.
List_Graph< Graph_Node< Node_Info >, Graph_Arc< Arc_Info > > GT
Generic key-value map implemented on top of a binary search tree.
Pair * insert(const Key &key, const Data &data)
Insert a key-value pair.
Data & find(const Key &key)
Find the value associated with key.
Dynamic set backed by balanced binary search trees with automatic memory management.
void next_ne() noexcept(shows_ne)
Advances the iterator to the next filtered element, as next() does.
A filter that an algorithm object keeps: one given as an lvalue is used where it is,...
Graph_Node< Node_Info > Node
The graph type.
Filtered iterator on the nodes of a graph.
Tests Dirac's sufficient condition for Hamiltonian graphs.
bool test_graph(GT &g)
Test Dirac's condition for undirected graphs.
size_t min_required_degree(GT &g) const
Get the minimum degree required by Dirac's condition.
bool test_digraph(GT &g)
Test Dirac-like condition for directed graphs.
std::pair< size_t, typename GT::Node * > find_min_degree_vertex(GT &g)
Find the vertex with minimum degree.
Test_Dirac_Condition(SN &&__sn=SN(), SA &&__sa=SA())
Construct a Dirac condition tester.
bool operator()(GT &g)
Test if a graph satisfies Dirac's Hamiltonian condition.
Tests Ore's sufficient condition for Hamiltonian graphs.
bool test_graph(GT &g)
Test Ore's condition for undirected graphs.
bool operator()(GT &g)
Test if a graph satisfies Ore's Hamiltonian condition.
Test_Hamiltonian_Sufficiency(SN &&__sn=SN(), SA &&__sa=SA())
Construct a Hamiltonian sufficiency tester.
bool test_digraph(GT &g)
Test Ore-like condition for directed graphs.
constexpr size_t get_num_nodes() const noexcept
Return the total of nodes of graph.
bool is_digraph() const noexcept
Return true if the graph this is directed.
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
Default filter for filtered iterators on arcs.
Default filter for the graph nodes.
Filtered iterator of adjacent arcs of a node.
The simple graph that the arcs that a filter shows give.
DynMapTree< Node *, DynSetTree< Node * > > out
bool joined(Node *p, Node *q) const
Whether p and q are joined, or p goes to q in a digraph.
size_t degree(Node *p) const
The neighbors of p, or the nodes that it goes to in a digraph.
DynMapTree< Node *, size_t > in
size_t in_degree(Node *p) const
The nodes that come to p, in a digraph.
Simple_Graph(const GT &g, SA &sa)
Dynamic key-value map based on balanced binary search trees.
Dynamic set implementations based on balanced binary search trees.
Generic graph and digraph implementations.