aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::prm::gspan::InterfaceGraph< GUM_SCALAR > Class Template Reference

This class represent the interface graph of a given gum::prm::PRMSystem<GUM_SCALAR>. More...

#include <agrum/PRM/gspan/interfaceGraph.h>

+ Collaboration diagram for gum::prm::gspan::InterfaceGraph< GUM_SCALAR >:

Public Member Functions

 InterfaceGraph (const PRMSystem< GUM_SCALAR > &sys)
 Default constructor. More...
 
 InterfaceGraph (const InterfaceGraph &source)
 Copy constructor, proceeds with a shallow copy so for friends only. More...
 
InterfaceGraphoperator= (const InterfaceGraph &source)
 Copy operator. More...
 
 ~InterfaceGraph ()
 Destructor. More...
 
UndiGraphgraph ()
 Returns the graph of this interface graph. More...
 
const UndiGraphgraph () const
 Returns the graph of this interface graph. More...
 
Bijection< Idx, LabelData *> & labels ()
 Returns the bijection between LabelData and their string representation. More...
 
const Bijection< Idx, LabelData *> & labels () const
 Returns the bijection between LabelData and their string representation. More...
 
Size size (const LabelData *l) const
 Returns the number of node or edges labelled by l. More...
 
Set< NodeData< GUM_SCALAR > *> & nodes (const LabelData *l)
 Returns the set of nodes labelled by l. More...
 
const Set< NodeData< GUM_SCALAR > *> & nodes (const LabelData *l) const
 Returns the set of nodes labelled by l. More...
 
Set< EdgeData< GUM_SCALAR > *> & edges (const LabelData *l)
 Returns the set of nodes labelled by l. More...
 
const Set< EdgeData< GUM_SCALAR > *> & edges (const LabelData *l) const
 Returns the set of nodes labelled by l. More...
 
LabelDatalabel (Idx id)
 Returns a label given its id. More...
 
NodeId id (const PRMInstance< GUM_SCALAR > &i) const
 Returns the id of i in this interface graph. More...
 
NodeId id (const PRMInstance< GUM_SCALAR > *i) const
 Returns the id of i in this interface graph. More...
 
NodeData< GUM_SCALAR > & node (const PRMInstance< GUM_SCALAR > *i)
 Returns data about a node. More...
 
const NodeData< GUM_SCALAR > & node (const PRMInstance< GUM_SCALAR > *i) const
 Returns data about a node. More...
 
NodeData< GUM_SCALAR > & node (NodeId id)
 Returns data about a node. More...
 
const NodeData< GUM_SCALAR > & node (NodeId id) const
 Returns data about a node. More...
 
EdgeData< GUM_SCALAR > & edge (NodeId u, NodeId v)
 Returns data about an edge. More...
 
const EdgeData< GUM_SCALAR > & edge (NodeId u, NodeId v) const
 Returns data about an edge. More...
 

Friends

class gum::prm::GSpan< GUM_SCALAR >
 

Detailed Description

template<typename GUM_SCALAR>
class gum::prm::gspan::InterfaceGraph< GUM_SCALAR >

This class represent the interface graph of a given gum::prm::PRMSystem<GUM_SCALAR>.

An interface graph is a labelled graph over the instances of a gum::prm::PRMSystem<GUM_SCALAR>, where there exists an edge between two instance i and j if and only if their shared interface is nonempty.

Labels assigned to edges and nodes in the interface graph are technically strings, however since we need a linear oder each label is assigned a unique id.

Definition at line 164 of file interfaceGraph.h.

Constructor & Destructor Documentation

◆ InterfaceGraph() [1/2]

template<typename GUM_SCALAR >
gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::InterfaceGraph ( const PRMSystem< GUM_SCALAR > &  sys)
explicit

Default constructor.

Definition at line 94 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

94  :
95  _sys_(&sys), _labels_(new Bijection< Idx, LabelData* >()), _counter_(0),
96  _erase_flag_(true) {
97  GUM_CONSTRUCTOR(InterfaceGraph);
98  HashTable< std::string, LabelData* > label_map;
99 
100  // We need to add each instance in _graph_
101  for (auto iter = sys.begin(); iter != sys.end(); ++iter) {
102  NodeData< GUM_SCALAR >* node = new NodeData< GUM_SCALAR >();
103  node->n = iter.val();
104  _label_(node, label_map);
105  _graph_.addNodeWithId(iter.key());
106  _idMap_.insert(node->n, iter.key());
107  _nodes_.insert(iter.key(), node);
108  }
109 
110  NodeData< GUM_SCALAR >* u = nullptr;
111  NodeData< GUM_SCALAR >* v = nullptr;
112 
113  for (const auto& elt: _nodes_) {
114  NodeData< GUM_SCALAR >* data = elt.second;
115 
116  for (const auto chain: data->n->type().slotChains()) {
117  for (const auto inst: data->n->getInstances(chain->id())) {
118  u = (_nodes_[_idMap_[inst]]->l < data->l) ? _nodes_[_idMap_[inst]] : data;
119  v = (u != data) ? data : _nodes_[_idMap_[inst]];
120 
121  if (!_graph_.existsEdge(_idMap_[u->n], _idMap_[v->n])) {
122  EdgeData< GUM_SCALAR >* edge = new EdgeData< GUM_SCALAR >();
123  edge->u = u->n;
124  edge->l_u = u->l;
125  edge->v = v->n;
126  edge->l_v = v->l;
127  _label_(edge, label_map);
128  _graph_.addEdge(_idMap_[u->n], _idMap_[v->n]);
129  _edges_.insert(Edge(_idMap_[u->n], _idMap_[v->n]), edge);
130  }
131  }
132  }
133  }
134  }
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
HashTable< PRMInstance< GUM_SCALAR > *, NodeId > _idMap_
Mapping between PRMInstance<GUM_SCALAR> dans their id in graph.
Idx _counter_
A counter used of assigning ids to labels.
NodeData< GUM_SCALAR > & node(const PRMInstance< GUM_SCALAR > *i)
Returns data about a node.
EdgeProperty< EdgeData< GUM_SCALAR > *> _edges_
Data associated with edges in graph.
const PRMSystem< GUM_SCALAR > * _sys_
The gum::prm::PRMSystem<GUM_SCALAR> represented by this interface graph.
void _label_(NodeData< GUM_SCALAR > *node, HashTable< std::string, LabelData * > &label_map)
Compute the label of node and add it to labels if it does not exists yet. Update node with the correc...
bool _erase_flag_
For shallow copies.
bool existsEdge(const Edge &edge) const
indicates whether a given edge exists
InterfaceGraph(const PRMSystem< GUM_SCALAR > &sys)
Default constructor.
Bijection< Idx, LabelData *> * _labels_
Bijection between labels and their ids.
UndiGraph _graph_
The interface graph.
EdgeData< GUM_SCALAR > & edge(NodeId u, NodeId v)
Returns data about an edge.
void addEdge(NodeId first, NodeId second) override
insert a new edge into the undirected graph
Definition: undiGraph_inl.h:34
NodeProperty< NodeData< GUM_SCALAR > *> _nodes_
Data associated with a node in graph.
+ Here is the call graph for this function:

◆ InterfaceGraph() [2/2]

template<typename GUM_SCALAR >
gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::InterfaceGraph ( const InterfaceGraph< GUM_SCALAR > &  source)

Copy constructor, proceeds with a shallow copy so for friends only.

Definition at line 137 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

137  :
138  _sys_(source._sys_), _graph_(source._graph_), _nodes_(source._nodes_),
139  _idMap_(source._idMap_), _edges_(source._edges_),
140  _labels_(new Bijection< Idx, LabelData* >(*(source._labels_))),
141  _nodeMap_(source._nodeMap_), _edgeMap_(source._edgeMap_), _counter_(source._counter_),
142  _erase_flag_(false) {
143  GUM_CONS_CPY(InterfaceGraph);
144  }
HashTable< LabelData *, Set< NodeData< GUM_SCALAR > *> *> _nodeMap_
Mapping between a LabelData and the set of NodeData<GUM_SCALAR> with that label.
HashTable< PRMInstance< GUM_SCALAR > *, NodeId > _idMap_
Mapping between PRMInstance<GUM_SCALAR> dans their id in graph.
Idx _counter_
A counter used of assigning ids to labels.
EdgeProperty< EdgeData< GUM_SCALAR > *> _edges_
Data associated with edges in graph.
const PRMSystem< GUM_SCALAR > * _sys_
The gum::prm::PRMSystem<GUM_SCALAR> represented by this interface graph.
bool _erase_flag_
For shallow copies.
InterfaceGraph(const PRMSystem< GUM_SCALAR > &sys)
Default constructor.
Bijection< Idx, LabelData *> * _labels_
Bijection between labels and their ids.
UndiGraph _graph_
The interface graph.
NodeProperty< NodeData< GUM_SCALAR > *> _nodes_
Data associated with a node in graph.
HashTable< LabelData *, Set< EdgeData< GUM_SCALAR > *> *> _edgeMap_
Mapping between a LabelData and the set of EdgeData<GUM_SCALAR> with that label.
+ Here is the call graph for this function:

◆ ~InterfaceGraph()

template<typename GUM_SCALAR >
gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::~InterfaceGraph ( )

Destructor.

Definition at line 147 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

147  {
148  GUM_DESTRUCTOR(InterfaceGraph);
149 
150  if (_erase_flag_) {
151  for (const auto& elt: _nodes_)
152  delete elt.second;
153 
154  for (const auto& elt: _edges_)
155  delete elt.second;
156 
157  for (const auto& elt: _nodeMap_) {
158  delete elt.first;
159  delete elt.second;
160  }
161 
162  for (const auto& elt: _edgeMap_) {
163  delete elt.first;
164  delete elt.second;
165  }
166  }
167 
168  delete _labels_;
169  }
HashTable< LabelData *, Set< NodeData< GUM_SCALAR > *> *> _nodeMap_
Mapping between a LabelData and the set of NodeData<GUM_SCALAR> with that label.
EdgeProperty< EdgeData< GUM_SCALAR > *> _edges_
Data associated with edges in graph.
bool _erase_flag_
For shallow copies.
InterfaceGraph(const PRMSystem< GUM_SCALAR > &sys)
Default constructor.
Bijection< Idx, LabelData *> * _labels_
Bijection between labels and their ids.
NodeProperty< NodeData< GUM_SCALAR > *> _nodes_
Data associated with a node in graph.
HashTable< LabelData *, Set< EdgeData< GUM_SCALAR > *> *> _edgeMap_
Mapping between a LabelData and the set of EdgeData<GUM_SCALAR> with that label.
+ Here is the call graph for this function:

Member Function Documentation

◆ _label_() [1/2]

template<typename GUM_SCALAR >
void gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::_label_ ( NodeData< GUM_SCALAR > *  node,
HashTable< std::string, LabelData * > &  label_map 
)
private

Compute the label of node and add it to labels if it does not exists yet. Update node with the correct label's id.

Definition at line 178 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

179  {
180  Size size = Size(1);
181  std::stringstream sBuff;
182  sBuff << node->n->type().name();
183 
184  // First we search for multiple inputs
185  for (const auto chain: node->n->type().slotChains()) {
186  if (chain->isMultiple()) {
187  sBuff << "-" << node->n->getInstances(chain->id()).size();
188  sBuff << chain->name();
189  size *= node->n->getInstances(chain->id()).size()
190  * chain->lastElt().type().variable().domainSize();
191  } else {
192  size *= chain->lastElt().type().variable().domainSize();
193  }
194  }
195 
196  // Second we search for active outputs
197  for (const auto nn: node->n->type().containerDag().nodes()) {
198  if (node->n->type().isOutputNode(node->n->type().get(nn))) {
199  try {
200  sBuff << "-" << node->n->getRefAttr(nn).size() << node->n->get(nn).name();
201  size *= node->n->get(nn).type().variable().domainSize();
202  } catch (NotFound&) {
203  // (nn) is an inactive output node
204  }
205  }
206  }
207 
208  // Label is ready
209  if (!label_map.exists(sBuff.str())) {
210  LabelData* label = new LabelData();
211  label_map.insert(sBuff.str(), label);
212  label->id = ++_counter_;
213  label->tree_width = size;
214  label->l = sBuff.str();
215  _labels_->insert(label->id, label);
216  _nodeMap_.insert(label, new Set< NodeData< GUM_SCALAR >* >());
217  }
218 
219  node->l = label_map[sBuff.str()];
220  _nodeMap_[node->l]->insert(node);
221  }
HashTable< LabelData *, Set< NodeData< GUM_SCALAR > *> *> _nodeMap_
Mapping between a LabelData and the set of NodeData<GUM_SCALAR> with that label.
Idx _counter_
A counter used of assigning ids to labels.
NodeData< GUM_SCALAR > & node(const PRMInstance< GUM_SCALAR > *i)
Returns data about a node.
LabelData * label(Idx id)
Returns a label given its id.
Bijection< Idx, LabelData *> * _labels_
Bijection between labels and their ids.
Size size(const LabelData *l) const
Returns the number of node or edges labelled by l.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:47
+ Here is the call graph for this function:

◆ _label_() [2/2]

template<typename GUM_SCALAR >
void gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::_label_ ( EdgeData< GUM_SCALAR > *  edge,
HashTable< std::string, LabelData * > &  label_map 
)
private

Compute the label of edge and add it to labels if it does not exists yet. Update edge with the correct label's id.

Definition at line 224 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

225  {
226  Size size = Size(1);
227  std::stringstream sBuff;
228  sBuff << edge->u->type().name() << "-" << edge->v->type().name();
229 
230  // First looking for edge->u output nodes in v
231  for (const auto chain: edge->u->type().slotChains()) {
232  if (edge->u->getInstances(chain->id()).exists(edge->v)) {
233  sBuff << "-" << edge->v->type().name() << "." << chain->lastElt().name();
234  size *= chain->lastElt().type().variable().domainSize();
235  }
236  }
237 
238  // Second looking for edge->v output nodes in u
239  for (const auto chain: edge->v->type().slotChains())
240  if (edge->v->getInstances(chain->id()).exists(edge->u)) {
241  sBuff << "-" << edge->u->type().name() << "." << chain->lastElt().name();
242  size *= chain->lastElt().type().variable().domainSize();
243  }
244 
245  // Label is ready
246  if (!label_map.exists(sBuff.str())) {
247  LabelData* label = new LabelData();
248  label_map.insert(sBuff.str(), label);
249  label->id = ++_counter_;
250  label->l = sBuff.str();
251  label->tree_width = size;
252  _labels_->insert(label->id, label);
253  _edgeMap_.insert(label, new Set< EdgeData< GUM_SCALAR >* >());
254  }
255 
256  edge->l = label_map[sBuff.str()];
257  _edgeMap_[edge->l]->insert(edge);
258  }
Idx _counter_
A counter used of assigning ids to labels.
LabelData * label(Idx id)
Returns a label given its id.
Bijection< Idx, LabelData *> * _labels_
Bijection between labels and their ids.
Size size(const LabelData *l) const
Returns the number of node or edges labelled by l.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:47
EdgeData< GUM_SCALAR > & edge(NodeId u, NodeId v)
Returns data about an edge.
HashTable< LabelData *, Set< EdgeData< GUM_SCALAR > *> *> _edgeMap_
Mapping between a LabelData and the set of EdgeData<GUM_SCALAR> with that label.
+ Here is the call graph for this function:

◆ edge() [1/2]

template<typename GUM_SCALAR >
INLINE EdgeData< GUM_SCALAR > & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::edge ( NodeId  u,
NodeId  v 
)

Returns data about an edge.

Exceptions
NotFound

Definition at line 349 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

349  {
350  try {
351  return *(_edges_[Edge(u, v)]);
352  } catch (NotFound&) { return *(_edges_[Edge(v, u)]); }
353  }
EdgeProperty< EdgeData< GUM_SCALAR > *> _edges_
Data associated with edges in graph.
+ Here is the call graph for this function:

◆ edge() [2/2]

template<typename GUM_SCALAR >
INLINE const EdgeData< GUM_SCALAR > & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::edge ( NodeId  u,
NodeId  v 
) const

Returns data about an edge.

Exceptions
NotFound

Definition at line 356 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

357  {
358  try {
359  return *(_edges_[Edge(u, v)]);
360  } catch (NotFound&) { return *(_edges_[Edge(v, u)]); }
361  }
EdgeProperty< EdgeData< GUM_SCALAR > *> _edges_
Data associated with edges in graph.
+ Here is the call graph for this function:

◆ edges() [1/2]

template<typename GUM_SCALAR >
INLINE Set< EdgeData< GUM_SCALAR > *> & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::edges ( const LabelData l)

Returns the set of nodes labelled by l.

Definition at line 301 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

301  {
302  return *(_edgeMap_[const_cast< LabelData* >(l)]);
303  }
HashTable< LabelData *, Set< EdgeData< GUM_SCALAR > *> *> _edgeMap_
Mapping between a LabelData and the set of EdgeData<GUM_SCALAR> with that label.
+ Here is the call graph for this function:

◆ edges() [2/2]

template<typename GUM_SCALAR >
INLINE const Set< EdgeData< GUM_SCALAR > *> & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::edges ( const LabelData l) const

Returns the set of nodes labelled by l.

Definition at line 307 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

307  {
308  return *(_edgeMap_[const_cast< LabelData* >(l)]);
309  }
HashTable< LabelData *, Set< EdgeData< GUM_SCALAR > *> *> _edgeMap_
Mapping between a LabelData and the set of EdgeData<GUM_SCALAR> with that label.
+ Here is the call graph for this function:

◆ graph() [1/2]

template<typename GUM_SCALAR >
INLINE UndiGraph & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::graph ( )

Returns the graph of this interface graph.

Definition at line 261 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

261  {
262  return _graph_;
263  }
UndiGraph _graph_
The interface graph.
+ Here is the call graph for this function:

◆ graph() [2/2]

template<typename GUM_SCALAR >
INLINE const UndiGraph & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::graph ( ) const

Returns the graph of this interface graph.

Definition at line 266 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

266  {
267  return _graph_;
268  }
UndiGraph _graph_
The interface graph.
+ Here is the call graph for this function:

◆ id() [1/2]

template<typename GUM_SCALAR >
INLINE NodeId gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::id ( const PRMInstance< GUM_SCALAR > &  i) const

Returns the id of i in this interface graph.

Definition at line 317 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

317  {
318  return _idMap_[const_cast< PRMInstance< GUM_SCALAR >* >(&i)];
319  }
HashTable< PRMInstance< GUM_SCALAR > *, NodeId > _idMap_
Mapping between PRMInstance<GUM_SCALAR> dans their id in graph.
+ Here is the call graph for this function:

◆ id() [2/2]

template<typename GUM_SCALAR >
INLINE NodeId gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::id ( const PRMInstance< GUM_SCALAR > *  i) const

Returns the id of i in this interface graph.

Definition at line 322 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

322  {
323  return _idMap_[const_cast< PRMInstance< GUM_SCALAR >* >(i)];
324  }
HashTable< PRMInstance< GUM_SCALAR > *, NodeId > _idMap_
Mapping between PRMInstance<GUM_SCALAR> dans their id in graph.
+ Here is the call graph for this function:

◆ label()

template<typename GUM_SCALAR >
INLINE LabelData * gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::label ( Idx  id)

Returns a label given its id.

Definition at line 312 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

312  {
313  return _labels_->second(id);
314  }
Bijection< Idx, LabelData *> * _labels_
Bijection between labels and their ids.
+ Here is the call graph for this function:

◆ labels() [1/2]

template<typename GUM_SCALAR >
INLINE Bijection< Idx, LabelData *> & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::labels ( )

Returns the bijection between LabelData and their string representation.

Definition at line 271 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

271  {
272  return *_labels_;
273  }
Bijection< Idx, LabelData *> * _labels_
Bijection between labels and their ids.
+ Here is the call graph for this function:

◆ labels() [2/2]

template<typename GUM_SCALAR >
INLINE const Bijection< Idx, LabelData *> & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::labels ( ) const

Returns the bijection between LabelData and their string representation.

Definition at line 276 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

276  {
277  return *_labels_;
278  }
Bijection< Idx, LabelData *> * _labels_
Bijection between labels and their ids.
+ Here is the call graph for this function:

◆ node() [1/4]

template<typename GUM_SCALAR >
INLINE NodeData< GUM_SCALAR > & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::node ( const PRMInstance< GUM_SCALAR > *  i)

Returns data about a node.

Exceptions
NotFound

Definition at line 328 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

328  {
329  return node(id(i));
330  }
NodeData< GUM_SCALAR > & node(const PRMInstance< GUM_SCALAR > *i)
Returns data about a node.
+ Here is the call graph for this function:

◆ node() [2/4]

template<typename GUM_SCALAR >
INLINE const NodeData< GUM_SCALAR > & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::node ( const PRMInstance< GUM_SCALAR > *  i) const

Returns data about a node.

Exceptions
NotFound

Definition at line 334 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

334  {
335  return node(id(i));
336  }
NodeData< GUM_SCALAR > & node(const PRMInstance< GUM_SCALAR > *i)
Returns data about a node.
+ Here is the call graph for this function:

◆ node() [3/4]

template<typename GUM_SCALAR >
INLINE NodeData< GUM_SCALAR > & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::node ( NodeId  id)

Returns data about a node.

Exceptions
NotFound

Definition at line 339 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

339  {
340  return *(_nodes_[id]);
341  }
NodeId id(const PRMInstance< GUM_SCALAR > &i) const
Returns the id of i in this interface graph.
NodeProperty< NodeData< GUM_SCALAR > *> _nodes_
Data associated with a node in graph.
+ Here is the call graph for this function:

◆ node() [4/4]

template<typename GUM_SCALAR >
INLINE const NodeData< GUM_SCALAR > & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::node ( NodeId  id) const

Returns data about a node.

Exceptions
NotFound

Definition at line 344 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

344  {
345  return *(_nodes_[id]);
346  }
NodeId id(const PRMInstance< GUM_SCALAR > &i) const
Returns the id of i in this interface graph.
NodeProperty< NodeData< GUM_SCALAR > *> _nodes_
Data associated with a node in graph.
+ Here is the call graph for this function:

◆ nodes() [1/2]

template<typename GUM_SCALAR >
INLINE Set< NodeData< GUM_SCALAR > *> & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::nodes ( const LabelData l)

Returns the set of nodes labelled by l.

Definition at line 289 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

289  {
290  return *(_nodeMap_[const_cast< LabelData* >(l)]);
291  }
HashTable< LabelData *, Set< NodeData< GUM_SCALAR > *> *> _nodeMap_
Mapping between a LabelData and the set of NodeData<GUM_SCALAR> with that label.
+ Here is the call graph for this function:

◆ nodes() [2/2]

template<typename GUM_SCALAR >
INLINE const Set< NodeData< GUM_SCALAR > *> & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::nodes ( const LabelData l) const

Returns the set of nodes labelled by l.

Definition at line 295 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

295  {
296  return *(_nodeMap_[const_cast< LabelData* >(l)]);
297  }
HashTable< LabelData *, Set< NodeData< GUM_SCALAR > *> *> _nodeMap_
Mapping between a LabelData and the set of NodeData<GUM_SCALAR> with that label.
+ Here is the call graph for this function:

◆ operator=()

template<typename GUM_SCALAR >
InterfaceGraph< GUM_SCALAR > & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::operator= ( const InterfaceGraph< GUM_SCALAR > &  source)

Copy operator.

Definition at line 173 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

173  {
174  GUM_ERROR(FatalError, "not implemented")
175  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ size()

template<typename GUM_SCALAR >
INLINE Size gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::size ( const LabelData l) const

Returns the number of node or edges labelled by l.

Definition at line 281 of file interfaceGraph_tpl.h.

References gum::prm::gspan::operator<<().

281  {
282  try {
283  return _nodeMap_[const_cast< LabelData* >(l)]->size();
284  } catch (NotFound&) { return _edgeMap_[const_cast< LabelData* >(l)]->size(); }
285  }
HashTable< LabelData *, Set< NodeData< GUM_SCALAR > *> *> _nodeMap_
Mapping between a LabelData and the set of NodeData<GUM_SCALAR> with that label.
Size size(const LabelData *l) const
Returns the number of node or edges labelled by l.
HashTable< LabelData *, Set< EdgeData< GUM_SCALAR > *> *> _edgeMap_
Mapping between a LabelData and the set of EdgeData<GUM_SCALAR> with that label.
+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ gum::prm::GSpan< GUM_SCALAR >

template<typename GUM_SCALAR >
friend class gum::prm::GSpan< GUM_SCALAR >
friend

Definition at line 165 of file interfaceGraph.h.

Member Data Documentation

◆ _counter_

template<typename GUM_SCALAR >
Idx gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::_counter_
private

A counter used of assigning ids to labels.

Definition at line 273 of file interfaceGraph.h.

◆ _edgeMap_

template<typename GUM_SCALAR >
HashTable< LabelData*, Set< EdgeData< GUM_SCALAR >* >* > gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::_edgeMap_
private

Mapping between a LabelData and the set of EdgeData<GUM_SCALAR> with that label.

Definition at line 270 of file interfaceGraph.h.

◆ _edges_

template<typename GUM_SCALAR >
EdgeProperty< EdgeData< GUM_SCALAR >* > gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::_edges_
private

Data associated with edges in graph.

Definition at line 257 of file interfaceGraph.h.

◆ _erase_flag_

template<typename GUM_SCALAR >
bool gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::_erase_flag_
private

For shallow copies.

Definition at line 276 of file interfaceGraph.h.

◆ _graph_

template<typename GUM_SCALAR >
UndiGraph gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::_graph_
private

The interface graph.

Definition at line 248 of file interfaceGraph.h.

◆ _idMap_

template<typename GUM_SCALAR >
HashTable< PRMInstance< GUM_SCALAR >*, NodeId > gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::_idMap_
private

Mapping between PRMInstance<GUM_SCALAR> dans their id in graph.

Definition at line 254 of file interfaceGraph.h.

◆ _labels_

template<typename GUM_SCALAR >
Bijection< Idx, LabelData* >* gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::_labels_
private

Bijection between labels and their ids.

Definition at line 260 of file interfaceGraph.h.

◆ _nodeMap_

template<typename GUM_SCALAR >
HashTable< LabelData*, Set< NodeData< GUM_SCALAR >* >* > gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::_nodeMap_
private

Mapping between a LabelData and the set of NodeData<GUM_SCALAR> with that label.

Definition at line 265 of file interfaceGraph.h.

◆ _nodes_

template<typename GUM_SCALAR >
NodeProperty< NodeData< GUM_SCALAR >* > gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::_nodes_
private

Data associated with a node in graph.

Definition at line 251 of file interfaceGraph.h.

◆ _sys_

template<typename GUM_SCALAR >
const PRMSystem< GUM_SCALAR >* gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::_sys_
private

The gum::prm::PRMSystem<GUM_SCALAR> represented by this interface graph.

Definition at line 245 of file interfaceGraph.h.


The documentation for this class was generated from the following files: