pub trait Graph<W, E: Edge<W>, Ty: EdgeDir> {
// Required methods
fn add_vertex(&mut self) -> usize;
fn remove_vertex(&mut self, vertex_id: usize) -> Result<()>;
fn remove_vertex_unchecked(&mut self, vertex_id: usize);
fn add_edge(
&mut self,
src_id: usize,
dst_id: usize,
edge: E,
) -> Result<usize>;
fn add_edge_unchecked(
&mut self,
src_id: usize,
dst_id: usize,
edge: E,
) -> usize;
fn update_edge(
&mut self,
src_id: usize,
dst_id: usize,
edge_id: usize,
edge: E,
) -> Result<()>;
fn update_edge_unchecked(
&mut self,
src_id: usize,
dst_id: usize,
edge_id: usize,
edge: E,
);
fn remove_edge(
&mut self,
src_id: usize,
dst_id: usize,
edge_id: usize,
) -> Result<E>;
fn remove_edge_unchecked(
&mut self,
src_id: usize,
dst_id: usize,
edge_id: usize,
) -> E;
}Expand description
Provides basic functionalities to store graph information.
Required Methods§
Sourcefn add_vertex(&mut self) -> usize
fn add_vertex(&mut self) -> usize
Sourcefn remove_vertex(&mut self, vertex_id: usize) -> Result<()>
fn remove_vertex(&mut self, vertex_id: usize) -> Result<()>
Removes the vertex with id: vertex_id from graph.
§Arguments
vertex_id: Id of the vertex to be removed.
Sourcefn remove_vertex_unchecked(&mut self, vertex_id: usize)
fn remove_vertex_unchecked(&mut self, vertex_id: usize)
Removes the vertex with id: vertex_id from graph.
§Arguments
vertex_id: Id of the vertex to be removed.
Sourcefn add_edge_unchecked(&mut self, src_id: usize, dst_id: usize, edge: E) -> usize
fn add_edge_unchecked(&mut self, src_id: usize, dst_id: usize, edge: E) -> usize
Sourcefn update_edge(
&mut self,
src_id: usize,
dst_id: usize,
edge_id: usize,
edge: E,
) -> Result<()>
fn update_edge( &mut self, src_id: usize, dst_id: usize, edge_id: usize, edge: E, ) -> Result<()>
Replaces the edge with id: edge_id with edge.
§Arguments
src_id: Id of source vertex.dst_id: Id of destination vertex.edge_id: Id of the to be updated edge.edge: New edge to replace the old one.
Sourcefn update_edge_unchecked(
&mut self,
src_id: usize,
dst_id: usize,
edge_id: usize,
edge: E,
)
fn update_edge_unchecked( &mut self, src_id: usize, dst_id: usize, edge_id: usize, edge: E, )
Replaces the edge with id: edge_id with edge.
§Arguments
src_id: Id of source vertex.dst_id: Id of destination vertex.edge_id: Id of the to be updated edge.edge: New edge to replace the old one.
Implementors§
impl<W, E: Edge<W>, Dir: EdgeDir, S: GraphStorage<W, E, Dir>> Graph<W, E, Dir> for SimpleGraph<W, E, Dir, S>
For documentation about each function checkout Graph trait.