Function rustc_trans::util::common::can_reachUnstable [-] [+] [src]

pub fn can_reach<T, S>(edges_map: &HashMap<T, Vec<T>, S>, source: T, destination: T) -> bool where S: HashState, T: Hash + Eq + Clone

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.