Skip to content

Commit 4b16ae1

Browse files
committed
Add a way to list the base non-transitive edges in TransitiveRelation
1 parent 479cc7a commit 4b16ae1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/librustc_data_structures/transitive_relation.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,14 @@ impl<T: Clone + Debug + Eq + Hash> TransitiveRelation<T> {
373373
}
374374
matrix
375375
}
376+
377+
/// Lists all the base edges in the graph: the initial _non-transitive_ set of element
378+
/// relations, which will be later used as the basis for the transitive closure computation.
379+
pub fn base_edges(&self) -> impl Iterator<Item=(&T, &T)> {
380+
self.edges
381+
.iter()
382+
.map(move |edge| (&self.elements[edge.source.0], &self.elements[edge.target.0]))
383+
}
376384
}
377385

378386
/// Pare down is used as a step in the LUB computation. It edits the

0 commit comments

Comments
 (0)