34 #endif // GUM_NO_INLINE 44 for (
NodeId node = 1; node <= source.
size(); ++node) {
49 for (
const auto edge : source.
code().
codes)
52 const_cast< LabelData& >(
53 source.
label(node_map[edge->i], node_map[edge->j])));
57 for (
const auto node :
nodes()) {
58 for (
const auto next :
parents(node)) {
63 if (edge_code < *(
code().codes.front())) {
65 }
else if (edge_code == (*
code().
codes.front())) {
70 for (
const auto next :
children(node)) {
75 if (edge_code < *(
code().codes.front())) {
77 }
else if (edge_code == (*
code().
codes.front())) {
87 std::stringstream sBuff;
88 sBuff <<
"digraph " << name <<
" {\n";
90 for (
const auto arc :
arcs()) {
91 sBuff <<
label(arc.tail()).
id <<
" -> ";
92 sBuff <<
label(arc.head()).
id <<
";\n";
111 if (
__rec(p, node_map, u, nei))
return true;
113 for (
const auto nei :
parents(u))
115 if (
__rec(p, node_map, u, nei))
return true;
119 if (
__rec(p, node_map, v, nei))
return true;
121 for (
const auto nei :
parents(v))
123 if (
__rec(p, node_map, v, nei))
return true;
149 data = &(
label(u, v));
166 size_t depth = p.
code().
codes.size() - 1;
171 std::list< NodeId > r_path;
174 for (
const auto node : r_path) {
176 if (
__rec(p, node_map, node_map.
first(node), nei))
return true;
179 if (
__rec(p, node_map, node_map.
first(node), nei))
return true;
193 std::vector< std::pair< NodeId, NodeId > > stack;
194 std::vector< size_t > rec_call;
195 stack.push_back(std::make_pair(a_u, a_v));
199 while (!stack.empty()) {
201 u = stack.back().first;
202 v = stack.back().second;
205 if ((u == 0) && (v == 0)) {
227 data = &(
label(u, v));
245 size_t depth = p.
code().
codes.size() - 1;
250 std::list< NodeId > r_path;
254 for (
const auto node : r_path) {
255 for (
const auto nei :
children(node)) {
256 stack.push_back(std::make_pair(node_map.
first(node), nei));
260 for (
const auto nei :
parents(node)) {
261 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.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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.