MCPcopy Create free account
hub / github.com/douchuan/algorithm / degree_of_separation

Function degree_of_separation

tests/test_undirected_graph.rs:161–176  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

159
160#[test]
161fn degree_of_separation() {
162 let i = ROUTES;
163 let symbol = SymbolGraph::new(&i, " ", |nv| Box::new(Graph::from(nv)));
164 let graph = symbol.G();
165 let source = "JFK";
166 let sink = "LAS";
167 let expect = vec!["JFK", "ORD", "PHX", "LAS"];
168 let finder = BreadthFirstPaths::new(graph, symbol.index(source).unwrap());
169 assert!(finder.has_path(symbol.index(sink).unwrap()));
170 let paths = finder.path_to(symbol.index(sink).unwrap()).unwrap();
171 let mut path_names = vec![];
172 for p in paths {
173 path_names.push(symbol.name(p).unwrap());
174 }
175 assert_eq!(expect, path_names);
176}
177
178#[test]
179fn locate_file() {

Callers

nothing calls this directly

Calls 5

GMethod · 0.80
indexMethod · 0.80
pushMethod · 0.80
nameMethod · 0.80
path_toMethod · 0.45

Tested by

no test coverage detected