Home | Documentation | Download | Platforms | Projects | Mailing Lists | Version History
Public Member Functions | |
topsort () | |
int | top_num (const node &n) const |
bool | is_acyclic () const |
topsort_iterator | top_order_begin () const |
topsort_iterator | top_order_end () const |
virtual int | check (graph &G) |
virtual void | reset () |
virtual void | init_handler (graph &G) |
Handler called before the start of DFS. | |
virtual void | leave_handler (graph &, node &, node &) |
Handler called after all the adjacent edges of n have been examined. | |
virtual void | old_adj_node_handler (graph &, edge &, node &) |
Handler called when a already marked node n connected to the actual node by e is found during the search of all adjacent edges of the actual node. |
Assigns to each node n
a number top_num
such that for every edge (u,v)
top_num[u]
< top_num[v]
, if possible, i.e. iff the directed graph is acyclic.
Similar to the testing of biconnectivity, which extends DFS to calculate low-numbers, the topsort-algorithm extends DFS to calculate the new numbering (and thus to test whether such a numbering is possible).
In order to traverse all the nodes in the order of its top-numbers, a new iterator, topsort_iterator
is provided.
topsort::topsort | ( | ) | [inline] |
int topsort::top_num | ( | const node & | n | ) | const [inline] |
bool topsort::is_acyclic | ( | ) | const [inline] |
topsort_iterator topsort::top_order_begin | ( | ) | const [inline] |
Iterate through nodes in topsort-order.
topsort_iterator topsort::top_order_end | ( | ) | const [inline] |
Iterate through nodes in topsort-order.
virtual int topsort::check | ( | graph & | G | ) | [virtual] |
Preconditions:
G
is directed.
<code>G</code> | graph. |
algorithm::GTL_OK
if topsort may be applied to G
. Reimplemented from dfs.
virtual void topsort::reset | ( | ) | [virtual] |
virtual void topsort::init_handler | ( | graph & | G | ) | [virtual] |
Handler called before the start of DFS.
G | graph for which DFS was invoked. |
Reimplemented from dfs.
Handler called after all the adjacent edges of n have been examined.
G | graph for which DFS was invoked. | |
n | actual node. | |
f | predecessor. |
Reimplemented from dfs.
Handler called when a already marked node n connected to the actual node by e is found during the search of all adjacent edges of the actual node.
G | graph for which DFS was invoked. | |
e | edge connecting the actual node to the old one. | |
n | used node. |
Reimplemented from dfs.
University of Passau - FMI - Theoretical Computer Science