Skip to content

Commit

Permalink
Fix visited not containing starting point
Browse files Browse the repository at this point in the history
  • Loading branch information
leo848 committed Apr 2, 2024
1 parent cabcaa9 commit 5663924
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/path/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub fn greedy<C: CreateContext>(ctx: C) -> C::Path {
}

pub fn insertion<C: CreateContext>(ctx: C) -> C::Path {
let mut visited = HashSet::new();
let mut visited = HashSet::from([0]);
let mut path = graph::Path::new(vec![0]);
while path.len() != ctx.len() {
let mut min_cost_delta = f32::INFINITY;
Expand Down Expand Up @@ -202,6 +202,7 @@ pub fn insertion<C: CreateContext>(ctx: C) -> C::Path {
path.insert(i, new_vertex);
visited.insert(new_vertex);
ctx.send_path(path.iter(), Some(path.len() as f32 / ctx.len() as f32));
dbg!(&path);
}

ctx.path_from_indices(path.iter())
Expand Down

0 comments on commit 5663924

Please sign in to comment.