构建图
(data: [[usize;2];20])
| 66 | |
| 67 | // 构建图 |
| 68 | fn build_graph(data: [[usize;2];20]) -> Vec<(Graph, usize)> { |
| 69 | let mut graphs: Vec<(Graph, usize)> = Vec::new(); |
| 70 | |
| 71 | for _ in 0..9 { graphs.push((Graph::new(), 0)); } |
| 72 | |
| 73 | for i in 1..9 { |
| 74 | for j in 0..data.len() { |
| 75 | if data[j][0] == i { |
| 76 | graphs[i].0.insert(data[j][1]); |
| 77 | } |
| 78 | } |
| 79 | print!("[{i}]->"); |
| 80 | graphs[i].0.print_node(); |
| 81 | } |
| 82 | |
| 83 | graphs |
| 84 | } |
| 85 | |
| 86 | fn dfs(graph: Vec<(Graph, usize)>) { |
| 87 | let mut gp = graph; |
no test coverage detected