mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-27 14:57:14 +00:00
dag_walk: rename bfs() to dfs() because it's depth-first
No callers appear to rely on traversal order, so let's just fix the function name. Maybe it was a typo.
This commit is contained in:
parent
d5d1dbcd3e
commit
78a64edb22
3 changed files with 4 additions and 4 deletions
|
@ -16,7 +16,7 @@ use std::collections::HashSet;
|
|||
use std::hash::Hash;
|
||||
use std::iter;
|
||||
|
||||
pub fn bfs<T, ID, II, NI>(
|
||||
pub fn dfs<T, ID, II, NI>(
|
||||
start: II,
|
||||
id_fn: impl Fn(&T) -> ID,
|
||||
mut neighbors_fn: impl FnMut(&T) -> NI,
|
||||
|
@ -136,7 +136,7 @@ where
|
|||
{
|
||||
let start: Vec<T> = start.into_iter().collect();
|
||||
let mut reachable: HashSet<T> = start.iter().cloned().collect();
|
||||
for _node in bfs(start.into_iter(), id_fn, |node| {
|
||||
for _node in dfs(start.into_iter(), id_fn, |node| {
|
||||
let neighbors: Vec<T> = neighbors_fn(node).into_iter().collect();
|
||||
for neighbor in &neighbors {
|
||||
reachable.remove(neighbor);
|
||||
|
|
|
@ -109,7 +109,7 @@ impl DefaultIndexStore {
|
|||
let change_id_length = store.change_id_length();
|
||||
let mut new_heads = view.heads().clone();
|
||||
let mut parent_op_id: Option<OperationId> = None;
|
||||
for op in dag_walk::bfs(
|
||||
for op in dag_walk::dfs(
|
||||
vec![operation.clone()],
|
||||
|op: &Operation| op.id().clone(),
|
||||
|op: &Operation| op.parents(),
|
||||
|
|
|
@ -26,7 +26,7 @@ fn count_non_merge_operations(repo: &Arc<ReadonlyRepo>) -> usize {
|
|||
let op_id = repo.op_id().clone();
|
||||
let mut num_ops = 0;
|
||||
|
||||
for op_id in dag_walk::bfs(
|
||||
for op_id in dag_walk::dfs(
|
||||
vec![op_id],
|
||||
|op_id| op_id.clone(),
|
||||
|op_id| op_store.read_operation(op_id).unwrap().parents,
|
||||
|
|
Loading…
Reference in a new issue