mirror of
https://github.com/krahets/hello-algo.git
synced 2026-05-11 11:07:14 +08:00
@@ -45,7 +45,7 @@ impl GraphAdjMat {
|
||||
// 在邻接矩阵中添加一行
|
||||
self.adj_mat.push(vec![0; n]);
|
||||
// 在邻接矩阵中添加一列
|
||||
for row in &mut self.adj_mat {
|
||||
for row in self.adj_mat.iter_mut() {
|
||||
row.push(0);
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ impl GraphAdjMat {
|
||||
// 在邻接矩阵中删除索引 index 的行
|
||||
self.adj_mat.remove(index);
|
||||
// 在邻接矩阵中删除索引 index 的列
|
||||
for row in &mut self.adj_mat {
|
||||
for row in self.adj_mat.iter_mut() {
|
||||
row.remove(index);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user