pub fn into_directed_cch(self) -> DirectedCCH {
        // identify arcs which are always infinity and can be removed
        let (forward, backward) = customization::always_infinity(&self).into_ch_graphs();

        let mut forward_first_out = Vec::with_capacity(self.first_out.len());
        forward_first_out.push(0);
        let mut forward_head = Vec::with_capacity(self.head.len());
        let mut forward_cch_edge_to_orig_arc = Vec::with_capacity(self.head.len());

        let mut backward_first_out = Vec::with_capacity(self.first_out.len());
        backward_first_out.push(0);
        let mut backward_head = Vec::with_capacity(self.head.len());
        let mut backward_cch_edge_to_orig_arc = Vec::with_capacity(self.head.len());

        let mut forward_edge_counter = 0;
        let mut backward_edge_counter = 0;

        for node in 0..self.num_nodes() as NodeId {
            let orig_arcs = &self.cch_edge_to_orig_arc[self.neighbor_edge_indices_usize(node)];
            for (link, (forward_orig_arcs, _)) in LinkIterable::<Link>::link_iter(&forward, node).zip(orig_arcs.iter()) {
                if link.weight < INFINITY {
                    forward_head.push(link.node);
                    forward_cch_edge_to_orig_arc.push(forward_orig_arcs.clone());
                    forward_edge_counter += 1;
                }
            }
            for (link, (_, backward_orig_arcs)) in LinkIterable::<Link>::link_iter(&backward, node).zip(orig_arcs.iter()) {
                if link.weight < INFINITY {
                    backward_head.push(link.node);
                    backward_cch_edge_to_orig_arc.push(backward_orig_arcs.clone());
                    backward_edge_counter += 1;
                }
            }
            forward_first_out.push(forward_edge_counter);
            backward_first_out.push(backward_edge_counter);
        }

        let forward_inverted = ReversedGraphWithEdgeIds::reversed(&UnweightedFirstOutGraph::new(&forward_first_out[..], &forward_head[..]));
        let backward_inverted = ReversedGraphWithEdgeIds::reversed(&UnweightedFirstOutGraph::new(&backward_first_out[..], &backward_head[..]));

        DirectedCCH {
            forward_first_out,
            forward_head,
            backward_first_out,
            backward_head,
            node_order: self.node_order,
            forward_cch_edge_to_orig_arc,
            backward_cch_edge_to_orig_arc,
            elimination_tree: self.elimination_tree,
            forward_inverted,
            backward_inverted,
        }
    }
/// Transform into a directed CCH which is more efficient
/// for turn expanded graphs because many edges can be removed.
Transform into a directed CCH which is more efficient
for turn expanded graphs because many edges can be removed.
Transform into a directed CCH which is more efficient for turn expanded graphs because many edges can be removed .
pub fn into_directed_cch(self) -> DirectedCCH {
        // identify arcs which are always infinity and can be removed
        let (forward, backward) = customization::always_infinity(&self).into_ch_graphs();
        let mut forward_first_out = Vec::with_capacity(self.first_out.len());
        forward_first_out.push(0);
        let mut forward_head = Vec::with_capacity(self.head.len());
        let mut forward_cch_edge_to_orig_arc = Vec::with_capacity(self.head.len());
        let mut backward_first_out = Vec::with_capacity(self.first_out.len());
        backward_first_out.push(0);
        let mut backward_head = Vec::with_capacity(self.head.len());
        let mut backward_cch_edge_to_orig_arc = Vec::with_capacity(self.head.len());
        let mut forward_edge_counter = 0;
        let mut backward_edge_counter = 0;
        for node in 0..self.num_nodes() as NodeId {
            let orig_arcs = &self.cch_edge_to_orig_arc[self.neighbor_edge_indices_usize(node)];
            for (link, (forward_orig_arcs, _)) in LinkIterable::<Link>::link_iter(&forward, node).zip(orig_arcs.iter()) {
                if link.weight < INFINITY {
                    forward_head.push(link.node);
                    forward_cch_edge_to_orig_arc.push(forward_orig_arcs.clone());
                    forward_edge_counter += 1;
                }
            }
            for (link, (_, backward_orig_arcs)) in LinkIterable::<Link>::link_iter(&backward, node).zip(orig_arcs.iter()) {
                if link.weight < INFINITY {
                    backward_head.push(link.node);
                    backward_cch_edge_to_orig_arc.push(backward_orig_arcs.clone());
                    backward_edge_counter += 1;
                }
            }
            forward_first_out.push(forward_edge_counter);
            backward_first_out.push(backward_edge_counter);
        }
        let forward_inverted = ReversedGraphWithEdgeIds::reversed(&UnweightedFirstOutGraph::new(&forward_first_out[..], &forward_head[..]));
        let backward_inverted = ReversedGraphWithEdgeIds::reversed(&UnweightedFirstOutGraph::new(&backward_first_out[..], &backward_head[..]));
        DirectedCCH {
            forward_first_out,
            forward_head,
            backward_first_out,
            backward_head,
            node_order: self.node_order,
            forward_cch_edge_to_orig_arc,
            backward_cch_edge_to_orig_arc,
            elimination_tree: self.elimination_tree,
            forward_inverted,
            backward_inverted,
        }
    }
pub fn into_directed_cch ( self ) -> DirectedCCH { // identify arcs which are always infinity and can be removed let ( forward , backward ) = customization :: always_infinity ( & self ) . into_ch_graphs ( ) ; let mut forward_first_out = Vec :: with_capacity ( self . first_out . len ( ) ) ; forward_first_out . push ( 0 ) ; let mut forward_head = Vec :: with_capacity ( self . head . len ( ) ) ; let mut forward_cch_edge_to_orig_arc = Vec :: with_capacity ( self . head . len ( ) ) ; let mut backward_first_out = Vec :: with_capacity ( self . first_out . len ( ) ) ; backward_first_out . push ( 0 ) ; let mut backward_head = Vec :: with_capacity ( self . head . len ( ) ) ; let mut backward_cch_edge_to_orig_arc = Vec :: with_capacity ( self . head . len ( ) ) ; let mut forward_edge_counter = 0 ; let mut backward_edge_counter = 0 ; for node in 0 .. self . num_nodes ( ) as NodeId { let orig_arcs = & self . cch_edge_to_orig_arc [ self . neighbor_edge_indices_usize ( node ) ] ; for ( link , ( forward_orig_arcs , _ ) ) in LinkIterable :: < Link > :: link_iter ( & forward , node ) . zip ( orig_arcs . iter ( ) ) { if link . weight < INFINITY { forward_head . push ( link . node ) ; forward_cch_edge_to_orig_arc . push ( forward_orig_arcs . clone ( ) ) ; forward_edge_counter += 1 ; } } for ( link , ( _ , backward_orig_arcs ) ) in LinkIterable :: < Link > :: link_iter ( & backward , node ) . zip ( orig_arcs . iter ( ) ) { if link . weight < INFINITY { backward_head . push ( link . node ) ; backward_cch_edge_to_orig_arc . push ( backward_orig_arcs . clone ( ) ) ; backward_edge_counter += 1 ; } } forward_first_out . push ( forward_edge_counter ) ; backward_first_out . push ( backward_edge_counter ) ; } let forward_inverted = ReversedGraphWithEdgeIds :: reversed ( & UnweightedFirstOutGraph :: new ( & forward_first_out [ .. ] , & forward_head [ .. ] ) ) ; let backward_inverted = ReversedGraphWithEdgeIds :: reversed ( & UnweightedFirstOutGraph :: new ( & backward_first_out [ .. ] , & backward_head [ .. ] ) ) ; DirectedCCH { forward_first_out , forward_head , backward_first_out , backward_head , node_order : self . node_order , forward_cch_edge_to_orig_arc , backward_cch_edge_to_orig_arc , elimination_tree : self . elimination_tree , forward_inverted , backward_inverted , } }
Transform into a directed CCH which is more efficient
for turn expanded graphs because many edges can be removed.
Transform into a directed CCH which is more efficient for turn expanded graphs because many edges can be removed .
self
self