Skip to content

Commit

Permalink
follow idiom (petgraph#513)
Browse files Browse the repository at this point in the history
* follow idiom

* follow idiom some more
  • Loading branch information
tshepang authored and teuron committed Oct 9, 2022
1 parent 633b3ee commit 929eb9e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/algo/dijkstra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::visit::{EdgeRef, IntoEdges, VisitMap, Visitable};
/// use petgraph::prelude::*;
/// use std::collections::HashMap;
///
/// let mut graph : Graph<(),(),Directed>= Graph::new();
/// let mut graph: Graph<(), (), Directed> = Graph::new();
/// let a = graph.add_node(()); // node with no weight
/// let b = graph.add_node(());
/// let c = graph.add_node(());
Expand All @@ -48,24 +48,24 @@ use crate::visit::{EdgeRef, IntoEdges, VisitMap, Visitable};
/// (b, e),
/// (f, g),
/// (g, h),
/// (h, e)
/// (h, e),
/// ]);
/// // a ----> b ----> e ----> f
/// // ^ | ^ |
/// // | v | v
/// // d <---- c h <---- g
///
/// let expected_res: HashMap<NodeIndex, usize> = [
/// (a, 3),
/// (b, 0),
/// (c, 1),
/// (d, 2),
/// (e, 1),
/// (f, 2),
/// (g, 3),
/// (h, 4)
/// ].iter().cloned().collect();
/// let res = dijkstra(&graph,b,None, |_| 1);
/// (a, 3),
/// (b, 0),
/// (c, 1),
/// (d, 2),
/// (e, 1),
/// (f, 2),
/// (g, 3),
/// (h, 4),
/// ].iter().cloned().collect();
/// let res = dijkstra(&graph, b, None, |_| 1);
/// assert_eq!(res, expected_res);
/// // z is not inside res because there is not path from b to z.
/// ```
Expand Down

0 comments on commit 929eb9e

Please sign in to comment.