/// Computes the reachability of all nodes in the graph, and returns those which
/// are reachable. Returns a vector of vectors, where the coordinates are as follows:
/// longitude, latitude, remaining_energy.
Computes the reachability of all nodes in the graph, and returns those which
are reachable. Returns a vector of vectors, where the coordinates are as follows:
longitude, latitude, remaining_energy.
Computes the reachability of all nodes in the graph and returns those which are reachable . Returns a vector of vectors where the coordinates are as follows : longitude latitude remaining_energy .
pub fn reachability(&self, source: i64, capacity: f32) -> Vec<Vec<f64>> {
        let source_id = self.get_id_from_osm(source);
        match self.bellman(source_id) {
            Some((pred, dist)) => {
                let max_length = self.nodes.len();
                println!(" ˪— Assessing all {} nodes to select feasible ones.", max_length);
                let mut trace = Vec::new();
                for (i, node) in dist.iter().enumerate() {
                    if capacity - node >= 0.0 {
                        let mut loc = self.get_loc_from_id(i);
                        loc.push((capacity - node) as f64);
                        trace.push(loc);
                    }
                }
                trace
            },
            None => Vec::new()
        }
    }
pub fn reachability ( & self , source : i64 , capacity : f32 ) -> Vec < Vec < f64 > > { let source_id = self . get_id_from_osm ( source ) ; match self . bellman ( source_id ) { Some ( ( pred , dist ) ) => { let max_length = self . nodes . len ( ) ; println ! ( " m _length); let mut trace = Vec :: new ( ) ; for ( i , node ) in dist . iter ( ) . enumerate ( ) { if capacity - node >= 0.0 { let mut loc = self . get_loc_from_id ( i ) ; loc . push ( ( capacity - node ) as f64 ) ; trace . push ( loc ) ; } } trace } , None => Vec :: new ( ) } }
Computes the reachability of all nodes in the graph, and returns those which
are reachable.
Computes the reachability of all nodes in the graph and returns those which are reachable .
&self
source
i64
capacity
f32