pub struct Graph<V, E> { /* private fields */ }Expand description
Main graph structure
Implementations§
source§impl<V: Clone, E: Clone> Graph<V, E>
impl<V: Clone, E: Clone> Graph<V, E>
pub fn new() -> Graph<V, E>
pub fn add_vertex( &mut self, vertex_data: V ) -> Result<(VertexIndex, GraphDiff<V, E>), GraphError>
pub fn add_edge( &mut self, from_index: VertexIndex, to_index: VertexIndex, edge_data: E ) -> Result<(EdgeIndex, GraphDiff<V, E>), GraphError>
pub fn remove_edge( &mut self, edge_index: EdgeIndex ) -> Result<(E, GraphDiff<V, E>), GraphError>
pub fn remove_vertex( &mut self, vertex_index: VertexIndex ) -> Result<(V, GraphDiff<V, E>), GraphError>
pub fn apply_diff(&mut self, diff: GraphDiff<V, E>) -> Result<(), GraphError>
pub fn rollback_diff(&mut self, diff: GraphDiff<V, E>) -> Result<(), GraphError>
source§impl<V: Clone, E: Clone> Graph<V, E>
impl<V: Clone, E: Clone> Graph<V, E>
pub fn get_vertex(&self, index: VertexIndex) -> Result<&Vertex<V>, GraphError>
pub fn get_vertex_mut( &mut self, index: VertexIndex ) -> Result<&mut Vertex<V>, GraphError>
pub fn get_edge(&self, index: EdgeIndex) -> Result<&Edge<E>, GraphError>
pub fn get_edge_mut( &mut self, index: EdgeIndex ) -> Result<&mut Edge<E>, GraphError>
sourcepub fn assert_vertex_exists(&self, index: VertexIndex) -> Result<(), GraphError>
pub fn assert_vertex_exists(&self, index: VertexIndex) -> Result<(), GraphError>
Check that a vertex exists. Returns a result containing VertexDoesNotExist if it doesn’t exist
pub fn assert_edge_exists(&self, index: EdgeIndex) -> Result<(), GraphError>
Get a list of edges between two nodes. This only returns connections in one direction.
pub fn get_verticies(&self) -> &GenVec<Vertex<V>>
pub fn get_edges(&self) -> &GenVec<Edge<E>>
Trait Implementations§
source§impl<'de, V, E> Deserialize<'de> for Graph<V, E>where
V: Deserialize<'de>,
E: Deserialize<'de>,
impl<'de, V, E> Deserialize<'de> for Graph<V, E>where V: Deserialize<'de>, E: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more