Split out growth functionality into BitVector type

This commit is contained in:
Mark Rousskov
2018-07-30 08:58:14 -06:00
parent 1d64b241cd
commit 9bc4fbb10a
15 changed files with 117 additions and 99 deletions

View File

@@ -30,7 +30,7 @@
//! the field `next_edge`). Each of those fields is an array that should
//! be indexed by the direction (see the type `Direction`).
use bitvec::BitVector;
use bitvec::BitArray;
use std::fmt::Debug;
use std::usize;
use snapshot_vec::{SnapshotVec, SnapshotVecDelegate};
@@ -266,7 +266,7 @@ impl<N: Debug, E: Debug> Graph<N, E> {
direction: Direction,
entry_node: NodeIndex,
) -> Vec<NodeIndex> {
let mut visited = BitVector::new(self.len_nodes());
let mut visited = BitArray::new(self.len_nodes());
let mut stack = vec![];
let mut result = Vec::with_capacity(self.len_nodes());
let mut push_node = |stack: &mut Vec<_>, node: NodeIndex| {
@@ -348,7 +348,7 @@ where
{
graph: &'g Graph<N, E>,
stack: Vec<NodeIndex>,
visited: BitVector<usize>,
visited: BitArray<usize>,
direction: Direction,
}
@@ -358,7 +358,7 @@ impl<'g, N: Debug, E: Debug> DepthFirstTraversal<'g, N, E> {
start_node: NodeIndex,
direction: Direction,
) -> Self {
let mut visited = BitVector::new(graph.len_nodes());
let mut visited = BitArray::new(graph.len_nodes());
visited.insert(start_node.node_id());
DepthFirstTraversal {
graph,