1- use super :: { DirectedGraph , WithNumNodes , WithStartNode , WithSuccessors } ;
1+ use super :: { DirectedGraph , StartNode , Successors } ;
22use rustc_index:: bit_set:: BitSet ;
33use rustc_index:: { IndexSlice , IndexVec } ;
44use std:: ops:: ControlFlow ;
55
66#[ cfg( test) ]
77mod tests;
88
9- pub fn post_order_from < G : DirectedGraph + WithSuccessors + WithNumNodes > (
9+ pub fn post_order_from < G : DirectedGraph + Successors > (
1010 graph : & G ,
1111 start_node : G :: Node ,
1212) -> Vec < G :: Node > {
1313 post_order_from_to ( graph, start_node, None )
1414}
1515
16- pub fn post_order_from_to < G : DirectedGraph + WithSuccessors + WithNumNodes > (
16+ pub fn post_order_from_to < G : DirectedGraph + Successors > (
1717 graph : & G ,
1818 start_node : G :: Node ,
1919 end_node : Option < G :: Node > ,
@@ -27,7 +27,7 @@ pub fn post_order_from_to<G: DirectedGraph + WithSuccessors + WithNumNodes>(
2727 result
2828}
2929
30- fn post_order_walk < G : DirectedGraph + WithSuccessors + WithNumNodes > (
30+ fn post_order_walk < G : DirectedGraph + Successors > (
3131 graph : & G ,
3232 node : G :: Node ,
3333 result : & mut Vec < G :: Node > ,
@@ -60,7 +60,7 @@ fn post_order_walk<G: DirectedGraph + WithSuccessors + WithNumNodes>(
6060 }
6161}
6262
63- pub fn reverse_post_order < G : DirectedGraph + WithSuccessors + WithNumNodes > (
63+ pub fn reverse_post_order < G : DirectedGraph + Successors > (
6464 graph : & G ,
6565 start_node : G :: Node ,
6666) -> Vec < G :: Node > {
@@ -72,7 +72,7 @@ pub fn reverse_post_order<G: DirectedGraph + WithSuccessors + WithNumNodes>(
7272/// A "depth-first search" iterator for a directed graph.
7373pub struct DepthFirstSearch < ' graph , G >
7474where
75- G : ?Sized + DirectedGraph + WithNumNodes + WithSuccessors ,
75+ G : ?Sized + DirectedGraph + Successors ,
7676{
7777 graph : & ' graph G ,
7878 stack : Vec < G :: Node > ,
8181
8282impl < ' graph , G > DepthFirstSearch < ' graph , G >
8383where
84- G : ?Sized + DirectedGraph + WithNumNodes + WithSuccessors ,
84+ G : ?Sized + DirectedGraph + Successors ,
8585{
8686 pub fn new ( graph : & ' graph G ) -> Self {
8787 Self { graph, stack : vec ! [ ] , visited : BitSet :: new_empty ( graph. num_nodes ( ) ) }
@@ -127,7 +127,7 @@ where
127127
128128impl < G > std:: fmt:: Debug for DepthFirstSearch < ' _ , G >
129129where
130- G : ?Sized + DirectedGraph + WithNumNodes + WithSuccessors ,
130+ G : ?Sized + DirectedGraph + Successors ,
131131{
132132 fn fmt ( & self , fmt : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
133133 let mut f = fmt. debug_set ( ) ;
@@ -140,7 +140,7 @@ where
140140
141141impl < G > Iterator for DepthFirstSearch < ' _ , G >
142142where
143- G : ?Sized + DirectedGraph + WithNumNodes + WithSuccessors ,
143+ G : ?Sized + DirectedGraph + Successors ,
144144{
145145 type Item = G :: Node ;
146146
@@ -201,7 +201,7 @@ struct Event<N> {
201201/// [CLR]: https://en.wikipedia.org/wiki/Introduction_to_Algorithms
202202pub struct TriColorDepthFirstSearch < ' graph , G >
203203where
204- G : ?Sized + DirectedGraph + WithNumNodes + WithSuccessors ,
204+ G : ?Sized + DirectedGraph + Successors ,
205205{
206206 graph : & ' graph G ,
207207 stack : Vec < Event < G :: Node > > ,
@@ -211,7 +211,7 @@ where
211211
212212impl < ' graph , G > TriColorDepthFirstSearch < ' graph , G >
213213where
214- G : ?Sized + DirectedGraph + WithNumNodes + WithSuccessors ,
214+ G : ?Sized + DirectedGraph + Successors ,
215215{
216216 pub fn new ( graph : & ' graph G ) -> Self {
217217 TriColorDepthFirstSearch {
@@ -278,7 +278,7 @@ where
278278
279279impl < G > TriColorDepthFirstSearch < ' _ , G >
280280where
281- G : ?Sized + DirectedGraph + WithNumNodes + WithSuccessors + WithStartNode ,
281+ G : ?Sized + DirectedGraph + Successors + StartNode ,
282282{
283283 /// Performs a depth-first search, starting from `G::start_node()`.
284284 ///
0 commit comments