31 #endif // GUM_NO_INLINE 41 for (
NodeId node = 1; node <= source.
size(); ++node) {
46 for (
const auto edge : source.
code().
codes)
49 const_cast< LabelData& >(
50 source.
label(node_map[edge->i], node_map[edge->j])));
54 for (
const auto node :
nodes()) {
55 for (
const auto next :
parents(node)) {
60 if (edge_code < *(
code().codes.front())) {
62 }
else if (edge_code == (*
code().
codes.front())) {
67 for (
const auto next :
children(node)) {
72 if (edge_code < *(
code().codes.front())) {
74 }
else if (edge_code == (*
code().
codes.front())) {
84 std::stringstream sBuff;
85 sBuff <<
"digraph " << name <<
" {\n";
87 for (
const auto arc :
arcs()) {
88 sBuff <<
label(arc.tail()).
id <<
" -> ";
89 sBuff <<
label(arc.head()).
id <<
";\n";
108 if (
__rec(p, node_map, u, nei))
return true;
110 for (
const auto nei :
parents(u))
112 if (
__rec(p, node_map, u, nei))
return true;
116 if (
__rec(p, node_map, v, nei))
return true;
118 for (
const auto nei :
parents(v))
120 if (
__rec(p, node_map, v, nei))
return true;
146 data = &(
label(u, v));
163 size_t depth = p.
code().
codes.size() - 1;
168 std::list< NodeId > r_path;
171 for (
const auto node : r_path) {
173 if (
__rec(p, node_map, node_map.
first(node), nei))
return true;
176 if (
__rec(p, node_map, node_map.
first(node), nei))
return true;
190 std::vector< std::pair< NodeId, NodeId > > stack;
191 std::vector< size_t > rec_call;
192 stack.push_back(std::make_pair(a_u, a_v));
196 while (!stack.empty()) {
198 u = stack.back().first;
199 v = stack.back().second;
202 if ((u == 0) && (v == 0)) {
224 data = &(
label(u, v));
242 size_t depth = p.
code().
codes.size() - 1;
247 std::list< NodeId > r_path;
251 for (
const auto node : r_path) {
252 for (
const auto nei :
children(node)) {
253 stack.push_back(std::make_pair(node_map.
first(node), nei));
257 for (
const auto nei :
parents(node)) {
258 stack.push_back(std::make_pair(node_map.
first(node), nei));
void insert(const T1 &first, const T2 &second)
Inserts a new association in the gum::Bijection.
const T2 & second(const T1 &first) const
Returns the second value of a pair given its first value.
const T1 & first(const T2 &second) const
Returns the first value of a pair given its second value.
Inner class to handle data about labels in this interface graph.
void eraseFirst(const T1 &first)
Erases an association containing the given first element.
Pattern()
Default constructor.
DFSCode & code()
Returns the DFSCode of this Pattern.
NodeId addNodeWithLabel(LabelData &l)
Insert a node with the given LabelData.
bool __expandCodeIsMinimal(NodeId u, NodeId v)
Returns true if the expand code by adding and edge betwenne u and v is minimal with respect to __code...
bool isMinimal()
Returns the DFSCode of this Pattern.
gum is the global namespace for all aGrUM entities
std::vector< EdgeCode *> codes
The vector containing the EdgeCode composing this DFSCode.
The class for generic Hash Tables.
LabelData & label(NodeId node)
Returns the LabelData assigned to node.
represent a DFS code used by gspan.
bool existsFirst(const T1 &first) const
Returns true if first is the first element in a pair in the gum::Bijection.
Size size() const
Returns the number of nodes in this Pattern.
const NodeSet & parents(const NodeId id) const
returns the set of nodes with arc ingoing to a given node
Base class for all oriented graphs.
virtual const std::string toDot() const
to friendly display the content of the graph in the DOT syntax
Set of pairs of elements with fast search for both elements.
bool __not_rec(Pattern &p, Bijection< NodeId, NodeId > &node_map, NodeId u, NodeId v)
A non recursive bugged version of __rec.
const NodeGraphPart & nodes() const
void rightmostPath(std::list< NodeId > &r_path) const
Fill r_path with the rightmost path of this Pattern. The list is supposed empty.
const ArcSet & arcs() const
Idx id
An unique identifier for this label.
bool __rec(Pattern &p, Bijection< NodeId, NodeId > &node_map, NodeId u, NodeId v)
Recurisve method used by __expandCodeIsMinimal.
void pop_back()
Remove the last EdgeCode of this pattern.
Inline implementation of the Pattern class.
const NodeSet & children(const NodeId id) const
returns the set of nodes with arc outgoing from a given node
void addArc(NodeId i, NodeId j, LabelData &l)
Add an arc to this Pattern.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
void remove(NodeId node)
Remove a node if it has no neighbors, raise an OperationNotAllowed otherwise.
Headers of the Pattern class.
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.
This contains all the information we want for a node in a DFSTree.
bool existsArc(const Arc &arc) const
indicates whether a given arc exists
Size NodeId
Type for node ids.