aGrUM  0.16.0
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 167 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 99 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__edges, gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__graph, gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__idMap, gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__label(), gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__nodes, gum::UndiGraph::addEdge(), gum::NodeGraphPart::addNodeWithId(), gum::prm::PRMSystem< GUM_SCALAR >::begin(), gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::edge(), gum::prm::PRMSystem< GUM_SCALAR >::end(), gum::EdgeGraphPart::existsEdge(), gum::prm::gspan::NodeData< GUM_SCALAR >::l, gum::prm::gspan::EdgeData< GUM_SCALAR >::l_u, gum::prm::gspan::EdgeData< GUM_SCALAR >::l_v, gum::prm::gspan::NodeData< GUM_SCALAR >::n, gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::node(), gum::prm::gspan::EdgeData< GUM_SCALAR >::u, and gum::prm::gspan::EdgeData< GUM_SCALAR >::v.

100  :
101  __sys(&sys),
102  __labels(new Bijection< Idx, LabelData* >()), __counter(0),
103  __erase_flag(true) {
104  GUM_CONSTRUCTOR(InterfaceGraph);
105  HashTable< std::string, LabelData* > label_map;
106 
107  // We need to add each instance in __graph
108  for (auto iter = sys.begin(); iter != sys.end(); ++iter) {
109  NodeData< GUM_SCALAR >* node = new NodeData< GUM_SCALAR >();
110  node->n = iter.val();
111  __label(node, label_map);
112  __graph.addNodeWithId(iter.key());
113  __idMap.insert(node->n, iter.key());
114  __nodes.insert(iter.key(), node);
115  }
116 
117  NodeData< GUM_SCALAR >* u = nullptr;
118  NodeData< GUM_SCALAR >* v = nullptr;
119 
120  for (const auto& elt : __nodes) {
121  NodeData< GUM_SCALAR >* data = elt.second;
122 
123  for (const auto chain : data->n->type().slotChains()) {
124  for (const auto inst : data->n->getInstances(chain->id())) {
125  u = (__nodes[__idMap[inst]]->l < data->l) ? __nodes[__idMap[inst]]
126  : data;
127  v = (u != data) ? data : __nodes[__idMap[inst]];
128 
129  if (!__graph.existsEdge(__idMap[u->n], __idMap[v->n])) {
130  EdgeData< GUM_SCALAR >* edge = new EdgeData< GUM_SCALAR >();
131  edge->u = u->n;
132  edge->l_u = u->l;
133  edge->v = v->n;
134  edge->l_v = v->l;
135  __label(edge, label_map);
136  __graph.addEdge(__idMap[u->n], __idMap[v->n]);
137  __edges.insert(Edge(__idMap[u->n], __idMap[v->n]), edge);
138  }
139  }
140  }
141  }
142  }
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
virtual void addEdge(const NodeId first, const NodeId second)
insert a new edge into the undirected graph
Definition: undiGraph_inl.h:35
NodeProperty< NodeData< GUM_SCALAR > *> __nodes
Data associated with a node in __graph.
UndiGraph __graph
The interface graph.
NodeData< GUM_SCALAR > & node(const PRMInstance< GUM_SCALAR > *i)
Returns data about a node.
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 existsEdge(const Edge &edge) const
indicates whether a given edge exists
InterfaceGraph(const PRMSystem< GUM_SCALAR > &sys)
Default constructor.
bool __erase_flag
For shallow copies.
HashTable< PRMInstance< GUM_SCALAR > *, NodeId > __idMap
Mapping between PRMInstance<GUM_SCALAR> dans their id in __graph.
Bijection< Idx, LabelData *> * __labels
Bijection between labels and their ids.
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 corr...
EdgeData< GUM_SCALAR > & edge(NodeId u, NodeId v)
Returns data about an edge.
+ 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 145 of file interfaceGraph_tpl.h.

146  :
147  __sys(source.__sys),
148  __graph(source.__graph), __nodes(source.__nodes),
149  __idMap(source.__idMap), __edges(source.__edges),
150  __labels(new Bijection< Idx, LabelData* >(*(source.__labels))),
151  __nodeMap(source.__nodeMap), __edgeMap(source.__edgeMap),
152  __counter(source.__counter), __erase_flag(false) {
153  GUM_CONS_CPY(InterfaceGraph);
154  }
NodeProperty< NodeData< GUM_SCALAR > *> __nodes
Data associated with a node in __graph.
HashTable< LabelData *, Set< NodeData< GUM_SCALAR > *> *> __nodeMap
Mapping between a LabelData and the set of NodeData<GUM_SCALAR> with that label.
UndiGraph __graph
The interface 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.
HashTable< LabelData *, Set< EdgeData< GUM_SCALAR > *> *> __edgeMap
Mapping between a LabelData and the set of EdgeData<GUM_SCALAR> with that label.
InterfaceGraph(const PRMSystem< GUM_SCALAR > &sys)
Default constructor.
bool __erase_flag
For shallow copies.
HashTable< PRMInstance< GUM_SCALAR > *, NodeId > __idMap
Mapping between PRMInstance<GUM_SCALAR> dans their id in __graph.
Bijection< Idx, LabelData *> * __labels
Bijection between labels and their ids.

◆ ~InterfaceGraph()

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

Destructor.

Definition at line 157 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__edgeMap, gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__edges, gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__erase_flag, gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__labels, gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__nodeMap, gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__nodes, and gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::operator=().

157  {
158  GUM_DESTRUCTOR(InterfaceGraph);
159 
160  if (__erase_flag) {
161  for (const auto& elt : __nodes)
162  delete elt.second;
163 
164  for (const auto& elt : __edges)
165  delete elt.second;
166 
167  for (const auto& elt : __nodeMap) {
168  delete elt.first;
169  delete elt.second;
170  }
171 
172  for (const auto& elt : __edgeMap) {
173  delete elt.first;
174  delete elt.second;
175  }
176  }
177 
178  delete __labels;
179  }
NodeProperty< NodeData< GUM_SCALAR > *> __nodes
Data associated with a node in __graph.
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.
HashTable< LabelData *, Set< EdgeData< GUM_SCALAR > *> *> __edgeMap
Mapping between a LabelData and the set of EdgeData<GUM_SCALAR> with that label.
InterfaceGraph(const PRMSystem< GUM_SCALAR > &sys)
Default constructor.
bool __erase_flag
For shallow copies.
Bijection< Idx, LabelData *> * __labels
Bijection between labels and their ids.
+ 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 188 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__counter, gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__labels, gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__nodeMap, gum::HashTable< Key, Val, Alloc >::exists(), gum::prm::gspan::LabelData::id, gum::HashTable< Key, Val, Alloc >::insert(), gum::prm::gspan::LabelData::l, gum::prm::gspan::NodeData< GUM_SCALAR >::l, gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::label(), gum::prm::gspan::NodeData< GUM_SCALAR >::n, gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::size(), and gum::prm::gspan::LabelData::tree_width.

Referenced by gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::InterfaceGraph().

190  {
191  Size size = Size(1);
192  std::stringstream sBuff;
193  sBuff << node->n->type().name();
194 
195  // First we search for multiple inputs
196  for (const auto chain : node->n->type().slotChains()) {
197  if (chain->isMultiple()) {
198  sBuff << "-" << node->n->getInstances(chain->id()).size();
199  sBuff << chain->name();
200  size *= node->n->getInstances(chain->id()).size()
201  * chain->lastElt().type().variable().domainSize();
202  } else {
203  size *= chain->lastElt().type().variable().domainSize();
204  }
205  }
206 
207  // Second we search for active outputs
208  for (const auto nn : node->n->type().containerDag().nodes()) {
209  if (node->n->type().isOutputNode(node->n->type().get(nn))) {
210  try {
211  sBuff << "-" << node->n->getRefAttr(nn).size()
212  << node->n->get(nn).name();
213  size *= node->n->get(nn).type().variable().domainSize();
214  } catch (NotFound&) {
215  // (nn) is an inactive output node
216  }
217  }
218  }
219 
220  // Label is ready
221  if (!label_map.exists(sBuff.str())) {
222  LabelData* label = new LabelData();
223  label_map.insert(sBuff.str(), label);
224  label->id = ++__counter;
225  label->tree_width = size;
226  label->l = sBuff.str();
227  __labels->insert(label->id, label);
228  __nodeMap.insert(label, new Set< NodeData< GUM_SCALAR >* >());
229  }
230 
231  node->l = label_map[sBuff.str()];
232  __nodeMap[node->l]->insert(node);
233  }
HashTable< LabelData *, Set< NodeData< GUM_SCALAR > *> *> __nodeMap
Mapping between a LabelData and the set of NodeData<GUM_SCALAR> with that label.
NodeData< GUM_SCALAR > & node(const PRMInstance< GUM_SCALAR > *i)
Returns data about a node.
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:48
+ Here is the call graph for this function:
+ Here is the caller 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 236 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__counter, gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__edgeMap, gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__labels, gum::HashTable< Key, Val, Alloc >::exists(), gum::prm::gspan::LabelData::id, gum::HashTable< Key, Val, Alloc >::insert(), gum::prm::gspan::LabelData::l, gum::prm::gspan::EdgeData< GUM_SCALAR >::l, gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::label(), gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::size(), gum::prm::gspan::LabelData::tree_width, gum::prm::gspan::EdgeData< GUM_SCALAR >::u, and gum::prm::gspan::EdgeData< GUM_SCALAR >::v.

238  {
239  Size size = Size(1);
240  std::stringstream sBuff;
241  sBuff << edge->u->type().name() << "-" << edge->v->type().name();
242 
243  // First looking for edge->u output nodes in v
244  for (const auto chain : edge->u->type().slotChains()) {
245  if (edge->u->getInstances(chain->id()).exists(edge->v)) {
246  sBuff << "-" << edge->v->type().name() << "."
247  << chain->lastElt().name();
248  size *= chain->lastElt().type().variable().domainSize();
249  }
250  }
251 
252  // Second looking for edge->v output nodes in u
253  for (const auto chain : edge->v->type().slotChains())
254  if (edge->v->getInstances(chain->id()).exists(edge->u)) {
255  sBuff << "-" << edge->u->type().name() << "."
256  << chain->lastElt().name();
257  size *= chain->lastElt().type().variable().domainSize();
258  }
259 
260  // Label is ready
261  if (!label_map.exists(sBuff.str())) {
262  LabelData* label = new LabelData();
263  label_map.insert(sBuff.str(), label);
264  label->id = ++__counter;
265  label->l = sBuff.str();
266  label->tree_width = size;
267  __labels->insert(label->id, label);
268  __edgeMap.insert(label, new Set< EdgeData< GUM_SCALAR >* >());
269  }
270 
271  edge->l = label_map[sBuff.str()];
272  __edgeMap[edge->l]->insert(edge);
273  }
Idx __counter
A counter used of assigning ids to labels.
HashTable< LabelData *, Set< EdgeData< GUM_SCALAR > *> *> __edgeMap
Mapping between a LabelData and the set of EdgeData<GUM_SCALAR> with that label.
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:48
EdgeData< GUM_SCALAR > & edge(NodeId u, NodeId v)
Returns data about an edge.
+ 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 371 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__edges.

Referenced by gum::prm::GSpan< GUM_SCALAR >::__subgraph_mining(), and gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::InterfaceGraph().

372  {
373  try {
374  return *(__edges[Edge(u, v)]);
375  } catch (NotFound&) { return *(__edges[Edge(v, u)]); }
376  }
EdgeProperty< EdgeData< GUM_SCALAR > *> __edges
Data associated with edges in __graph.
+ Here is the caller 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 380 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__edges.

380  {
381  try {
382  return *(__edges[Edge(u, v)]);
383  } catch (NotFound&) { return *(__edges[Edge(v, u)]); }
384  }
EdgeProperty< EdgeData< GUM_SCALAR > *> __edges
Data associated with edges in __graph.

◆ 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 319 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__edgeMap.

319  {
320  return *(__edgeMap[const_cast< LabelData* >(l)]);
321  }
HashTable< LabelData *, Set< EdgeData< GUM_SCALAR > *> *> __edgeMap
Mapping between a LabelData and the set of EdgeData<GUM_SCALAR> with that label.

◆ 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 325 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__edgeMap.

325  {
326  return *(__edgeMap[const_cast< LabelData* >(l)]);
327  }
HashTable< LabelData *, Set< EdgeData< GUM_SCALAR > *> *> __edgeMap
Mapping between a LabelData and the set of EdgeData<GUM_SCALAR> with that label.

◆ 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 276 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__graph.

Referenced by gum::prm::GSpan< GUM_SCALAR >::__subgraph_mining(), and gum::prm::GSpan< GUM_SCALAR >::discoverPatterns().

276  {
277  return __graph;
278  }
UndiGraph __graph
The interface graph.
+ Here is the caller 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 281 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__graph.

281  {
282  return __graph;
283  }
UndiGraph __graph
The interface graph.

◆ 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 335 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__idMap.

Referenced by gum::prm::GSpan< GUM_SCALAR >::__subgraph_mining(), gum::prm::GSpan< GUM_SCALAR >::discoverPatterns(), and gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::node().

336  {
337  return __idMap[const_cast< PRMInstance< GUM_SCALAR >* >(&i)];
338  }
HashTable< PRMInstance< GUM_SCALAR > *, NodeId > __idMap
Mapping between PRMInstance<GUM_SCALAR> dans their id in __graph.
+ Here is the caller 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 341 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__idMap.

342  {
343  return __idMap[const_cast< PRMInstance< GUM_SCALAR >* >(i)];
344  }
HashTable< PRMInstance< GUM_SCALAR > *, NodeId > __idMap
Mapping between PRMInstance<GUM_SCALAR> dans their id in __graph.

◆ 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 330 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__labels.

Referenced by gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__label().

330  {
331  return __labels->second(id);
332  }
Bijection< Idx, LabelData *> * __labels
Bijection between labels and their ids.
+ Here is the caller 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 286 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__labels.

286  {
287  return *__labels;
288  }
Bijection< Idx, LabelData *> * __labels
Bijection between labels and their ids.

◆ 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 292 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__labels.

292  {
293  return *__labels;
294  }
Bijection< Idx, LabelData *> * __labels
Bijection between labels and their ids.

◆ 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 348 of file interfaceGraph_tpl.h.

Referenced by gum::prm::GSpan< GUM_SCALAR >::__subgraph_mining(), gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::InterfaceGraph(), and gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::node().

348  {
349  return node(id(i));
350  }
NodeData< GUM_SCALAR > & node(const PRMInstance< GUM_SCALAR > *i)
Returns data about a node.
+ Here is the caller 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 353 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::node().

354  {
355  return node(id(i));
356  }
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 360 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__nodes, and gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::id().

360  {
361  return *(__nodes[id]);
362  }
NodeProperty< NodeData< GUM_SCALAR > *> __nodes
Data associated with a node in __graph.
NodeId id(const PRMInstance< GUM_SCALAR > &i) const
Returns the id of i in this interface 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 366 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__nodes, and gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::id().

366  {
367  return *(__nodes[id]);
368  }
NodeProperty< NodeData< GUM_SCALAR > *> __nodes
Data associated with a node in __graph.
NodeId id(const PRMInstance< GUM_SCALAR > &i) const
Returns the id of i in this interface 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 307 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__nodeMap.

307  {
308  return *(__nodeMap[const_cast< LabelData* >(l)]);
309  }
HashTable< LabelData *, Set< NodeData< GUM_SCALAR > *> *> __nodeMap
Mapping between a LabelData and the set of NodeData<GUM_SCALAR> with that label.

◆ 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 313 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__nodeMap.

313  {
314  return *(__nodeMap[const_cast< LabelData* >(l)]);
315  }
HashTable< LabelData *, Set< NodeData< GUM_SCALAR > *> *> __nodeMap
Mapping between a LabelData and the set of NodeData<GUM_SCALAR> with that label.

◆ 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 183 of file interfaceGraph_tpl.h.

References GUM_ERROR.

Referenced by gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::~InterfaceGraph().

183  {
184  GUM_ERROR(FatalError, "not implemented");
185  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55
+ Here is the caller 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 297 of file interfaceGraph_tpl.h.

References gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__edgeMap, and gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__nodeMap.

Referenced by gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__label().

297  {
298  try {
299  return __nodeMap[const_cast< LabelData* >(l)]->size();
300  } catch (NotFound&) {
301  return __edgeMap[const_cast< LabelData* >(l)]->size();
302  }
303  }
HashTable< LabelData *, Set< NodeData< GUM_SCALAR > *> *> __nodeMap
Mapping between a LabelData and the set of NodeData<GUM_SCALAR> with that label.
HashTable< LabelData *, Set< EdgeData< GUM_SCALAR > *> *> __edgeMap
Mapping between a LabelData and the set of EdgeData<GUM_SCALAR> with that label.
Size size(const LabelData *l) const
Returns the number of node or edges labelled by l.
+ Here is the caller 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 168 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 277 of file interfaceGraph.h.

Referenced by gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__label().

◆ __edgeMap

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

◆ __edges

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

◆ __erase_flag

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

For shallow copies.

Definition at line 280 of file interfaceGraph.h.

Referenced by gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::~InterfaceGraph().

◆ __graph

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

◆ __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 258 of file interfaceGraph.h.

Referenced by gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::id(), and gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::InterfaceGraph().

◆ __labels

◆ __nodeMap

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

◆ __nodes

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

◆ __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 249 of file interfaceGraph.h.


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