I remember times when I legit couldn't write a bfs in #Rust, but I don't remember why.
```
pub fn bfs(&self, i: usize) -> Result<Vec<usize>> {
if self.adj[i].0.is_none() {
anyhow::bail!(format!("Tried to start bfs from {} but there is no vertex there.", &i));
}
let mut queue = VecDeque::new();
queue.push_back(i);
let mut result = vec![];
let mut visited = vec![false; self.adj.len()];
while let Some(v) = queue.pop_front() {
if visited[v] {
continue;
}
for (x, _) in &self.adj[v].1 {
queue.push_back(*x);
}
result.push(v);
visited[v] = true;
}
Ok(result.clone())
}
```