Skip to content

Commit 7b228af

Browse files
haudrenLevi-Armstrong
authored andcommitted
Make getShortestPath const
Indeed, it does not (and should not) modify the underlying graph.
1 parent a3ca1ab commit 7b228af

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tesseract/tesseract_scene_graph/include/tesseract_scene_graph/graph.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ class SceneGraph : public Graph
418418
* @param tip The tip link
419419
* @return The shortest path between the two links
420420
*/
421-
Path getShortestPath(const std::string& root, const std::string& tip);
421+
Path getShortestPath(const std::string& root, const std::string& tip) const;
422422

423423
/**
424424
* @brief Get the graph vertex by name

tesseract/tesseract_scene_graph/src/graph.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,9 @@ void SceneGraph::saveDOT(const std::string& path) const
560560
dot_file << "}";
561561
}
562562

563-
SceneGraph::Path SceneGraph::getShortestPath(const std::string& root, const std::string& tip)
563+
SceneGraph::Path SceneGraph::getShortestPath(const std::string& root, const std::string& tip) const
564564
{
565-
const auto& graph = static_cast<const Graph&>(*this);
565+
const Graph& graph = *this;
566566
Vertex s = getVertex(root);
567567

568568
std::map<Vertex, Vertex> predicessor_map;

0 commit comments

Comments
 (0)