From 46080d7d5aef2e8311c1ac4c39157e4950b29c70 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sun, 19 Dec 2021 10:20:05 -0500 Subject: [PATCH] reversed order of nodes in dot --- gtsam/discrete/tests/testDiscreteBayesNet.cpp | 8 +++++++- gtsam/inference/BayesNet-inst.h | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gtsam/discrete/tests/testDiscreteBayesNet.cpp b/gtsam/discrete/tests/testDiscreteBayesNet.cpp index ee7af73b9..f0c7d3728 100644 --- a/gtsam/discrete/tests/testDiscreteBayesNet.cpp +++ b/gtsam/discrete/tests/testDiscreteBayesNet.cpp @@ -163,7 +163,13 @@ TEST(DiscreteBayesNet, Dot) { fragment.add((Either | Tuberculosis, LungCancer) = "F T T T"); string actual = fragment.dot(); - EXPECT(actual == "digraph G{\n3->5\n6->5\n4->6\n0->3\n}"); + EXPECT(actual == + "digraph G{\n" + "0->3\n" + "4->6\n" + "3->5\n" + "6->5\n" + "}"); } /* ************************************************************************* */ diff --git a/gtsam/inference/BayesNet-inst.h b/gtsam/inference/BayesNet-inst.h index 4674b0083..be34b2928 100644 --- a/gtsam/inference/BayesNet-inst.h +++ b/gtsam/inference/BayesNet-inst.h @@ -39,8 +39,8 @@ void BayesNet::dot(std::ostream& os, const KeyFormatter& keyFormatter) const { os << "digraph G{\n"; - for (auto conditional : boost::adaptors::reverse(*this)) { - typename CONDITIONAL::Frontals frontals = conditional->frontals(); + for (auto conditional : *this) { + auto frontals = conditional->frontals(); const Key me = frontals.front(); auto parents = conditional->parents(); for (const Key& p : parents)