diff --git a/cpp/graph-inl.h b/cpp/graph-inl.h index 9cc751ef2..35f707cb5 100644 --- a/cpp/graph-inl.h +++ b/cpp/graph-inl.h @@ -21,9 +21,6 @@ namespace gtsam { //typedef boost::graph_traits::vertex_iterator BoostVertexIterator; -//typedef boost::adjacency_list > SGraph; -//typedef boost::graph_traits::vertex_descriptor SVertex; /* ************************************************************************* */ @@ -64,10 +61,12 @@ SDGraph toBoostGraph(const G& graph) { } /* ************************************************************************* */ -template -boost::tuple > predecessorMap2Graph(const PredecessorMap& p_map) { +template +boost::tuple, typename SDGraph::Vertex, std::map::Vertex> > +predecessorMap2Graph(const PredecessorMap& p_map) { - G g(0); + typedef typename SDGraph::Vertex V; + SDGraph g; map key2vertex; V v1, v2, root; Key child, parent; @@ -95,7 +94,7 @@ boost::tuple > predecessorMap2Graph(const PredecessorMap& if (!foundRoot) throw invalid_argument("predecessorMap2Graph: invalid predecessor map!"); - return boost::tuple >(g, root, key2vertex); + return boost::tuple, V, std::map >(g, root, key2vertex); } /* ************************************************************************* */ diff --git a/cpp/graph.h b/cpp/graph.h index ba42ffc92..937240ec9 100644 --- a/cpp/graph.h +++ b/cpp/graph.h @@ -26,6 +26,14 @@ namespace gtsam { boost::edge_weight_t, double> > { }; + template + class SGraph : public boost::adjacency_list > { + typedef typename boost::graph_traits >::vertex_descriptor Vertex; + }; + + //typedef boost::graph_traits::vertex_descriptor SVertex; + /** * Map from variable key to parent key */ @@ -45,8 +53,8 @@ namespace gtsam { * G = Graph type * V = Vertex type */ - template - boost::tuple > + template + boost::tuple, typename SDGraph::Vertex, std::map::Vertex> > predecessorMap2Graph(const PredecessorMap& p_map); /**