added 4-way symbolic factor
fixed a bug in the bayes tree to graphviz routinerelease/4.3a0
							parent
							
								
									e83b6c3b84
								
							
						
					
					
						commit
						31999ecb1f
					
				|  | @ -5,6 +5,7 @@ | |||
|  */ | ||||
| 
 | ||||
| #include <iostream> | ||||
| #include <fstream> | ||||
| #include <boost/foreach.hpp> | ||||
| #include <boost/tuple/tuple.hpp> | ||||
| 
 | ||||
|  | @ -59,6 +60,21 @@ namespace gtsam { | |||
| 		return ord; | ||||
| 	} | ||||
| 
 | ||||
| 	/* ************************************************************************* */ | ||||
| 	template<class Conditional> | ||||
| 	void BayesNet<Conditional>::saveGraph(const std::string &s) const { | ||||
| 		ofstream of(s.c_str()); | ||||
| 		of<< "digraph G{\n"; | ||||
| 		BOOST_FOREACH(sharedConditional conditional,conditionals_) { | ||||
| 			Symbol child = conditional->key(); | ||||
| 			BOOST_FOREACH(const Symbol& parent,conditional->parents()) { | ||||
| 				of << (string)parent << "->" << (string)child << endl; | ||||
| 			} | ||||
| 		} | ||||
| 		of<<"}"; | ||||
| 		of.close(); | ||||
| 	} | ||||
| 
 | ||||
| 	/* ************************************************************************* */ | ||||
| 
 | ||||
| 	template<class Conditional> | ||||
|  |  | |||
|  | @ -97,6 +97,9 @@ namespace gtsam { | |||
| 		inline const_reverse_iterator const rbegin() const {return conditionals_.rbegin();} | ||||
| 		inline const_reverse_iterator const rend()   const {return conditionals_.rend();} | ||||
| 
 | ||||
| 		/** saves the bayes to a text file in GraphViz format */ | ||||
| 		void saveGraph(const std::string& s) const; | ||||
| 
 | ||||
| 	private: | ||||
| 		/** Serialization function */ | ||||
| 		friend class boost::serialization::access; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue