@@ -77,6 +77,8 @@ FindSourceVertex(const ScopedGraph<T> &_graph,
7777 using DirectedEdge = typename ScopedGraph<T>::Edge;
7878 using Vertex = typename ScopedGraph<T>::Vertex;
7979 using VertexId = gz::math::graph::VertexId;
80+ using VertexType = typename ScopedGraph<T>::VertexType;
81+ using gz::math::graph::NullVertex;
8082 using EdgesType = std::vector<DirectedEdge>;
8183 using PairType = std::pair<const Vertex &, EdgesType>;
8284 EdgesType edges;
@@ -86,7 +88,7 @@ FindSourceVertex(const ScopedGraph<T> &_graph,
8688 _errors.push_back ({ErrorCode::POSE_RELATIVE_TO_INVALID,
8789 " Unable to resolve pose, invalid vertex[" + std::to_string (_id) + " ] "
8890 " in PoseRelativeToGraph." });
89- return PairType (Vertex:: NullVertex, EdgesType ());
91+ return PairType (NullVertex<VertexType>() , EdgesType ());
9092 }
9193
9294 if (_id == _graph.ScopeVertexId ())
@@ -106,7 +108,7 @@ FindSourceVertex(const ScopedGraph<T> &_graph,
106108 _errors.push_back ({ErrorCode::POSE_RELATIVE_TO_GRAPH_ERROR,
107109 " PoseRelativeToGraph error: multiple incoming edges to "
108110 " current vertex [" + vertex.get ().Name () + " ]." });
109- return PairType (Vertex:: NullVertex, EdgesType ());
111+ return PairType (NullVertex<VertexType>() , EdgesType ());
110112 }
111113 auto const &edge = incidentsTo.begin ()->second ;
112114 vertex = _graph.Graph ().VertexFromId (edge.get ().Vertices ().first );
@@ -116,7 +118,7 @@ FindSourceVertex(const ScopedGraph<T> &_graph,
116118 _errors.push_back ({ErrorCode::POSE_RELATIVE_TO_CYCLE,
117119 " PoseRelativeToGraph cycle detected, already visited vertex [" +
118120 vertex.get ().Name () + " ]." });
119- return PairType (Vertex:: NullVertex, EdgesType ());
121+ return PairType (NullVertex<VertexType>() , EdgesType ());
120122 }
121123 if (vertex.get ().Id () == _graph.ScopeVertexId ())
122124 {
@@ -129,7 +131,7 @@ FindSourceVertex(const ScopedGraph<T> &_graph,
129131 if (vertex.get ().Id () != _graph.ScopeVertexId ())
130132 {
131133 // Error, the root vertex is not the same as the the source
132- return PairType (Vertex:: NullVertex, EdgesType ());
134+ return PairType (NullVertex<VertexType>() , EdgesType ());
133135 }
134136
135137 return PairType (vertex, edges);
@@ -157,6 +159,8 @@ FindSinkVertex(
157159 using DirectedEdge = typename ScopedGraph<T>::Edge;
158160 using Vertex = typename ScopedGraph<T>::Vertex;
159161 using VertexId = gz::math::graph::VertexId;
162+ using VertexType = typename ScopedGraph<T>::VertexType;
163+ using gz::math::graph::NullVertex;
160164 using EdgesType = std::vector<DirectedEdge>;
161165 using PairType = std::pair<const Vertex &, EdgesType>;
162166 EdgesType edges;
@@ -166,7 +170,7 @@ FindSinkVertex(
166170 _errors.push_back ({ErrorCode::FRAME_ATTACHED_TO_INVALID,
167171 " Invalid vertex[" + std::to_string (_id) + " ] "
168172 " in FrameAttachedToGraph." });
169- return PairType (Vertex:: NullVertex, EdgesType ());
173+ return PairType (NullVertex<VertexType>() , EdgesType ());
170174 }
171175
172176 std::set<VertexId> visited;
@@ -180,7 +184,7 @@ FindSinkVertex(
180184 _errors.push_back ({ErrorCode::FRAME_ATTACHED_TO_GRAPH_ERROR,
181185 " FrameAttachedToGraph error: multiple outgoing edges from "
182186 " current vertex [" + vertex.get ().Name () + " ]." });
183- return PairType (Vertex:: NullVertex, EdgesType ());
187+ return PairType (NullVertex<VertexType>() , EdgesType ());
184188 }
185189 auto const &edge = incidentsFrom.begin ()->second ;
186190 vertex = _graph.Graph ().VertexFromId (edge.get ().Vertices ().second );
@@ -190,7 +194,7 @@ FindSinkVertex(
190194 _errors.push_back ({ErrorCode::FRAME_ATTACHED_TO_CYCLE,
191195 " FrameAttachedToGraph cycle detected, already visited vertex [" +
192196 vertex.get ().Name () + " ]." });
193- return PairType (Vertex:: NullVertex, EdgesType ());
197+ return PairType (NullVertex<VertexType>() , EdgesType ());
194198 }
195199 visited.insert (vertex.get ().Id ());
196200 incidentsFrom = _graph.Graph ().IncidentsFrom (vertex);
0 commit comments