190 typename GT::Node * start =
nullptr;
195 typename GT::Node * p = it.get_curr();
198 if (start ==
nullptr)
205 if (start ==
nullptr)
223 typename GT::Node * adj = it.get_tgt_node_ne();
250 typename GT::Node * start =
nullptr;
255 typename GT::Node * p = it.get_curr();
258 if (start ==
nullptr)
283 typename GT::Node * adj = it.get_tgt_node_ne();
366 typename GT::Node * p = it.get_curr();
500 typename GT::Node * p = it.get_curr();
577 typename GT::Node * start =
nullptr;
589 typename GT::Node * p = it.get_curr();
592 if (start ==
nullptr)
604 typename GT::Node * p = it.get_curr();
607 if (start ==
nullptr)
648 typename GT::Arc * arc = it.get_curr();
710 typename GT::Arc * arc = it.get_curr();
801 if (start ==
nullptr)
824 return (*
this)(g).path;
835 Result result = (*this)(g);
856 for (
auto arc : result.
path)
void append(Dlink *node) noexcept
Insert node before this.
Dynamic singly linked list with functional programming support.
T & insert(const T &item)
Insert a new item by copy.
T & get_first() const
Return the first item of the list.
void next_ne() noexcept
Advances the iterator to the next filtered element (noexcept version).
Finds and constructs an Eulerian path or cycle using Hierholzer's algorithm.
GT::Node * find_start_vertex(GT &g, Eulerian_Type type)
Find starting vertex for Eulerian path/cycle.
DynList< typename GT::Node * > find_node_sequence(GT &g)
Get the node sequence of the Eulerian path/cycle.
DynList< typename GT::Arc * > find_path(GT &g)
Get only the arc list (convenience method).
DynList< typename GT::Arc * > hierholzer_undirected(GT &g, typename GT::Node *start)
Hierholzer's algorithm for undirected graphs.
DynList< typename GT::Arc * > hierholzer_directed(GT &g, typename GT::Node *start)
Hierholzer's algorithm for directed graphs.
Find_Eulerian_Path(SN &&__sn=SN(), SA &&__sa=SA())
Construct an Eulerian path finder with optional filters.
Result operator()(GT &g)
Find an Eulerian path or cycle in the graph.
constexpr bool is_empty() const noexcept
Return true if list is empty.
Filtered iterator on the nodes of a graph.
Tests whether a graph or digraph is Eulerian.
Eulerian_Type compute(GT &g)
Compute detailed Eulerian classification.
bool is_strongly_connected(GT &g)
Check strong connectivity of digraph using Kosaraju-like approach.
bool is_connected(GT &g)
Check connectivity of undirected graph using DFS.
bool operator()(GT &g)
Test if a graph has an Eulerian cycle.
Eulerian_Type analyze_digraph(GT &g)
Analyze Eulerian properties of a directed graph.
Test_Eulerian(SN &&__sn=SN(), SA &&__sa=SA())
Construct an Eulerian tester with optional filters.
bool test_degree_only(GT &g)
Check only degree conditions (without connectivity check).
Eulerian_Type analyze_graph(GT &g)
Analyze Eulerian properties of an undirected graph.
bool has_eulerian_path(GT &g)
Test if a graph has an Eulerian path.
void reset_arcs() const
Reset all the arcs of graph (the control bits, the state, the counter and the cookie)
Node * get_src_node(Arc *arc) const noexcept
Return the source node of arc (only 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.
void reset_counter_nodes() const noexcept
Reset all the counters to zero for all the nodes of graph.
Node * get_connected_node(Arc *arc, Node *node) const noexcept
Return the adjacent node to node through arc.
constexpr size_t get_num_arcs() const noexcept
void reset_nodes() const
Reset all the nodes of graph (the control bits, the state, the counter and the cookie)
Node * get_tgt_node(Arc *arc) const noexcept
Return the target node of arc (only for directed graphs)
List_Graph< Graph_Node< int >, Graph_Arc< int > > GT
DynArray< Graph::Node * > nodes
#define NODE_COUNTER(p)
Get the counter of a node.
#define ARC_BITS(p)
Return the control bits of arc p.
#define IS_ARC_VISITED(p, bit)
Determine whether the bit field is or not set to one.
#define NODE_BITS(p)
Get the control bits of a node.
Main namespace for Aleph-w library functions.
Eulerian_Type
Enumeration for Eulerian graph classification.
@ Cycle
Graph has an Eulerian cycle.
@ None
Graph is not Eulerian.
@ Path
Graph has an Eulerian path but not a cycle.
bool diff(const C1 &c1, const C2 &c2, Eq e=Eq())
Check if two containers differ.
void next()
Advance all underlying iterators (bounds-checked).
DynList< T > maps(const C &c, Op op)
Classic map operation.
Filtered iterator on all the arcs of a graph.
Default filter for filtered iterators on arcs.
Default filter for the graph nodes.
Result type: path and its classification.
Eulerian_Type type
Classification (Cycle, Path, or None)
DynList< typename GT::Arc * > path
The Eulerian path/cycle as arc list.
Arc of graph implemented with double-linked adjacency lists.
Filtered iterator of adjacent arcs of a node.
Represents a missing value.
Generic graph and digraph implementations.
Utility algorithms and operations for graphs.