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
Tiago Peixoto
graph-tool
Commits
1fa4fea4
Commit
1fa4fea4
authored
May 20, 2022
by
Tiago Peixoto
Browse files
shortest_distance(): fix `max_dist` logic
This fixes issue
#734
parent
daae776b
Pipeline
#959
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/graph/topology/graph_distance.cc
View file @
1fa4fea4
...
...
@@ -188,17 +188,17 @@ public:
~
djk_max_visitor
()
{
for
(
auto
v
:
_unreached
)
_dist_map
[
v
]
=
_inf
;
{
if
(
_dist_map
[
v
]
>
_max_dist
)
_dist_map
[
v
]
=
_inf
;
}
}
template
<
class
Graph
>
void
examine_vertex
(
typename
graph_traits
<
Graph
>::
vertex_descriptor
u
,
Graph
&
)
{
if
(
_dist_map
[
u
]
>
_max_dist
)
throw
stop_search
();
if
(
u
==
_target
)
if
(
_dist_map
[
u
]
>
_max_dist
||
u
==
_target
)
throw
stop_search
();
}
...
...
@@ -208,7 +208,13 @@ public:
{
if
(
_dist_map
[
u
]
>
_max_dist
)
_unreached
.
push_back
(
u
);
else
}
template
<
class
Graph
>
void
finish_vertex
(
typename
graph_traits
<
Graph
>::
vertex_descriptor
u
,
Graph
&
)
{
if
(
_dist_map
[
u
]
<=
_max_dist
)
_reached
.
push_back
(
u
);
}
...
...
@@ -238,7 +244,10 @@ public:
~
djk_max_multiple_targets_visitor
()
{
for
(
auto
v
:
_unreached
)
_dist_map
[
v
]
=
_inf
;
{
if
(
_dist_map
[
v
]
>
_max_dist
)
_dist_map
[
v
]
=
_inf
;
}
}
template
<
class
Graph
>
...
...
@@ -263,7 +272,13 @@ public:
{
if
(
_dist_map
[
u
]
>
_max_dist
)
_unreached
.
push_back
(
u
);
else
}
template
<
class
Graph
>
void
finish_vertex
(
typename
graph_traits
<
Graph
>::
vertex_descriptor
u
,
Graph
&
)
{
if
(
_dist_map
[
u
]
<=
_max_dist
)
_reached
.
push_back
(
u
);
}
...
...
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