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

Method add_edge

code/chapter08/graph_matrix.rs:54–60  ·  view source on GitHub ↗

添加边,设置边属性为 true

(&mut self, n1: &Vertex, n2: &Vertex)

Source from the content-addressed store, hash-verified

52
53 // 添加边,设置边属性为 true
54 fn add_edge(&mut self, n1: &Vertex, n2: &Vertex) {
55 if n1.id < self.nodes && n2.id < self.nodes {
56 self.graph[n1.id][n2.id] = Edge::set_edge();
57 } else {
58 panic!("error");
59 }
60 }
61}
62
63fn main() {

Callers 1

mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected