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