pub fn add_edge(&mut self, ed_id:ID, from: ID, to:ID, edat: E)-> Result<(), GraphErr>{
        // if 'from' dont exist on data, because parent node not exist
        if ! self.data.contains_key(&from){
            return Err(GraphErr::new("'from' not in does"));
        }

        // test if data contains to edge, if not return a Err() of type GraphErr
        if let Some(ref mut dt) = self.data.get_mut(&to){
            // get as mut reference because we need to increse array of  references on child graph
            // added new edge reference
            // all cloned because they be reused
            self.edges.insert(ed_id.clone(),(edat, from.clone(), to.clone()));
            // add to array of references
            dt.1.push(ed_id.clone());
        } else {
            return Err(GraphErr::new("'to' not in nodes"));
        }

        // if from and to exists, add added the edge and  reference,
        // then, get the reference of from *prev used to
        // then push to refs edge id
        self.data.get_mut(&from).unwrap().1.push(ed_id.clone());
        Ok(())
    }
// will add and edge on node
// return Ok or GraphErr type
will add and edge on node
return Ok or GraphErr type
will add and edge on node return Ok or GraphErr type
pub fn add_edge(&mut self, ed_id:ID, from: ID, to:ID, edat: E)-> Result<(), GraphErr>{
        // if 'from' dont exist on data, because parent node not exist
        if ! self.data.contains_key(&from){
            return Err(GraphErr::new("'from' not in does"));
        }
        // test if data contains to edge, if not return a Err() of type GraphErr
        if let Some(ref mut dt) = self.data.get_mut(&to){
            // get as mut reference because we need to increse array of  references on child graph
            // added new edge reference
            // all cloned because they be reused
            self.edges.insert(ed_id.clone(),(edat, from.clone(), to.clone()));
            // add to array of references
            dt.1.push(ed_id.clone());
        } else {
            return Err(GraphErr::new("'to' not in nodes"));
        }
        // if from and to exists, add added the edge and  reference,
        // then, get the reference of from *prev used to
        // then push to refs edge id
        self.data.get_mut(&from).unwrap().1.push(ed_id.clone());
        Ok(())
    }
pub fn add_edge ( & mut self , ed_id : ID , from : ID , to : ID , edat : E ) -> Result < ( ) , GraphErr > { // if 'from' dont exist on data, because parent node not exist if ! self . data . contains_key ( & from ) { return Err ( GraphErr :: new ( " " ) ) ; } // test if data contains to edge, if not return a Err() of type GraphErr if let Some ( ref mut dt ) = self . data . get_mut ( & to ) { // get as mut reference because we need to increse array of  references on child graph // added new edge reference // all cloned because they be reused self . edges . insert ( ed_id . clone ( ) , ( edat , from . clone ( ) , to . clone ( ) ) ) ; // add to array of references dt . 1 . push ( ed_id . clone ( ) ) ; } else { return Err ( GraphErr :: new ( " " ) ) ; } // if from and to exists, add added the edge and  reference, // then, get the reference of from *prev used to // then push to refs edge id self . data . get_mut ( & from ) . unwrap ( ) . 1 . push ( ed_id . clone ( ) ) ; Ok ( ( ) ) }
will add and edge on node
return Ok or GraphErr type
will add and edge on node return Ok or GraphErr type
&mut self
ed_id
ID
from
ID
to
ID
edat
E
&mut self
ed_id
ID
from
ID
to
ID
edat
E