1
- use super :: { DirectedGraph , WithNumNodes , WithStartNode , WithSuccessors } ;
1
+ use super :: { DirectedGraph , StartNode , Successors } ;
2
2
use rustc_index:: bit_set:: BitSet ;
3
3
use rustc_index:: { IndexSlice , IndexVec } ;
4
4
use std:: ops:: ControlFlow ;
5
5
6
6
#[ cfg( test) ]
7
7
mod tests;
8
8
9
- pub fn post_order_from < G : DirectedGraph + WithSuccessors + WithNumNodes > (
9
+ pub fn post_order_from < G : DirectedGraph + Successors > (
10
10
graph : & G ,
11
11
start_node : G :: Node ,
12
12
) -> Vec < G :: Node > {
13
13
post_order_from_to ( graph, start_node, None )
14
14
}
15
15
16
- pub fn post_order_from_to < G : DirectedGraph + WithSuccessors + WithNumNodes > (
16
+ pub fn post_order_from_to < G : DirectedGraph + Successors > (
17
17
graph : & G ,
18
18
start_node : G :: Node ,
19
19
end_node : Option < G :: Node > ,
@@ -27,7 +27,7 @@ pub fn post_order_from_to<G: DirectedGraph + WithSuccessors + WithNumNodes>(
27
27
result
28
28
}
29
29
30
- fn post_order_walk < G : DirectedGraph + WithSuccessors + WithNumNodes > (
30
+ fn post_order_walk < G : DirectedGraph + Successors > (
31
31
graph : & G ,
32
32
node : G :: Node ,
33
33
result : & mut Vec < G :: Node > ,
@@ -60,7 +60,7 @@ fn post_order_walk<G: DirectedGraph + WithSuccessors + WithNumNodes>(
60
60
}
61
61
}
62
62
63
- pub fn reverse_post_order < G : DirectedGraph + WithSuccessors + WithNumNodes > (
63
+ pub fn reverse_post_order < G : DirectedGraph + Successors > (
64
64
graph : & G ,
65
65
start_node : G :: Node ,
66
66
) -> Vec < G :: Node > {
@@ -72,7 +72,7 @@ pub fn reverse_post_order<G: DirectedGraph + WithSuccessors + WithNumNodes>(
72
72
/// A "depth-first search" iterator for a directed graph.
73
73
pub struct DepthFirstSearch < ' graph , G >
74
74
where
75
- G : ?Sized + DirectedGraph + WithNumNodes + WithSuccessors ,
75
+ G : ?Sized + DirectedGraph + Successors ,
76
76
{
77
77
graph : & ' graph G ,
78
78
stack : Vec < G :: Node > ,
81
81
82
82
impl < ' graph , G > DepthFirstSearch < ' graph , G >
83
83
where
84
- G : ?Sized + DirectedGraph + WithNumNodes + WithSuccessors ,
84
+ G : ?Sized + DirectedGraph + Successors ,
85
85
{
86
86
pub fn new ( graph : & ' graph G ) -> Self {
87
87
Self { graph, stack : vec ! [ ] , visited : BitSet :: new_empty ( graph. num_nodes ( ) ) }
@@ -127,7 +127,7 @@ where
127
127
128
128
impl < G > std:: fmt:: Debug for DepthFirstSearch < ' _ , G >
129
129
where
130
- G : ?Sized + DirectedGraph + WithNumNodes + WithSuccessors ,
130
+ G : ?Sized + DirectedGraph + Successors ,
131
131
{
132
132
fn fmt ( & self , fmt : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
133
133
let mut f = fmt. debug_set ( ) ;
@@ -140,7 +140,7 @@ where
140
140
141
141
impl < G > Iterator for DepthFirstSearch < ' _ , G >
142
142
where
143
- G : ?Sized + DirectedGraph + WithNumNodes + WithSuccessors ,
143
+ G : ?Sized + DirectedGraph + Successors ,
144
144
{
145
145
type Item = G :: Node ;
146
146
@@ -201,7 +201,7 @@ struct Event<N> {
201
201
/// [CLR]: https://en.wikipedia.org/wiki/Introduction_to_Algorithms
202
202
pub struct TriColorDepthFirstSearch < ' graph , G >
203
203
where
204
- G : ?Sized + DirectedGraph + WithNumNodes + WithSuccessors ,
204
+ G : ?Sized + DirectedGraph + Successors ,
205
205
{
206
206
graph : & ' graph G ,
207
207
stack : Vec < Event < G :: Node > > ,
@@ -211,7 +211,7 @@ where
211
211
212
212
impl < ' graph , G > TriColorDepthFirstSearch < ' graph , G >
213
213
where
214
- G : ?Sized + DirectedGraph + WithNumNodes + WithSuccessors ,
214
+ G : ?Sized + DirectedGraph + Successors ,
215
215
{
216
216
pub fn new ( graph : & ' graph G ) -> Self {
217
217
TriColorDepthFirstSearch {
@@ -278,7 +278,7 @@ where
278
278
279
279
impl < G > TriColorDepthFirstSearch < ' _ , G >
280
280
where
281
- G : ?Sized + DirectedGraph + WithNumNodes + WithSuccessors + WithStartNode ,
281
+ G : ?Sized + DirectedGraph + Successors + StartNode ,
282
282
{
283
283
/// Performs a depth-first search, starting from `G::start_node()`.
284
284
///
0 commit comments