-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
213 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,13 @@ | ||
Version 1.1.0 (2024-04-04) | ||
Version 0.1.0 (2024-04-04) | ||
========================== | ||
Lots of breaking changes to correct some of my own concerns and also some feedback from other people. | ||
Yanked version 1.x.x and reverted to 0.1.0 to follow semver since the api is not yet 100% stable. | ||
I will try to avoid breaking changes but there almost certainly be a few more ones. | ||
When I think the library is stable I will set the version to 2.0.0. | ||
When I think the library is stable I will set the version to 1.0.0. | ||
|
||
Breaking changes | ||
---------------- | ||
- Removed SlotMapGraph | ||
- Reduced Clone requirement | ||
- `add_edge` now returns EdgeID. | ||
- CategoryGraph renamed to CategorizedGraph | ||
|
||
Version 1.0.2 (2024-04-04) | ||
========================== | ||
|
||
- Cleaned some things up mostly and changed documentation. | ||
- For the next version I'm planning to add more tests and making the github prettier. I will also make what I got even neater and then the version after that I aim to add more graph algorithms. After that I can start creating some benchmarks to see how much/if there is a significant speedup in some situations compared to alternatives and when that happen. | ||
|
||
Version 1.0.1 (2024-04-03) | ||
========================== | ||
|
||
- Some very minor fixes | ||
|
||
Version 1.0.0 (2024-04-03) | ||
========================== | ||
|
||
Breaking changes | ||
---------------- | ||
|
||
- Everything is new! | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
|
||
|
||
# General | ||
- No-std support [ ] | ||
- Benchmarks [ ] | ||
- Comparing benchmarks to alternatives [ ] | ||
- Syntax improvements [ ] | ||
- An undirected graph where the edges are just NodeIDs would make sense to skip the extra access for an edge. [ ] | ||
|
||
# Algorithms | ||
- Topological sort [ ] | ||
- Has path to root [ ] | ||
- Depth first walk (especially post order) [ ] | ||
- Cycle detection [ ] | ||
- Breadth first [ ] | ||
|
||
# Parallelization | ||
- Rayon support [ ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#[cfg(feature = "hashbrown")] | ||
use hashbrown::HashSet; | ||
|
||
#[cfg(not(feature = "hashbrown"))] | ||
use std::collections::HashSet; | ||
|
||
//#[cfg(feature = "std")] | ||
use std::collections::VecDeque; | ||
|
||
// #[cfg(not(feature = "std"))] | ||
// use alloc::collections::VecDeque; | ||
|
||
|
||
use crate::{GraphInterface, NodeID}; | ||
|
||
|
||
|
||
pub struct BreadthFirstSearch<'a, G: GraphInterface> { | ||
graph: &'a G, | ||
start: NodeID, | ||
visited: HashSet<NodeID>, | ||
queue: VecDeque<NodeID>, | ||
visited_edges: Vec<(NodeID, NodeID)> | ||
} | ||
|
||
impl<'a, G: GraphInterface> BreadthFirstSearch<'a, G> { | ||
pub fn new(graph: &'a G, start: NodeID) -> Self { | ||
Self { | ||
graph, | ||
start, | ||
visited: HashSet::new(), | ||
queue: VecDeque::from(vec![start]), | ||
visited_edges: Vec::new(), | ||
} | ||
} | ||
} | ||
|
||
impl <'a, G: GraphInterface> Iterator for BreadthFirstSearch<'a, G> { | ||
type Item = NodeID; | ||
|
||
fn next(&mut self) -> Option<Self::Item> { | ||
if let Some(node) = self.queue.pop_front() { | ||
if self.visited.contains(&node) { | ||
return self.next(); | ||
} | ||
self.visited.insert(node); | ||
|
||
let node = self.graph.node(node).unwrap(); | ||
for edge in &node.connections { | ||
let edge = self.graph.edge(*edge).unwrap(); | ||
if !self.visited.contains(&edge.to) { | ||
self.queue.push_back(edge.to); | ||
self.visited_edges.push((edge.from, edge.to)); | ||
} | ||
} | ||
|
||
return Some(node.id); | ||
} | ||
None | ||
} | ||
} | ||
|
||
impl<'a, G: GraphInterface> BreadthFirstSearch<'a, G> { | ||
pub fn visited_edges(&self) -> &Vec<(NodeID, NodeID)> { | ||
&self.visited_edges | ||
} | ||
|
||
pub fn visited(&self) -> &HashSet<NodeID> { | ||
&self.visited | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
mod dfs; | ||
//mod bfs; | ||
pub use dfs::*; |
Oops, something went wrong.