MCPcopy Create free account
hub / github.com/douchuan/algorithm / DepthFirstOrders

Class DepthFirstOrders

src/graph/directed/order.rs:10–18  ·  view source on GitHub ↗

The DepthFirstOrder represents a data type for determining depth-first search ordering of the vertices in a digraph or edge-weighted digraph, including preorder, postorder, and reverse postorder. This implementation uses depth-first search.

Source from the content-addressed store, hash-verified

8/// postorder.
9/// This implementation uses depth-first search.
10pub struct DepthFirstOrders {
11 pre_order: Vec<usize>, // vertices in preorder
12 pre: Vec<usize>, // pre[v] = preorder number of v
13 pre_counter: usize, // counter or preorder numbering
14 post_order: Vec<usize>, // vertices in postorder
15 post: Vec<usize>, // post[v] = postorder number of v
16 post_counter: usize, // counter for postorder numbering
17 marked: Vec<bool>, // marked[v] = has v been marked in dfs?
18}
19
20impl DepthFirstOrders {
21 /// Returns the vertices in preorder.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected