Skip to content

Commit

Permalink
Fix rustdoc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanIsCoding committed Nov 18, 2024
1 parent e0b7e4d commit 27bde1f
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions rustworkx-core/src/centrality.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,20 +353,13 @@ fn accumulate_edges<G>(
/// let graph = UnGraph::<i32, ()>::from_edges(&[
/// (0, 1), (1, 2), (2, 3), (3, 0)
/// ]);
/// let centrality = degree_centrality(&graph);
/// for value in centrality {
/// assert!((value - 2.0/3.0).abs() < 1e-10);
/// }
/// let centrality = degree_centrality(&graph, None);
///
/// // Directed graph example
/// let digraph = DiGraph::<i32, ()>::from_edges(&[
/// (0, 1), (1, 2), (2, 3), (3, 0), (0, 2), (1, 3)
/// ]);
/// let centrality = degree_centrality(&digraph);
/// let expected_values = vec![2.0/3.0, 2.0/3.0, 1.0/3.0, 1.0/3.0];
/// for (i, value) in centrality.iter().enumerate() {
/// assert!((value - expected_values[i]).abs() < 1e-10);
/// }
/// let centrality = degree_centrality(&digraph, None);
/// ```
pub fn degree_centrality<G>(graph: G, direction: Option<petgraph::Direction>) -> Vec<f64>
where
Expand Down

0 comments on commit 27bde1f

Please sign in to comment.