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

Method get_connects

code/chapter08/graph_adjlist.rs:33–40  ·  view source on GitHub ↗

获取相邻的点集合

(&self)

Source from the content-addressed store, hash-verified

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

Callers 2

remove_vertexMethod · 0.80
mainFunction · 0.80

Calls 2

iterMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected