|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Determines whether a graph contains cycles. More...
#include <tpl_test_acyclique.H>
Public Member Functions | |
| Has_Cycle (SA &&__sa=SA()) | |
| Has_Cycle (SA &__sa) | |
| bool | operator() (GT &g) const |
| Invokes the cycle-existence test. | |
| bool | operator() (GT &g, size_t num_arcs) const |
| Invokes the cycle-existence test, with the number of arcs that the filter shows. | |
Private Attributes | |
| Kept_Filter< SA > | sa |
Determines whether a graph contains cycles.
Has_Cycle performs a depth-first search on graph g, starting from a node, and checks whether the graph contains a cycle.
The class takes two template parameters:
The class uses the Test_Cycle bit and resets it at the beginning of the algorithm to mark already visited nodes and arcs.
Definition at line 233 of file tpl_test_acyclique.H.
|
inline |
Definition at line 238 of file tpl_test_acyclique.H.
|
inline |
Definition at line 242 of file tpl_test_acyclique.H.
|
inline |
Invokes the cycle-existence test.
With the default filter, which shows all the arcs, a graph with nodes and with as many arcs as nodes, or more, has a cycle, which is answered without a search; with another filter, which may hide arcs, the graph is searched. A loop is a cycle, and so are two arcs between the same nodes.
| [in] | g | the graph to test. |
| domain_error | if g is a digraph. |
Definition at line 262 of file tpl_test_acyclique.H.
References Aleph::Has_Cycle< GT, SA >::sa.
|
inline |
Invokes the cycle-existence test, with the number of arcs that the filter shows.
A forest has fewer arcs than nodes, so that a graph with nodes and with num_arcs as large as their number, or larger, has a cycle, which is answered without a search. A loop is a cycle, and so are two arcs between the same nodes.
| [in] | g | the graph to test. |
| [in] | num_arcs | number of arcs of g that the filter shows. |
| domain_error | if g is a digraph. |
Definition at line 284 of file tpl_test_acyclique.H.
References Aleph::Has_Cycle< GT, SA >::sa.
|
private |
Definition at line 235 of file tpl_test_acyclique.H.
Referenced by Aleph::Has_Cycle< GT, SA >::operator()(), and Aleph::Has_Cycle< GT, SA >::operator()().