Skip to content

Commit

Permalink
Improve type params docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lmondada committed Jul 28, 2023
1 parent f8a53db commit 38d02f5
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/algorithms/toposort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ use std::{collections::VecDeque, fmt::Debug, iter::FusedIterator};

/// Returns an iterator over a [`LinkView`] in topological order.
///
/// ## Type parameters
/// - `G`: The graph type implementing [`LinkView`],
/// - `Map`: Internal workspace for graph traversal (see below).
///
/// The `Map` type parameter specifies the type of the secondary map that is
/// used to store the dominator tree data. The default is [`BitVec`], which is
/// efficient for full graph traversal, i.e. when all nodes are reachable from
Expand All @@ -26,13 +30,14 @@ use std::{collections::VecDeque, fmt::Debug, iter::FusedIterator};
/// let topo: TopoSort<_> = toposort(&graph, [node_a], Direction::Outgoing);
/// assert_eq!(topo.collect::<Vec<_>>(), [node_a, node_b]);
/// ```
pub fn toposort<'f, Map, G: LinkView>(
pub fn toposort<G, Map>(
graph: G,
source: impl IntoIterator<Item = NodeIndex>,
direction: Direction,
) -> TopoSort<'f, G, Map>
) -> TopoSort<'static, G, Map>
where
Map: SecondaryMap<PortIndex, bool>,
G: LinkView,
{
TopoSort::new(graph, source, direction, None, None)
}
Expand All @@ -43,6 +48,11 @@ where
///
/// If the filter closures return false for a node or port, it is skipped.
///
/// ## Type parameters
/// - `'f`: The lifetime of the filter closures,
/// - `G`: The graph type implementing [`LinkView`],
/// - `Map`: Internal workspace for graph traversal (see below).
///
/// The `Map` type parameter specifies the type of the secondary map that is
/// used to store the dominator tree data. The default is [`BitVec`], which is
/// efficient for full graph traversal, i.e. when all nodes are reachable from
Expand Down Expand Up @@ -75,7 +85,7 @@ where
/// );
/// assert_eq!(topo.collect::<Vec<_>>(), [node_a, node_b]);
/// ```
pub fn toposort_filtered<'f, Map, G>(
pub fn toposort_filtered<'f, G, Map>(
graph: G,
source: impl IntoIterator<Item = NodeIndex>,
direction: Direction,
Expand Down

0 comments on commit 38d02f5

Please sign in to comment.