Update documentation for AppendGraph
This commit is contained in:
+11
-11
@@ -1,17 +1,19 @@
|
|||||||
|
//! [`AppendGraph`], an undirected graph topology supporting addition only.
|
||||||
|
|
||||||
use crate::maps::{EdgeMap, VertexMap};
|
use crate::maps::{EdgeMap, VertexMap};
|
||||||
use crate::traits::{GraphTopology, IncidenceCursor};
|
use crate::traits::{GraphTopology, IncidenceCursor};
|
||||||
|
|
||||||
/// An opaque handle identifying a vertex in an [`AppendGraph`].
|
/// An opaque handle identifying a vertex in an [`AppendGraph`].
|
||||||
///
|
///
|
||||||
/// Handles are stable for the lifetime of the graph. They can be obtained via graph methods like
|
/// Handles are stable for the lifetime of the graph. Obtain via graph methods like
|
||||||
/// [`GraphTopology::add_vertex`] and [`GraphTopology::vertices`].
|
/// [`AppendGraph::add_vertex`] and [`AppendGraph::vertices`].
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct Vertex(usize);
|
pub struct Vertex(usize);
|
||||||
|
|
||||||
/// An opaque handle identifying an edge in an [`AppendGraph`].
|
/// An opaque handle identifying an edge in an [`AppendGraph`].
|
||||||
///
|
///
|
||||||
/// Handles are stable for the lifetime of the graph. They can be obtained via graph methods like
|
/// Handles are stable for the lifetime of the graph. Obtain via graph methods like
|
||||||
/// [`GraphTopology::add_edge`] and [`GraphTopology::edges`].
|
/// [`AppendGraph::add_edge`] and [`AppendGraph::edges`].
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct Edge(usize);
|
pub struct Edge(usize);
|
||||||
|
|
||||||
@@ -41,8 +43,7 @@ struct IncidenceEntry {
|
|||||||
|
|
||||||
/// A resumable cursor over the incidences of a single vertex in an [`AppendGraph`].
|
/// A resumable cursor over the incidences of a single vertex in an [`AppendGraph`].
|
||||||
///
|
///
|
||||||
/// Can be obtained via [`GraphTopology::incidence_cursor`]. See [`IncidenceCursor`] on how to use
|
/// Obtain via [`AppendGraph::incidence_cursor`]. See [`IncidenceCursor`] on usage guidance.
|
||||||
/// it.
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct AppendGraphIncidenceCursor {
|
pub struct AppendGraphIncidenceCursor {
|
||||||
incidence: Option<Edge>,
|
incidence: Option<Edge>,
|
||||||
@@ -57,12 +58,11 @@ impl IncidenceCursor<AppendGraph> for AppendGraphIncidenceCursor {
|
|||||||
/// An undirected graph that supports adding vertices and edges, but not deleting them.
|
/// An undirected graph that supports adding vertices and edges, but not deleting them.
|
||||||
///
|
///
|
||||||
/// `AppendGraph` is optimised for workloads that incrementally build a graph and query it
|
/// `AppendGraph` is optimised for workloads that incrementally build a graph and query it
|
||||||
/// repeatedly. [`Vertex`]
|
/// repeatedly. [`Vertex`] and [`Edge`] handles are never invalidated. Use [`Graph`] instead if you
|
||||||
/// and [`Edge`] handles are never invalidated. Use [`Graph`] instead if you need to remove vertices
|
/// need to remove vertices or edges.
|
||||||
/// or edges.
|
|
||||||
///
|
///
|
||||||
/// Incidences are stored as interlaced adjacency lists in a single flat [`Vec`]. This means that
|
/// Incidences are stored as interleaved adjacency lists in a single flat [`Vec`]. In general,
|
||||||
/// vertex neighborhood traversals in general result in scattered index jumps.
|
/// vertex neighborhood traversals result in scattered index jumps.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user