aGrUM  0.13.2
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

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

Default constructor.

Definition at line 96 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.

97  :
98  __sys(&sys),
99  __labels(new Bijection< Idx, LabelData* >()), __counter(0),
100  __erase_flag(true) {
101  GUM_CONSTRUCTOR(InterfaceGraph);
102  HashTable< std::string, LabelData* > label_map;
103 
104  // We need to add each instance in __graph
105  for (auto iter = sys.begin(); iter != sys.end(); ++iter) {
106  NodeData< GUM_SCALAR >* node = new NodeData< GUM_SCALAR >();
107  node->n = iter.val();
108  __label(node, label_map);
109  __graph.addNodeWithId(iter.key());
110  __idMap.insert(node->n, iter.key());
111  __nodes.insert(iter.key(), node);
112  }
113 
114  NodeData< GUM_SCALAR >* u = nullptr;
115  NodeData< GUM_SCALAR >* v = nullptr;
116 
117  for (const auto& elt : __nodes) {
118  NodeData< GUM_SCALAR >* data = elt.second;
119 
120  for (const auto chain : data->n->type().slotChains()) {
121  for (const auto inst : data->n->getInstances(chain->id())) {
122  u = (__nodes[__idMap[inst]]->l < data->l) ? __nodes[__idMap[inst]]
123  : data;
124  v = (u != data) ? data : __nodes[__idMap[inst]];
125 
126  if (!__graph.existsEdge(__idMap[u->n], __idMap[v->n])) {
127  EdgeData< GUM_SCALAR >* edge = new EdgeData< GUM_SCALAR >();
128  edge->u = u->n;
129  edge->l_u = u->l;
130  edge->v = v->n;
131  edge->l_v = v->l;
132  __label(edge, label_map);
133  __graph.addEdge(__idMap[u->n], __idMap[v->n]);
134  __edges.insert(Edge(__idMap[u->n], __idMap[v->n]), edge);
135  }
136  }
137  }
138  }
139  }
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:32
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.
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.
bool existsEdge(const Edge &edge) const
indicates whether a given edge exists

+ Here is the call graph for this function:

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

143  :
144  __sys(source.__sys),
145  __graph(source.__graph), __nodes(source.__nodes),
146  __idMap(source.__idMap), __edges(source.__edges),
147  __labels(new Bijection< Idx, LabelData* >(*(source.__labels))),
148  __nodeMap(source.__nodeMap), __edgeMap(source.__edgeMap),
149  __counter(source.__counter), __erase_flag(false) {
150  GUM_CONS_CPY(InterfaceGraph);
151  }
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.
template<typename GUM_SCALAR >
gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::~InterfaceGraph ( )

Destructor.

Definition at line 154 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=().

154  {
155  GUM_DESTRUCTOR(InterfaceGraph);
156 
157  if (__erase_flag) {
158  for (const auto& elt : __nodes)
159  delete elt.second;
160 
161  for (const auto& elt : __edges)
162  delete elt.second;
163 
164  for (const auto& elt : __nodeMap) {
165  delete elt.first;
166  delete elt.second;
167  }
168 
169  for (const auto& elt : __edgeMap) {
170  delete elt.first;
171  delete elt.second;
172  }
173  }
174 
175  delete __labels;
176  }
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

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 185 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().

187  {
188  Size size = Size(1);
189  std::stringstream sBuff;
190  sBuff << node->n->type().name();
191 
192  // First we search for multiple inputs
193  for (const auto chain : node->n->type().slotChains()) {
194  if (chain->isMultiple()) {
195  sBuff << "-" << node->n->getInstances(chain->id()).size();
196  sBuff << chain->name();
197  size *= node->n->getInstances(chain->id()).size()
198  * chain->lastElt().type().variable().domainSize();
199  } else {
200  size *= chain->lastElt().type().variable().domainSize();
201  }
202  }
203 
204  // Second we search for active outputs
205  for (const auto nn : node->n->type().containerDag().nodes()) {
206  if (node->n->type().isOutputNode(node->n->type().get(nn))) {
207  try {
208  sBuff << "-" << node->n->getRefAttr(nn).size()
209  << node->n->get(nn).name();
210  size *= node->n->get(nn).type().variable().domainSize();
211  } catch (NotFound&) {
212  // (nn) is an inactive output node
213  }
214  }
215  }
216 
217  // Label is ready
218  if (!label_map.exists(sBuff.str())) {
219  LabelData* label = new LabelData();
220  label_map.insert(sBuff.str(), label);
221  label->id = ++__counter;
222  label->tree_width = size;
223  label->l = sBuff.str();
224  __labels->insert(label->id, label);
225  __nodeMap.insert(label, new Set< NodeData< GUM_SCALAR >* >());
226  }
227 
228  node->l = label_map[sBuff.str()];
229  __nodeMap[node->l]->insert(node);
230  }
unsigned long Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:50
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.
Size size(const LabelData *l) const
Returns the number of node or edges labelled by l.
LabelData * label(Idx id)
Returns a label given its id.
Bijection< Idx, LabelData * > * __labels
Bijection between labels and their ids.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 233 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.

235  {
236  Size size = Size(1);
237  std::stringstream sBuff;
238  sBuff << edge->u->type().name() << "-" << edge->v->type().name();
239 
240  // First looking for edge->u output nodes in v
241  for (const auto chain : edge->u->type().slotChains()) {
242  if (edge->u->getInstances(chain->id()).exists(edge->v)) {
243  sBuff << "-" << edge->v->type().name() << "."
244  << chain->lastElt().name();
245  size *= chain->lastElt().type().variable().domainSize();
246  }
247  }
248 
249  // Second looking for edge->v output nodes in u
250  for (const auto chain : edge->v->type().slotChains())
251  if (edge->v->getInstances(chain->id()).exists(edge->u)) {
252  sBuff << "-" << edge->u->type().name() << "."
253  << chain->lastElt().name();
254  size *= chain->lastElt().type().variable().domainSize();
255  }
256 
257  // Label is ready
258  if (!label_map.exists(sBuff.str())) {
259  LabelData* label = new LabelData();
260  label_map.insert(sBuff.str(), label);
261  label->id = ++__counter;
262  label->l = sBuff.str();
263  label->tree_width = size;
264  __labels->insert(label->id, label);
265  __edgeMap.insert(label, new Set< EdgeData< GUM_SCALAR >* >());
266  }
267 
268  edge->l = label_map[sBuff.str()];
269  __edgeMap[edge->l]->insert(edge);
270  }
unsigned long Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:50
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.
Size size(const LabelData *l) const
Returns the number of node or edges labelled by l.
LabelData * label(Idx id)
Returns a label given its id.
Bijection< Idx, LabelData * > * __labels
Bijection between labels and their ids.
EdgeData< GUM_SCALAR > & edge(NodeId u, NodeId v)
Returns data about an edge.

+ Here is the call graph for this function:

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 368 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().

369  {
370  try {
371  return *(__edges[Edge(u, v)]);
372  } catch (NotFound&) { return *(__edges[Edge(v, u)]); }
373  }
EdgeProperty< EdgeData< GUM_SCALAR > * > __edges
Data associated with edges in __graph.

+ Here is the caller graph for this function:

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

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

377  {
378  try {
379  return *(__edges[Edge(u, v)]);
380  } catch (NotFound&) { return *(__edges[Edge(v, u)]); }
381  }
EdgeProperty< EdgeData< GUM_SCALAR > * > __edges
Data associated with edges in __graph.
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 316 of file interfaceGraph_tpl.h.

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

316  {
317  return *(__edgeMap[const_cast< LabelData* >(l)]);
318  }
HashTable< LabelData *, Set< EdgeData< GUM_SCALAR > * > * > __edgeMap
Mapping between a LabelData and the set of EdgeData<GUM_SCALAR> with that label.
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 322 of file interfaceGraph_tpl.h.

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

322  {
323  return *(__edgeMap[const_cast< LabelData* >(l)]);
324  }
HashTable< LabelData *, Set< EdgeData< GUM_SCALAR > * > * > __edgeMap
Mapping between a LabelData and the set of EdgeData<GUM_SCALAR> with that label.
template<typename GUM_SCALAR >
INLINE UndiGraph & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::graph ( )

Returns the graph of this interface graph.

Definition at line 273 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().

273  {
274  return __graph;
275  }
UndiGraph __graph
The interface graph.

+ Here is the caller graph for this function:

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

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

278  {
279  return __graph;
280  }
UndiGraph __graph
The interface graph.
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 332 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().

333  {
334  return __idMap[const_cast< PRMInstance< GUM_SCALAR >* >(&i)];
335  }
HashTable< PRMInstance< GUM_SCALAR > *, NodeId > __idMap
Mapping between PRMInstance<GUM_SCALAR> dans their id in __graph.

+ Here is the caller graph for this function:

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

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

339  {
340  return __idMap[const_cast< PRMInstance< GUM_SCALAR >* >(i)];
341  }
HashTable< PRMInstance< GUM_SCALAR > *, NodeId > __idMap
Mapping between PRMInstance<GUM_SCALAR> dans their id in __graph.
template<typename GUM_SCALAR >
INLINE LabelData * gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::label ( Idx  id)

Returns a label given its id.

Definition at line 327 of file interfaceGraph_tpl.h.

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

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

327  {
328  return __labels->second(id);
329  }
Bijection< Idx, LabelData * > * __labels
Bijection between labels and their ids.

+ Here is the caller graph for this function:

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

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

283  {
284  return *__labels;
285  }
Bijection< Idx, LabelData * > * __labels
Bijection between labels and their ids.
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 289 of file interfaceGraph_tpl.h.

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

289  {
290  return *__labels;
291  }
Bijection< Idx, LabelData * > * __labels
Bijection between labels and their ids.
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 345 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().

345  {
346  return node(id(i));
347  }
NodeData< GUM_SCALAR > & node(const PRMInstance< GUM_SCALAR > *i)
Returns data about a node.

+ Here is the caller graph for this function:

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

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

351  {
352  return node(id(i));
353  }
NodeData< GUM_SCALAR > & node(const PRMInstance< GUM_SCALAR > *i)
Returns data about a node.

+ Here is the call graph for this function:

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

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

357  {
358  return *(__nodes[id]);
359  }
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:

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

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

363  {
364  return *(__nodes[id]);
365  }
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:

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

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

304  {
305  return *(__nodeMap[const_cast< LabelData* >(l)]);
306  }
HashTable< LabelData *, Set< NodeData< GUM_SCALAR > * > * > __nodeMap
Mapping between a LabelData and the set of NodeData<GUM_SCALAR> with that label.
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 310 of file interfaceGraph_tpl.h.

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

310  {
311  return *(__nodeMap[const_cast< LabelData* >(l)]);
312  }
HashTable< LabelData *, Set< NodeData< GUM_SCALAR > * > * > __nodeMap
Mapping between a LabelData and the set of NodeData<GUM_SCALAR> with that label.
template<typename GUM_SCALAR >
InterfaceGraph< GUM_SCALAR > & gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::operator= ( const InterfaceGraph< GUM_SCALAR > &  source)

Copy operator.

Definition at line 180 of file interfaceGraph_tpl.h.

References GUM_ERROR.

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

180  {
181  GUM_ERROR(FatalError, "not implemented");
182  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the caller graph for this function:

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 294 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().

294  {
295  try {
296  return __nodeMap[const_cast< LabelData* >(l)]->size();
297  } catch (NotFound&) {
298  return __edgeMap[const_cast< LabelData* >(l)]->size();
299  }
300  }
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

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

Definition at line 165 of file interfaceGraph.h.

Member Data Documentation

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

A counter used of assigning ids to labels.

Definition at line 274 of file interfaceGraph.h.

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

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

For shallow copies.

Definition at line 277 of file interfaceGraph.h.

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

template<typename GUM_SCALAR>
UndiGraph gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__graph
private
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 255 of file interfaceGraph.h.

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

template<typename GUM_SCALAR>
HashTable< LabelData*, Set< NodeData< GUM_SCALAR >* >* > gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__nodeMap
private
template<typename GUM_SCALAR>
NodeProperty< NodeData< GUM_SCALAR >* > gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::__nodes
private
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 246 of file interfaceGraph.h.


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