pub fn insert_vertex(&mut self, v: V) -> Result<()> {
        if self.vertices.contains_key(&v.index()) {
            return Err("duplicate vertex index".into());
        }
        self.vertices.insert(v.index(), v.clone());
        self.successors.insert(v.index(), BTreeSet::new());
        self.predecessors.insert(v.index(), BTreeSet::new());
        Ok(())
    }
/// Inserts a vertex into the graph.
/// # Errors
/// Error if the vertex already exists by index.
Inserts a vertex into the graph.
Inserts a vertex into the graph .
pub fn insert_vertex(&mut self, v: V) -> Result<()> {
        if self.vertices.contains_key(&v.index()) {
            return Err("duplicate vertex index".into());
        }
        self.vertices.insert(v.index(), v.clone());
        self.successors.insert(v.index(), BTreeSet::new());
        self.predecessors.insert(v.index(), BTreeSet::new());
        Ok(())
    }
pub fn insert_vertex ( & mut self , v : V ) -> Result < ( ) > { if self . vertices . contains_key ( & v . index ( ) ) { return Err ( " " . into ( ) ) ; } self . vertices . insert ( v . index ( ) , v . clone ( ) ) ; self . successors . insert ( v . index ( ) , BTreeSet :: new ( ) ) ; self . predecessors . insert ( v . index ( ) , BTreeSet :: new ( ) ) ; Ok ( ( ) ) }
Inserts a vertex into the graph.
Inserts a vertex into the graph .
&mut self
v
V
&mut self
v
V
errors
Error if the vertex already exists by index.
Error if the vertex already exists by index .