@@ -21,28 +21,36 @@ mod tests;
21
21
pub struct Sccs < N : Idx , S : Idx > {
22
22
/// For each node, what is the SCC index of the SCC to which it
23
23
/// belongs.
24
- pub scc_indices : IndexVec < N , S > ,
24
+ scc_indices : IndexVec < N , S > ,
25
25
26
26
/// Data about each SCC.
27
- pub scc_data : SccData < S > ,
27
+ scc_data : SccData < S > ,
28
28
}
29
29
30
30
pub struct SccData < S : Idx > {
31
31
/// For each SCC, the range of `all_successors` where its
32
32
/// successors can be found.
33
- pub ranges : IndexVec < S , Range < usize > > ,
33
+ ranges : IndexVec < S , Range < usize > > ,
34
34
35
35
/// Contains the successors for all the Sccs, concatenated. The
36
36
/// range of indices corresponding to a given SCC is found in its
37
37
/// SccData.
38
- pub all_successors : Vec < S > ,
38
+ all_successors : Vec < S > ,
39
39
}
40
40
41
41
impl < N : Idx , S : Idx + Ord > Sccs < N , S > {
42
42
pub fn new ( graph : & ( impl DirectedGraph < Node = N > + WithNumNodes + WithSuccessors ) ) -> Self {
43
43
SccsConstruction :: construct ( graph)
44
44
}
45
45
46
+ pub fn scc_indices ( & self ) -> & IndexVec < N , S > {
47
+ & self . scc_indices
48
+ }
49
+
50
+ pub fn scc_data ( & self ) -> & SccData < S > {
51
+ & self . scc_data
52
+ }
53
+
46
54
/// Returns the number of SCCs in the graph.
47
55
pub fn num_sccs ( & self ) -> usize {
48
56
self . scc_data . len ( )
@@ -115,6 +123,14 @@ impl<S: Idx> SccData<S> {
115
123
self . ranges . len ( )
116
124
}
117
125
126
+ pub fn ranges ( & self ) -> & IndexVec < S , Range < usize > > {
127
+ & self . ranges
128
+ }
129
+
130
+ pub fn all_successors ( & self ) -> & Vec < S > {
131
+ & self . all_successors
132
+ }
133
+
118
134
/// Returns the successors of the given SCC.
119
135
fn successors ( & self , scc : S ) -> & [ S ] {
120
136
// Annoyingly, `range` does not implement `Copy`, so we have
0 commit comments