pub fn add_root(&mut self, vertex_id: usize) -> Result<()> {
        if self.is_root(vertex_id) {
            Err(Error::new_rae(vertex_id))?
        } else {
            self.add_vertex_from_graph(vertex_id)?;

            self.roots.push(vertex_id);

            Ok(())
        }
    }
/// Adds a new root to the set of roots.
///
/// # Arguments
/// `vertex_id`: Id of the vertex to be added as root.
///
/// # Returns
/// * `Err`:
///     * If root with specified id already exists
///     * Error of calling `add_vertex_from_graph`.
/// * `Ok`:
Adds a new root to the set of roots.
Adds a new root to the set of roots .
pub fn add_root(&mut self, vertex_id: usize) -> Result<()> {
        if self.is_root(vertex_id) {
            Err(Error::new_rae(vertex_id))?
        } else {
            self.add_vertex_from_graph(vertex_id)?;
            self.roots.push(vertex_id);
            Ok(())
        }
    }
pub fn add_root ( & mut self , vertex_id : usize ) -> Result < ( ) > { if self . is_root ( vertex_id ) { Err ( Error :: new_rae ( vertex_id ) ) ? } else { self . add_vertex_from_graph ( vertex_id ) ? ; self . roots . push ( vertex_id ) ; Ok ( ( ) ) } }
Adds a new root to the set of roots.
Adds a new root to the set of roots .
&mut self
vertex_id
usize
`Err`:
If root with specified id already exists
Error of calling `add_vertex_from_graph`.
`Ok`.
` Err ` : If root with specified id already exists Error of calling ` add_vertex_from_graph ` . ` Ok ` .
&mut self
vertex_id
usize