Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ name = "graphalgs"
bench = false

[dependencies]
petgraph = "0.7"
petgraph = "0.8"
nalgebra = "0.33"
rand = "0.8"
num-traits = "0.2"
Expand Down
2 changes: 1 addition & 1 deletion benches/all_simple_shortest_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fn n_spfa_bench_helper(c: &mut BenchmarkGroup<WallTime>, node_count: usize, dens
b.iter(|| {
let mut output = Vec::with_capacity(node_count);
for n in graph.node_identifiers() {
output.push(spfa(&graph, n));
output.push(spfa(&graph, n, |_| 1.0));
}
black_box(output)
})
Expand Down
15 changes: 8 additions & 7 deletions src/adj_matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ mod test {
use petgraph::csr::Csr;
use petgraph::graph::Graph;
use petgraph::graphmap::{DiGraphMap, UnGraphMap};
use petgraph::matrix_graph::MatrixGraph;
use petgraph::matrix_graph::{MatrixGraph, UnMatrix};
use petgraph::stable_graph::StableGraph;
use std::hash::RandomState;

fn float_to_scalar(w: &f64) -> f64 {
*w
Expand Down Expand Up @@ -189,7 +190,7 @@ mod test {

#[test]
fn test_unweighted_matrix_directed() {
let mut graph = MatrixGraph::new();
let mut graph = MatrixGraph::<_, _, RandomState>::new();
let a = graph.add_node('a');
let b = graph.add_node('b');
let c = graph.add_node('c');
Expand All @@ -211,7 +212,7 @@ mod test {

#[test]
fn test_unweighted_matrix_undirected() {
let mut graph = MatrixGraph::new_undirected();
let mut graph = UnMatrix::<_, _, RandomState>::new_undirected();
let a = graph.add_node('a');
let b = graph.add_node('b');
let c = graph.add_node('c');
Expand Down Expand Up @@ -369,7 +370,7 @@ mod test {

#[test]
fn test_weighted_matrix_undirected() {
let mut graph = MatrixGraph::new_undirected();
let mut graph = UnMatrix::<_, _, RandomState>::new_undirected();
let a = graph.add_node('a');
let b = graph.add_node('b');
let c = graph.add_node('c');
Expand All @@ -390,7 +391,7 @@ mod test {

#[test]
fn test_weighted_matrix_directed() {
let mut graph = MatrixGraph::new();
let mut graph = MatrixGraph::<_, _, RandomState>::new();
let a = graph.add_node('a');
let b = graph.add_node('b');
let c = graph.add_node('c');
Expand All @@ -411,7 +412,7 @@ mod test {

#[test]
fn test_weighted_graphmap_undirected() {
let mut graph = UnGraphMap::new();
let mut graph = UnGraphMap::<_, _, RandomState>::new();
let a = graph.add_node('a');
let b = graph.add_node('b');
let c = graph.add_node('c');
Expand All @@ -432,7 +433,7 @@ mod test {

#[test]
fn test_weighted_graphmap_directed() {
let mut graph = DiGraphMap::new();
let mut graph = DiGraphMap::<_, _, RandomState>::new();
let a = graph.add_node('a');
let b = graph.add_node('b');
let c = graph.add_node('c');
Expand Down
4 changes: 2 additions & 2 deletions src/generate/randomg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub fn random_digraph(
/// ## Returns
/// * `Err`: if the required number of vertices is greater than the maximum possible.
/// * `Ok`: set `HashMap<(usize, usize), K>` of edges with `usize` vertex indices,
/// where `K` is the type of weights.
/// where `K` is the type of weights.
///
/// # Examples
///
Expand Down Expand Up @@ -206,7 +206,7 @@ pub fn random_ungraph(
/// ## Returns
/// * `Err`: if the required number of vertices is greater than the maximum possible.
/// * `Ok`: set `HashMap<(usize, usize), K>` of edges with `usize` vertex indices,
/// where `K` is the type of weights.
/// where `K` is the type of weights.
///
/// # Examples
///
Expand Down
2 changes: 1 addition & 1 deletion src/mst/boruvka.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::collections::HashSet;
///
/// ## Returns
/// * `HashSet<(usize, usize)>`: the set of edges of the resulting MST,
/// where each edge is denoted by a pair of vertex indices, index order is random.
/// where each edge is denoted by a pair of vertex indices, index order is random.
///
/// # Examples
/// ```
Expand Down
2 changes: 1 addition & 1 deletion src/mst/prim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use petgraph::visit::{
///
/// ## Returns
/// * `Vec<(usize, usize)>`: the vector of edges of the resulting MST,
/// where each edge is denoted by a pair of vertex indices, index order is random.
/// where each edge is denoted by a pair of vertex indices, index order is random.
///
/// # Examples
/// ```
Expand Down
2 changes: 1 addition & 1 deletion src/shortest_path/floyd_warshall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use petgraph::visit::{EdgeRef, GraphProp, IntoEdgeReferences, IntoNodeIdentifier
/// ## Returns
/// * `Err`: if graph contains negative cycle.
/// * `Ok`: matrix `Vec<Vec<K>>` of shortest distances, in cell **(i, j)** of which the length of the shortest path
/// from node **i** to node **j** is stored.
/// from node **i** to node **j** is stored.
///
/// # Examples
///
Expand Down
Loading
Loading