Skip to content

Commit 2bfdefa

Browse files
authored
Move algorithm modules to algo/ (#447)
1 parent 5c8b1d9 commit 2bfdefa

10 files changed

Lines changed: 32 additions & 34 deletions

File tree

src/astar.rs renamed to src/algo/astar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::collections::{BinaryHeap, HashMap};
33

44
use std::hash::Hash;
55

6-
use super::visit::{EdgeRef, GraphBase, IntoEdges, Visitable};
76
use crate::scored::MinScored;
7+
use crate::visit::{EdgeRef, GraphBase, IntoEdges, Visitable};
88

99
use crate::algo::Measure;
1010

src/dijkstra.rs renamed to src/algo/dijkstra.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use std::collections::{BinaryHeap, HashMap};
33

44
use std::hash::Hash;
55

6-
use super::visit::{EdgeRef, IntoEdges, VisitMap, Visitable};
76
use crate::algo::Measure;
87
use crate::scored::MinScored;
8+
use crate::visit::{EdgeRef, IntoEdges, VisitMap, Visitable};
99

1010
/// \[Generic\] Dijkstra's shortest path algorithm.
1111
///
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::collections::HashMap;
22

33
use std::hash::Hash;
44

5-
use super::visit::{EdgeRef, IntoEdgeReferences, IntoNodeIdentifiers, NodeCompactIndexable};
65
use crate::algo::{BoundedMeasure, NegativeCycle};
6+
use crate::visit::{EdgeRef, IntoEdgeReferences, IntoNodeIdentifiers, NodeCompactIndexable};
77

88
/// \[Generic\] [Floyd–Warshall algorithm](https://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm) is an algorithm for all pairs shortest path problem
99
///
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
use super::data::DataMap;
2-
use super::visit::EdgeCount;
3-
use super::visit::EdgeRef;
4-
use super::visit::GetAdjacencyMatrix;
5-
use super::visit::GraphBase;
6-
use super::visit::GraphProp;
7-
use super::visit::IntoEdgesDirected;
8-
use super::visit::IntoNeighborsDirected;
9-
use super::visit::NodeCompactIndexable;
10-
use super::{Incoming, Outgoing};
1+
use crate::data::DataMap;
2+
use crate::visit::EdgeCount;
3+
use crate::visit::EdgeRef;
4+
use crate::visit::GetAdjacencyMatrix;
5+
use crate::visit::GraphBase;
6+
use crate::visit::GraphProp;
7+
use crate::visit::IntoEdgesDirected;
8+
use crate::visit::IntoNeighborsDirected;
9+
use crate::visit::NodeCompactIndexable;
10+
use crate::{Incoming, Outgoing};
1111

1212
use self::semantic::EdgeMatcher;
1313
use self::semantic::NoSemanticMatch;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use std::collections::{BinaryHeap, HashMap};
22

33
use std::hash::Hash;
44

5-
use super::visit::{EdgeRef, IntoEdges, NodeCount, NodeIndexable, Visitable};
65
use crate::algo::Measure;
76
use crate::scored::MinScored;
7+
use crate::visit::{EdgeRef, IntoEdges, NodeCount, NodeIndexable, Visitable};
88

99
/// \[Generic\] k'th shortest path algorithm.
1010
///

src/matching.rs renamed to src/algo/matching.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::VecDeque;
22
use std::hash::Hash;
33

4-
use super::visit::{
4+
use crate::visit::{
55
EdgeRef, GraphBase, IntoEdges, IntoNeighbors, IntoNodeIdentifiers, NodeCount, NodeIndexable,
66
VisitMap, Visitable,
77
};

‎src/algo/mod.rs‎

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@
44
//! so that they are generally applicable. For now, some of these still require
55
//! the `Graph` type.
66
7+
pub mod astar;
78
pub mod bellman_ford;
9+
pub mod dijkstra;
810
pub mod dominators;
11+
pub mod feedback_arc_set;
12+
pub mod floyd_warshall;
13+
pub mod isomorphism;
14+
pub mod k_shortest_path;
15+
pub mod matching;
16+
pub mod simple_paths;
917
pub mod tred;
1018

1119
use std::collections::{BinaryHeap, HashMap};
@@ -25,19 +33,17 @@ use crate::scored::MinScored;
2533
use crate::visit::Walker;
2634
use crate::visit::{Data, IntoNodeReferences, NodeRef};
2735

28-
pub use super::astar::astar;
29-
pub use super::dijkstra::dijkstra;
30-
pub use super::feedback_arc_set::greedy_feedback_arc_set;
31-
pub use super::floyd_warshall::floyd_warshall;
32-
pub use super::k_shortest_path::k_shortest_path;
33-
34-
pub use super::isomorphism::{
36+
pub use astar::astar;
37+
pub use bellman_ford::{bellman_ford, find_negative_cycle};
38+
pub use dijkstra::dijkstra;
39+
pub use feedback_arc_set::greedy_feedback_arc_set;
40+
pub use floyd_warshall::floyd_warshall;
41+
pub use isomorphism::{
3542
is_isomorphic, is_isomorphic_matching, is_isomorphic_subgraph, is_isomorphic_subgraph_matching,
3643
};
37-
pub use super::matching::{greedy_matching, maximum_matching, Matching};
38-
pub use super::simple_paths::all_simple_paths;
39-
40-
pub use bellman_ford::{bellman_ford, find_negative_cycle};
44+
pub use k_shortest_path::k_shortest_path;
45+
pub use matching::{greedy_matching, maximum_matching, Matching};
46+
pub use simple_paths::all_simple_paths;
4147

4248
/// \[Generic\] Return the number of connected components of the graph.
4349
///

‎src/lib.rs‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,29 +135,21 @@ pub mod data;
135135

136136
pub mod adj;
137137
pub mod algo;
138-
mod astar;
139138
pub mod csr;
140-
mod dijkstra;
141139
pub mod dot;
142-
mod feedback_arc_set;
143-
mod floyd_warshall;
144140
#[cfg(feature = "generate")]
145141
pub mod generate;
146142
mod graph_impl;
147143
#[cfg(feature = "graphmap")]
148144
pub mod graphmap;
149-
mod isomorphism;
150145
mod iter_format;
151146
mod iter_utils;
152-
mod k_shortest_path;
153-
mod matching;
154147
#[cfg(feature = "matrix_graph")]
155148
pub mod matrix_graph;
156149
#[cfg(feature = "quickcheck")]
157150
mod quickcheck;
158151
#[cfg(feature = "serde-1")]
159152
mod serde_utils;
160-
mod simple_paths;
161153
mod traits_graph;
162154
pub mod unionfind;
163155
mod util;

0 commit comments

Comments
 (0)