pub fn valid_topological_sorting<I, NodeAttr, ArcAttr, NodeStore, ArcStore>(
network: &Network<I, NodeAttr, ArcAttr, NodeStore, ArcStore>,
ordering: &[I],
) -> boolwhere
ArcStore: ArcStorage<I, ArcAttr>,
NodeStore: NodeStorage<I, NodeAttr>,
I: Eq + Hash + PartialEq,Expand description
Check if a given topological sorting is valid for a network.
ยงExample
use spokes::{Network, algorithms::valid_topological_sorting, ArcStorage};
let mut network: Network<usize, (), ()> = Network::new();
network.add_nodes((0..6).map(|i| (i, ())));
network.add_arcs([
(5, 0),
(5, 2),
(4, 0),
(4, 1),
(2, 3),
(3, 1),
]);
assert!(valid_topological_sorting(&network, &[4, 5, 0, 2, 3, 1]));