polish rust (#1790)

* polish graph

* Update graph
This commit is contained in:
rongyi
2025-08-04 14:45:14 +08:00
committed by GitHub
parent 83a806a602
commit 0918fd06f2
3 changed files with 12 additions and 20 deletions

View File

@ -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);
}
}