Function rustc::util::common::can_reachExperimental
[-]
[+]
[src]
pub fn can_reach<S, H: Hasher<S>, T: Eq + Clone + Hash<S>>(edges_map: &HashMap<T, Vec<T>, H>, source: T, destination: T) -> bool
K: Eq + Hash, V, S, H: Hasher
Determines whether there exists a path from source
to destination
. The graph is defined by
the edges_map
, which maps from a node S
to a list of its adjacent nodes T
.
Efficiency note: This is implemented in an inefficient way because it is typically invoked on very small graphs. If the graphs become larger, a more efficient graph representation and algorithm would probably be advised.