aGrUM  0.16.0
structuralComparator_tpl.h
Go to the documentation of this file.
1 
23 #ifndef DOXYGEN_SHOULD_SKIP_THIS
24 
26 # include <agrum/graphs/mixedGraph.h>
27 
28 namespace gum {
29 
30  template < typename GS1, typename GS2 >
31  void StructuralComparator::compare(const BayesNet< GS1 >& ref,
32  const BayesNet< GS2 >& test) {
33  if (ref.size() != test.size()) {
34  GUM_ERROR(OperationNotAllowed, "Graphs of different sizes");
35  }
36  for (const NodeId node : ref.dag().asNodeSet()) {
37  if (!test.dag().existsNode(node)) {
38  GUM_ERROR(InvalidNode,
39  "Test doesn't contain node " << node << " from ref");
40  }
41  }
42 
43  MixedGraph ref_eg = EssentialGraph(ref).mixedGraph();
44  MixedGraph test_eg = EssentialGraph(test).mixedGraph();
45 
46  this->compare(ref_eg, test_eg);
47  }
48 
49  template < typename GUM_SCALAR >
50  void StructuralComparator::compare(const BayesNet< GUM_SCALAR >& ref,
51  const MixedGraph& test) {
52  MixedGraph ref_eg = EssentialGraph(ref).mixedGraph();
53  this->compare(ref_eg, test);
54  }
55 
56  template < typename GUM_SCALAR >
57  void StructuralComparator::compare(const MixedGraph& ref,
58  const BayesNet< GUM_SCALAR >& test) {
59  MixedGraph test_eg = EssentialGraph(test).mixedGraph();
60 
61  this->compare(ref, test_eg);
62  }
63 } /* namespace gum */
64 
65 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void compare(const DiGraph &ref, const DiGraph &test)
compare two DiGraphs
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Size NodeId
Type for node ids.
Definition: graphElements.h:98
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55