GEDLIB
1.0
|
A class for node maps. More...
#include <node_map.hpp>
Public Member Functions | |
NodeMap (std::size_t num_nodes_g, std::size_t num_nodes_h) | |
Default constructor. More... | |
NodeMap (const NodeMap &node_map) | |
Copy constructor. More... | |
void | operator= (const NodeMap &node_map) |
Assignment operator. More... | |
void | clear () |
Clears the node map. | |
bool | empty () const |
Checks if the node map is empty. More... | |
std::size_t | num_source_nodes () const |
Returns number of source nodes contained in the node map. More... | |
std::size_t | num_target_nodes () const |
Returns number of target nodes contained in the node map. More... | |
bool | complete (const GEDGraph &g, const GEDGraph &h) const |
Checks if the node map is complete. More... | |
GEDGraph::NodeID | image (GEDGraph::NodeID node) const |
Returns image of a node. More... | |
GEDGraph::NodeID | pre_image (GEDGraph::NodeID node) const |
Returns pre-image of a node. More... | |
void | as_relation (std::vector< Assignment > &relation) const |
Constructs the representation as relation. More... | |
double | induced_cost () const |
Returns the induced cost. More... | |
void | add_assignment (GEDGraph::NodeID i, GEDGraph::NodeID k) |
Add node substitution, insertion, or deletion to the node map. More... | |
void | erase_image (GEDGraph::NodeID node) |
Erases image of a node. More... | |
void | erase_pre_image (GEDGraph::NodeID node) |
Erases pre-image of a node. More... | |
void | set_induced_cost (double induced_cost) |
Sets the induced cost of the node map. More... | |
bool | operator< (const NodeMap &node_map) const |
Compares this node map to another node map. More... | |
bool | operator== (const NodeMap &node_map) const |
Checks if two node maps are the same. More... | |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &os, const NodeMap &node_map) |
Streams a node map. More... | |
A class for node maps.
Node maps are relations between the node sets of two graphs augmented with one dummy node each such that each real node is assigned at most once. The exact definition can be found in: D. B. Blumenthal, J. Gamper. On the exact computation of the graph edit distance. Pattern Recogn. Lett. 2018, in press.
Definition at line 43 of file node_map.hpp.
ged::NodeMap::NodeMap | ( | std::size_t | num_nodes_g, |
std::size_t | num_nodes_h | ||
) |
Default constructor.
[in] | num_nodes_g | Number of nodes in first input graph. |
[in] | num_nodes_h | Number of nodes in second input graph. |
Definition at line 33 of file node_map.ipp.
ged::NodeMap::NodeMap | ( | const NodeMap & | node_map | ) |
Copy constructor.
[in] | node_map | Node map that should be copied. |
Definition at line 39 of file node_map.ipp.
void ged::NodeMap::add_assignment | ( | GEDGraph::NodeID | i, |
GEDGraph::NodeID | k | ||
) |
Add node substitution, insertion, or deletion to the node map.
[in] | i | Source node. If ged::GEDGraph::dummy_node(), the method adds a node insertion to the node map. |
[in] | k | Target node. If ged::GEDGraph::dummy_node(), the method adds a node deletion to the node map. |
i
and k
equal ged::GEDGraph::dummy_node(), calling this method has no effect. Definition at line 183 of file node_map.ipp.
void ged::NodeMap::as_relation | ( | std::vector< Assignment > & | relation | ) | const |
Constructs the representation as relation.
[out] | relation | Contains the pairs of nodes in the relation. The first member of a pair contained in the relation is a node in the first graph or the dummy node, the second member is a node in the second graph or the dummy node. |
Definition at line 164 of file node_map.ipp.
Checks if the node map is complete.
[in] | g | Source graph. |
[in] | h | Target graph. |
true
if and only if, for all nodes in the graphs g
and h
, the node map contains a substitution, an insertion, or a deletion. Definition at line 93 of file node_map.ipp.
bool ged::NodeMap::empty | ( | ) | const |
Checks if the node map is empty.
true
if the map is empty and false
otherwise. Definition at line 65 of file node_map.ipp.
void ged::NodeMap::erase_image | ( | GEDGraph::NodeID | node | ) |
Erases image of a node.
[in] | node | Node whose image is to be erased. |
Definition at line 122 of file node_map.ipp.
void ged::NodeMap::erase_pre_image | ( | GEDGraph::NodeID | node | ) |
Erases pre-image of a node.
[in] | node | Node whose pre-image is to be erased. |
Definition at line 149 of file node_map.ipp.
GEDGraph::NodeID ged::NodeMap::image | ( | GEDGraph::NodeID | node | ) | const |
Returns image of a node.
[in] | node | Node whose image is to be returned. |
node
is assigned. Definition at line 110 of file node_map.ipp.
double ged::NodeMap::induced_cost | ( | ) | const |
Returns the induced cost.
Definition at line 210 of file node_map.ipp.
std::size_t ged::NodeMap::num_source_nodes | ( | ) | const |
Returns number of source nodes contained in the node map.
Definition at line 81 of file node_map.ipp.
std::size_t ged::NodeMap::num_target_nodes | ( | ) | const |
Returns number of target nodes contained in the node map.
Definition at line 87 of file node_map.ipp.
bool ged::NodeMap::operator< | ( | const NodeMap & | node_map | ) | const |
Compares this node map to another node map.
[in] | node_map | The node to which this node map should be compared. |
true
if the induced cost is smaller than the induced cost of node_map
and false
otherwise. Definition at line 216 of file node_map.ipp.
void ged::NodeMap::operator= | ( | const NodeMap & | node_map | ) |
Assignment operator.
[in] | node_map | Node map that should be assigned. |
Definition at line 46 of file node_map.ipp.
bool ged::NodeMap::operator== | ( | const NodeMap & | node_map | ) | const |
Checks if two node maps are the same.
[in] | node_map | The node map to which this node map should be compared. |
true
if both node maps are the same and false
otherwise. Definition at line 222 of file node_map.ipp.
GEDGraph::NodeID ged::NodeMap::pre_image | ( | GEDGraph::NodeID | node | ) | const |
Returns pre-image of a node.
[in] | node | Node whose pre_image is to be returned. |
node
. Definition at line 137 of file node_map.ipp.
void ged::NodeMap::set_induced_cost | ( | double | induced_cost | ) |
Sets the induced cost of the node map.
[in] | induced_cost | The induced cost of the node map. |
Definition at line 204 of file node_map.ipp.
|
related |
Streams a node map.
[in,out] | os | Output stream. |
[in] | node_map | The node map that should be streamed. |
os
. Definition at line 226 of file node_map.ipp.