fn add_edge(&mut self, src_id: usize, dst_id: usize, edge: E) -> Result<usize> {
        if self.has_any_edge(src_id, dst_id)? {
            Err(Error::new_me(src_id, dst_id))?
        } else if src_id == dst_id {
            Err(Error::new_l(src_id))?
        } else {
            self.storage.add_edge(src_id, dst_id, edge)
        }
    }
/// Adds an edge to the graph.
///
/// # Arguments
/// `src_id`: Id of the source vertex.
/// `dst_id`: Id of the destination vertex.
/// `edge`: Edge to be added from source to destination.
///
/// # Returns
/// * `Err`:
///     * If there is already an edge between source and destination.
///     * If source and destination are the same(edge is a loop)
///     * Error from calling `add_edge` on storage.
/// * `Ok`: Id of the newly added edge.
Adds an edge to the graph.
Adds an edge to the graph .
fn add_edge(&mut self, src_id: usize, dst_id: usize, edge: E) -> Result<usize> {
        if self.has_any_edge(src_id, dst_id)? {
            Err(Error::new_me(src_id, dst_id))?
        } else if src_id == dst_id {
            Err(Error::new_l(src_id))?
        } else {
            self.storage.add_edge(src_id, dst_id, edge)
        }
    }
fn add_edge ( & mut self , src_id : usize , dst_id : usize , edge : E ) -> Result < usize > { if self . has_any_edge ( src_id , dst_id ) ? { Err ( Error :: new_me ( src_id , dst_id ) ) ? } else if src_id == dst_id { Err ( Error :: new_l ( src_id ) ) ? } else { self . storage . add_edge ( src_id , dst_id , edge ) } }
Adds an edge to the graph.
Adds an edge to the graph .
&mut self
src_id
usize
dst_id
usize
edge
E
`Err`:
If there is already an edge between source and destination.
If source and destination are the same(edge is a loop)
Error from calling `add_edge` on storage.
`Ok`: Id of the newly added edge.
` Err ` : If there is already an edge between source and destination . If source and destination are the same ( edge is a loop ) Error from calling ` add_edge ` on storage . ` Ok ` : Id of the newly added edge .
&mut self
src_id
usize
dst_id
usize
edge
E