fn as_directed_edges(&self) -> Vec<(usize, usize, &E)> {
        let mut edges = vec![];

        for src_id in self.map.keys() {
            // `src_id` is a valid key so using self[*src_id] is reasonable.
            for (dst_id, src_to_dst_edges) in self[*src_id].iter() {
                edges.append(
                    &mut src_to_dst_edges
                        .into_iter()
                        .map(|edge| (*src_id, *dst_id, edge))
                        .collect(),
                )
            }
        }

        edges
    }
/// Difference between this function and `edges` is that this function treats each edge as a directed edge.
/// For example consider storage: a --- b
/// If you call `edges` on this storage, you will get: (a, b, edge).
/// But if you call `as_directed_edges`, you will get two elements: (a, b, edge) and (b, a, edge).
/// It's specifically useful in algorithms that are for directed graphs but can also be applied to undirected graphs if we treat the edges as directed.
/// One example is [`BellmanFord`](crate::algo::BellmanFord) algorithm.
///
/// # Returns
/// All edges(as directed edges) in the storage in the format of: (`src_id`, `dst_id`, `edge`).
///
/// # Complexity
/// O(|E|)
Difference between this function and `edges` is that this function treats each edge as a directed edge.
For example consider storage: a --- b
If you call `edges` on this storage, you will get: (a, b, edge).
But if you call `as_directed_edges`, you will get two elements: (a, b, edge) and (b, a, edge).
It's specifically useful in algorithms that are for directed graphs but can also be applied to undirected graphs if we treat the edges as directed.
Difference between this function and ` edges ` is that this function treats each edge as a directed edge . For example consider storage : a --- b If you call ` edges ` on this storage you will get : ( a b edge ) . But if you call ` as_directed_edges ` you will get two elements : ( a b edge ) and ( b a edge ) . It ' s specifically useful in algorithms that are for directed graphs but can also be applied to undirected graphs if we treat the edges as directed .
fn as_directed_edges(&self) -> Vec<(usize, usize, &E)> {
        let mut edges = vec![];
        for src_id in self.map.keys() {
            // `src_id` is a valid key so using self[*src_id] is reasonable.
            for (dst_id, src_to_dst_edges) in self[*src_id].iter() {
                edges.append(
                    &mut src_to_dst_edges
                        .into_iter()
                        .map(|edge| (*src_id, *dst_id, edge))
                        .collect(),
                )
            }
        }
        edges
    }
fn as_directed_edges ( & self ) -> Vec < ( usize , usize , & E ) > { let mut edges = vec ! [ ] ; for src_id in self . map . keys ( ) { // `src_id` is a valid key so using self[*src_id] is reasonable. for ( dst_id , src_to_dst_edges ) in self [ * src_id ] . iter ( ) { edges . append ( & mut src_to_dst_edges . into_iter ( ) . map ( | edge | ( * src_id , * dst_id , edge ) ) . collect ( ) , ) } } edges }
Difference between this function and `edges` is that this function treats each edge as a directed edge.
Difference between this function and ` edges ` is that this function treats each edge as a directed edge .
&self
All edges(as directed edges) in the storage in the format of: (`src_id`, `dst_id`, `edge`).
All edges ( as directed edges ) in the storage in the format of : ( ` src_id ` ` dst_id ` ` edge ` ) .
&self
complexity
None