fn add_edge_from_graph(&mut self, src_id: usize, dst_id: usize, edge_id: usize) -> Result<()> {
        if self.contains_edge(edge_id) {
            Err(Error::new_eae(edge_id))?
        } else {
            if let Some(edge) = self
                .graph
                .edges_between(src_id, dst_id)?
                .into_iter()
                .find(|edge| edge.get_id() == edge_id)
            {
                self.edges.push((src_id, dst_id, edge));

                self.vertex_ids.insert(src_id);
                self.vertex_ids.insert(dst_id);

                Ok(())
            } else {
                Err(Error::new_iei(src_id, dst_id, edge_id))?
            }
        }
    }
/// Adds an edge from the graph to subgraph.
///
/// # Arguments
/// * `src_id`: Id of the source vertex.
/// * `dst_id`: Id of the destination vertex.
/// * `edge_id`: Id of the edge to be added.
///
/// # Returns
/// * `Err`:
///     * If vertex with id: `src_id` does not exist in graph.
///     * If vertex with id: `dst_id` dost not exist in graph.
///     * If edge with id: `edge_id` does not exist in graph(from src to dst).
///     * If edge already exists in the subgraph.
/// * `Ok`:
Adds an edge from the graph to subgraph.
Adds an edge from the graph to subgraph .
fn add_edge_from_graph(&mut self, src_id: usize, dst_id: usize, edge_id: usize) -> Result<()> {
        if self.contains_edge(edge_id) {
            Err(Error::new_eae(edge_id))?
        } else {
            if let Some(edge) = self
                .graph
                .edges_between(src_id, dst_id)?
                .into_iter()
                .find(|edge| edge.get_id() == edge_id)
            {
                self.edges.push((src_id, dst_id, edge));
                self.vertex_ids.insert(src_id);
                self.vertex_ids.insert(dst_id);
                Ok(())
            } else {
                Err(Error::new_iei(src_id, dst_id, edge_id))?
            }
        }
    }
fn add_edge_from_graph ( & mut self , src_id : usize , dst_id : usize , edge_id : usize ) -> Result < ( ) > { if self . contains_edge ( edge_id ) { Err ( Error :: new_eae ( edge_id ) ) ? } else { if let Some ( edge ) = self . graph . edges_between ( src_id , dst_id ) ? . into_iter ( ) . find ( | edge | edge . get_id ( ) == edge_id ) { self . edges . push ( ( src_id , dst_id , edge ) ) ; self . vertex_ids . insert ( src_id ) ; self . vertex_ids . insert ( dst_id ) ; Ok ( ( ) ) } else { Err ( Error :: new_iei ( src_id , dst_id , edge_id ) ) ? } } }
Adds an edge from the graph to subgraph.
Adds an edge from the graph to subgraph .
&mut self
src_id
usize
dst_id
usize
edge_id
usize
`Err`:
If vertex with id: `src_id` does not exist in graph.
If vertex with id: `dst_id` dost not exist in graph.
If edge with id: `edge_id` does not exist in graph(from src to dst).
If edge already exists in the subgraph.
`Ok`.
` Err ` : If vertex with id : ` src_id ` does not exist in graph . If vertex with id : ` dst_id ` dost not exist in graph . If edge with id : ` edge_id ` does not exist in graph ( from src to dst ) . If edge already exists in the subgraph . ` Ok ` .
&mut self
src_id
usize
dst_id
usize
edge_id
usize