MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / get_neighbors

Method get_neighbors

publication/code/chapter09/graph_adjlist.rs:35–42  ·  view source on GitHub ↗

获取相邻的点集合

(&self)

Source from the content-addressed store, hash-verified

33
34 // 获取相邻的点集合
35 fn get_neighbors(&self) -> Vec<&T> {
36 let mut neighbors = Vec::new();
37 for (nbr, _wt) in self.neighbors.iter() {
38 neighbors.push(nbr);
39 }
40
41 neighbors
42 }
43
44 // 返回到邻点的边权重
45 fn get_nbr_weight(&self, key: &T) -> &i32 {

Callers 2

remove_vertexMethod · 0.45
mainFunction · 0.45

Calls 2

iterMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected