pub fn remove_edge(&mut self, from: NodeID, to: NodeID) -> Result<(), &'static str> {
        if !self.nodes.contains_key(&from) {
            return Err("Invalid Node ID for 'from' node");
        }
        if !self.nodes.contains_key(&to) {
            return Err("Invalid Node ID for 'to' node");
        }

        let from_pointing_to = self.nodes.get_mut(&from).unwrap().pointing_to();

        if !from_pointing_to.contains(&to) {
            return Err("No edge exists between the 'from' node and the 'to' node");
        }

        from_pointing_to.retain(|elem| elem != &to);

        let to_pointed_to = self.nodes.get_mut(&to).unwrap().pointed_to();

        if !to_pointed_to.contains(&from) {
            return Err("No edge exists between the 'to' node and the 'from' node");
        }

        to_pointed_to.retain(|elem| elem != &from);

        Ok(())
    }
/// Remove an edge between two nodes by ID. Fails if the node IDs are not found.
Remove an edge between two nodes by ID. Fails if the node IDs are not found.
Remove an edge between two nodes by ID . Fails if the node IDs are not found .
pub fn remove_edge(&mut self, from: NodeID, to: NodeID) -> Result<(), &'static str> {
        if !self.nodes.contains_key(&from) {
            return Err("Invalid Node ID for 'from' node");
        }
        if !self.nodes.contains_key(&to) {
            return Err("Invalid Node ID for 'to' node");
        }
        let from_pointing_to = self.nodes.get_mut(&from).unwrap().pointing_to();
        if !from_pointing_to.contains(&to) {
            return Err("No edge exists between the 'from' node and the 'to' node");
        }
        from_pointing_to.retain(|elem| elem != &to);
        let to_pointed_to = self.nodes.get_mut(&to).unwrap().pointed_to();
        if !to_pointed_to.contains(&from) {
            return Err("No edge exists between the 'to' node and the 'from' node");
        }
        to_pointed_to.retain(|elem| elem != &from);
        Ok(())
    }
pub fn remove_edge ( & mut self , from : NodeID , to : NodeID ) -> Result < ( ) , & ' static str > { if ! self . nodes . contains_key ( & from ) { return Err ( " " ) ; } if ! self . nodes . contains_key ( & to ) { return Err ( " " ) ; } let from_pointing_to = self . nodes . get_mut ( & from ) . unwrap ( ) . pointing_to ( ) ; if ! from_pointing_to . contains ( & to ) { return Err ( " " ) ; } from_pointing_to . retain ( | elem | elem != & to ) ; let to_pointed_to = self . nodes . get_mut ( & to ) . unwrap ( ) . pointed_to ( ) ; if ! to_pointed_to . contains ( & from ) { return Err ( " " ) ; } to_pointed_to . retain ( | elem | elem != & from ) ; Ok ( ( ) ) }
Remove an edge between two nodes by ID.
Remove an edge between two nodes by ID .
&mut self
from
NodeID
to
NodeID
&mut self
from
NodeID
to
NodeID