From 60da4cb2f9a448ad70298086f1681abc403110a0 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sat, 15 Sep 2012 02:53:06 +0000 Subject: [PATCH] Reversed saving of nodes --- gtsam/inference/BayesNet-inl.h | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/gtsam/inference/BayesNet-inl.h b/gtsam/inference/BayesNet-inl.h index e113b7628..69d09a8dc 100644 --- a/gtsam/inference/BayesNet-inl.h +++ b/gtsam/inference/BayesNet-inl.h @@ -74,15 +74,13 @@ namespace gtsam { std::ofstream of(s.c_str()); of << "digraph G{\n"; - BOOST_FOREACH(typename CONDITIONAL::shared_ptr conditional, conditionals_) { - typename CONDITIONAL::Frontals frontals = conditional->frontals(); - Index me = frontals.front(); -// of << me << std::endl; - typename CONDITIONAL::Parents parents = conditional->parents(); - BOOST_FOREACH(Index p, parents) - of << p << "->" << me << std::endl; - } - + BOOST_REVERSE_FOREACH(typename CONDITIONAL::shared_ptr conditional, conditionals_) { + typename CONDITIONAL::Frontals frontals = conditional->frontals(); + Index me = frontals.front(); + typename CONDITIONAL::Parents parents = conditional->parents(); + BOOST_FOREACH(Index p, parents) + of << p << "->" << me << std::endl; + } of << "}"; of.close();