Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Malte R
graph-tool
Commits
3f177dfc
Commit
3f177dfc
authored
Oct 13, 2020
by
Tiago Peixoto
Browse files
generate_knn(): fix problem with equal distances
parent
31038455
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/graph/generation/graph_knn.hh
View file @
3f177dfc
...
...
@@ -112,11 +112,15 @@ void gen_knn(Graph& g, Dist&& d, size_t k, double r, double epsilon,
auto
iter
=
Bv
.
lower_bound
({
w
,
l
});
if
(
iter
!=
Bv
.
end
()
&&
get
<
0
>
(
*
iter
)
!=
w
)
{
size_t
n
=
Bv
.
size
();
Bv
.
insert
(
iter
,
{
w
,
l
});
iter
=
Bv
.
end
();
--
iter
;
Bv
.
erase
(
iter
);
++
c
;
if
(
Bv
.
size
()
>
n
)
{
iter
=
Bv
.
end
();
--
iter
;
Bv
.
erase
(
iter
);
++
c
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment