Compare commits
11 Commits
docs
...
release-0.3.0
| Author | SHA1 | Date | |
|---|---|---|---|
| ad9850800d | |||
| a14202effc | |||
| 5fa415841e | |||
| e8568a084a | |||
| e6b08d9148 | |||
| b62c263b08 | |||
| 913a9e0baa | |||
| 8c6c98859c | |||
| 24c08438d6 | |||
| bf6a7142f3 | |||
| fb9dfe8280 |
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "grapherity"
|
name = "grapherity"
|
||||||
version = "0.2.2"
|
version = "0.2.3"
|
||||||
authors = ["Stefan Müller"]
|
authors = ["Stefan Müller"]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.85.0"
|
rust-version = "1.85.0"
|
||||||
|
|||||||
+1
-3
@@ -127,15 +127,13 @@
|
|||||||
//! [`GraphTopology::Vertex`]: crate::traits::GraphTopology::Vertex
|
//! [`GraphTopology::Vertex`]: crate::traits::GraphTopology::Vertex
|
||||||
//! [`GraphTopologyDeletion`]: crate::traits::GraphTopologyDeletion
|
//! [`GraphTopologyDeletion`]: crate::traits::GraphTopologyDeletion
|
||||||
|
|
||||||
#![warn(missing_docs)]
|
|
||||||
|
|
||||||
pub mod algorithms;
|
pub mod algorithms;
|
||||||
pub mod maps;
|
pub mod maps;
|
||||||
pub mod models;
|
pub mod models;
|
||||||
pub mod traits;
|
pub mod traits;
|
||||||
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
pub use crate::traits::{GraphTopology, GraphTopologyDeletion};
|
pub use crate::traits::{GraphTopology, GraphTopologyDeletion, IncidenceCursor};
|
||||||
}
|
}
|
||||||
|
|
||||||
mod testing;
|
mod testing;
|
||||||
|
|||||||
-10
@@ -18,11 +18,6 @@ impl<V: Copy, T: Clone> VertexMap<V, T> {
|
|||||||
self.inner.capacity()
|
self.inner.capacity()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(since = "0.2.2", note = "use 'capacity' instead")]
|
|
||||||
pub fn len(&self) -> usize {
|
|
||||||
self.capacity()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn sync<G: GraphTopology<Vertex = V>>(&mut self, graph: &G) {
|
pub fn sync<G: GraphTopology<Vertex = V>>(&mut self, graph: &G) {
|
||||||
self.inner.resize(graph.vertex_capacity());
|
self.inner.resize(graph.vertex_capacity());
|
||||||
}
|
}
|
||||||
@@ -58,11 +53,6 @@ impl<E: Copy, T: Clone> EdgeMap<E, T> {
|
|||||||
self.inner.capacity()
|
self.inner.capacity()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(since = "0.2.2", note = "use 'capacity' instead")]
|
|
||||||
pub fn len(&self) -> usize {
|
|
||||||
self.capacity()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn sync<G: GraphTopology<Edge = E>>(&mut self, graph: &G) {
|
pub fn sync<G: GraphTopology<Edge = E>>(&mut self, graph: &G) {
|
||||||
self.inner.resize(graph.edge_capacity());
|
self.inner.resize(graph.edge_capacity());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ impl GraphTopology for AppendGraph {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn vertex_capacity(&self) -> usize {
|
fn vertex_capacity(&self) -> usize {
|
||||||
self.vertices.len()
|
self.vertices.capacity()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn vertex_map<T: Clone>(&self, default: T) -> VertexMap<Self::Vertex, T> {
|
fn vertex_map<T: Clone>(&self, default: T) -> VertexMap<Self::Vertex, T> {
|
||||||
|
|||||||
+5
-2
@@ -38,7 +38,7 @@ pub trait GraphTopology {
|
|||||||
/// when an algorithm needs to pause traversal, perform other graph queries or mutations, and
|
/// when an algorithm needs to pause traversal, perform other graph queries or mutations, and
|
||||||
/// then continue from where it left off. This cursor type can be obtained via
|
/// then continue from where it left off. This cursor type can be obtained via
|
||||||
/// [`incidence_cursor`](Self::incidence_cursor).
|
/// [`incidence_cursor`](Self::incidence_cursor).
|
||||||
type IncidenceCursor: IncidenceCursor<Self> + Copy;
|
type IncidenceCursor: IncidenceCursor<Self>;
|
||||||
|
|
||||||
/// Returns the number of vertices in the graph.
|
/// Returns the number of vertices in the graph.
|
||||||
fn vertex_count(&self) -> usize;
|
fn vertex_count(&self) -> usize;
|
||||||
@@ -210,10 +210,13 @@ pub trait GraphTopologyDeletion: GraphTopology {
|
|||||||
|
|
||||||
/// A cursor for traversing the incidences of a vertex one step at a time.
|
/// A cursor for traversing the incidences of a vertex one step at a time.
|
||||||
///
|
///
|
||||||
|
/// Because the cursor is [`Copy`], its state can be saved and restored to replay or branch a
|
||||||
|
/// traversal.
|
||||||
|
///
|
||||||
/// Cursors are obtained via [`GraphTopology::incidence_cursor`]. See
|
/// Cursors are obtained via [`GraphTopology::incidence_cursor`]. See
|
||||||
/// [`GraphTopology::IncidenceCursor`] for guidance on when to prefer a cursor over
|
/// [`GraphTopology::IncidenceCursor`] for guidance on when to prefer a cursor over
|
||||||
/// [`GraphTopology::incidences`].
|
/// [`GraphTopology::incidences`].
|
||||||
pub trait IncidenceCursor<G: GraphTopology + ?Sized> {
|
pub trait IncidenceCursor<G: GraphTopology + ?Sized>: Copy {
|
||||||
/// Advances the cursor and returns the next incidence as `Some((u, e))`, or `None` if the
|
/// Advances the cursor and returns the next incidence as `Some((u, e))`, or `None` if the
|
||||||
/// traversal is exhausted.
|
/// traversal is exhausted.
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user