fn remove_edge(&mut self, src_id: usize, dst_id: usize, edge_id: usize) -> Result<()> {
        if !self.contains_vertex(src_id) {
            Err(Error::new_vnf(src_id))?
        } else if !self.contains_vertex(dst_id) {
            Err(Error::new_vnf(dst_id))?
        } else if !self.contains_edge(edge_id) {
            Err(Error::new_enf(edge_id))?
        } else {
            if let Some(index) = self.edges.iter().position(|(s_id, d_id, edge)| {
                *s_id == src_id && *d_id == dst_id && edge.get_id() == edge_id
            }) {
                self.edges.swap_remove(index);

                Ok(())
            } else {
                Err(Error::new_iei(src_id, dst_id, edge_id))?
            }
        }
    }
/// Removes an edge from the subgraph.
///
/// # Arguments
/// * `src_id`: Id of the source vertex.
/// * `dst_id`: Id of the destination vertex.
/// * `edge_id`: Id of the edge from source to destination to be removed.
///
/// # Returns
/// * `Err`:
///     * If either vertices with `src_id` or `dst_id` does not exist.
///     * If there is no edge from source to destination with id: `edge_id`.
/// * `Ok`:
Removes an edge from the subgraph.
Removes an edge from the subgraph .
fn remove_edge(&mut self, src_id: usize, dst_id: usize, edge_id: usize) -> Result<()> {
        if !self.contains_vertex(src_id) {
            Err(Error::new_vnf(src_id))?
        } else if !self.contains_vertex(dst_id) {
            Err(Error::new_vnf(dst_id))?
        } else if !self.contains_edge(edge_id) {
            Err(Error::new_enf(edge_id))?
        } else {
            if let Some(index) = self.edges.iter().position(|(s_id, d_id, edge)| {
                *s_id == src_id && *d_id == dst_id && edge.get_id() == edge_id
            }) {
                self.edges.swap_remove(index);
                Ok(())
            } else {
                Err(Error::new_iei(src_id, dst_id, edge_id))?
            }
        }
    }
fn remove_edge ( & mut self , src_id : usize , dst_id : usize , edge_id : usize ) -> Result < ( ) > { if ! self . contains_vertex ( src_id ) { Err ( Error :: new_vnf ( src_id ) ) ? } else if ! self . contains_vertex ( dst_id ) { Err ( Error :: new_vnf ( dst_id ) ) ? } else if ! self . contains_edge ( edge_id ) { Err ( Error :: new_enf ( edge_id ) ) ? } else { if let Some ( index ) = self . edges . iter ( ) . position ( | ( s_id , d_id , edge ) | { * s_id == src_id && * d_id == dst_id && edge . get_id ( ) == edge_id } ) { self . edges . swap_remove ( index ) ; Ok ( ( ) ) } else { Err ( Error :: new_iei ( src_id , dst_id , edge_id ) ) ? } } }
Removes an edge from the subgraph.
Removes an edge from the subgraph .
&mut self
src_id
usize
dst_id
usize
edge_id
usize
`Err`:
If either vertices with `src_id` or `dst_id` does not exist.
If there is no edge from source to destination with id: `edge_id`.
`Ok`.
` Err ` : If either vertices with ` src_id ` or ` dst_id ` does not exist . If there is no edge from source to destination with id : ` edge_id ` . ` Ok ` .
&mut self
src_id
usize
dst_id
usize
edge_id
usize