aGrUM  0.16.0
edgeGrowth_tpl.h
Go to the documentation of this file.
1 
31 
32 namespace gum {
33  namespace prm {
34  namespace gspan {
35 
36  template < typename GUM_SCALAR >
38  LabelData* an_edge,
39  LabelData* a_l_v,
40  NodeId a_v) :
41  u(a_u),
42  edge(an_edge), l_v(a_l_v), v(a_v),
43  degree_list(new std::vector< NodeId >()) {
44  GUM_CONSTRUCTOR(EdgeGrowth);
45  }
46 
47  template < typename GUM_SCALAR >
49  const EdgeGrowth< GUM_SCALAR >& from) :
50  u(from.u),
51  edge(from.edge), v(from.v), matches(from.matches),
54  GUM_CONS_CPY(EdgeGrowth);
55 
56  if (from.degree_list != 0) {
57  degree_list = new std::vector< NodeId >(*(from.degree_list));
58  }
59  }
60 
61  template < typename GUM_SCALAR >
63  GUM_DESTRUCTOR(EdgeGrowth);
64 
65  if (degree_list != 0) { delete degree_list; }
66  }
67 
68  template < typename GUM_SCALAR >
69  INLINE std::string EdgeGrowth< GUM_SCALAR >::toString() {
70  std::stringstream str;
71  str << u << "-" << edge << "-" << l_v << "-" << v;
72  return str.str();
73  }
74 
75  template < typename GUM_SCALAR >
78  NodeId id = iso_graph.addNode();
79  degree_list->push_back(id);
80 
81  for (const auto& elt : matches) {
82  if ((elt.second.first == u) || (elt.second.second == u)
83  || (elt.second.first == v) || (elt.second.second == v)) {
84  iso_graph.addEdge(elt.first, id);
85  }
86  }
87 
88  // The order between u and v is important ! DO NOT INVERSE IT !
89  matches.insert(id, std::make_pair(u, v));
90  }
91 
92  } /* namespace gspan */
93  } /* namespace prm */
94 } /* namespace gum */
Set< NodeId > max_indep_set
The max indep set of matches.
Definition: edgeGrowth.h:100
This class is used to define an edge growth of a pattern in this DFSTree.
Definition: edgeGrowth.h:63
LabelData * l_v
The LabelData over the node of this edge growth.
Definition: edgeGrowth.h:80
Inner class to handle data about labels in this interface graph.
An PRMInstance is a Bayesian Network fragment defined by a Class and used in a PRMSystem.
Definition: PRMInstance.h:63
virtual void addEdge(const NodeId first, const NodeId second)
insert a new edge into the undirected graph
Definition: undiGraph_inl.h:35
STL namespace.
NodeProperty< std::pair< PRMInstance< GUM_SCALAR > *, PRMInstance< GUM_SCALAR > *> > matches
The mapping between the u and v for each match in the interface graph.
Definition: edgeGrowth.h:90
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
LabelData * edge
The LabelData over the edge of this edge growth.
Definition: edgeGrowth.h:78
std::vector< NodeId > * degree_list
Vector used for computation.
Definition: edgeGrowth.h:98
virtual NodeId addNode()
insert a new node and return its id
NodeId u
The id of the node from which we grow an edge.
Definition: edgeGrowth.h:76
NodeId v
If the growth is backward you must assigned the subscript of v, otherwise 0 is assigned (recall that ...
Definition: edgeGrowth.h:83
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::string toString()
Return a string representation of this.
UndiGraph iso_graph
The iso graph for computing the maximum independent set of matches.
Definition: edgeGrowth.h:96
Size NodeId
Type for node ids.
Definition: graphElements.h:98
void insert(PRMInstance< GUM_SCALAR > *u, PRMInstance< GUM_SCALAR > *v)
Add the pair (u,v) as a match for the current growth.
EdgeGrowth(NodeId a_u, LabelData *an_edge, LabelData *a_l_v, NodeId a_v=0)
Constructor.