GEDLIB
1.0
|
Provides the API of GEDLIB. More...
#include <ged_env.hpp>
Public Member Functions | |
~GEDEnv () | |
Destructor. | |
GEDEnv () | |
Constructor. | |
void | set_edit_costs (Options::EditCosts edit_costs, std::initializer_list< double > edit_cost_constants={}) |
Sets the edit costs to one of the predefined edit costs. More... | |
void | set_edit_costs (EditCosts< UserNodeLabel, UserEdgeLabel > *edit_costs) |
Sets the edit costs to user defined edit costs. More... | |
GEDGraph::GraphID | add_graph (const std::string &graph_name="", const std::string &graph_class="") |
Adds a new uninitialized graph to the environment. Call init() after calling this method. More... | |
void | clear_graph (GEDGraph::GraphID graph_id) |
Clears and de-initializes a graph that has previously been added to the environment. Call init() after calling this method. More... | |
void | add_node (GEDGraph::GraphID graph_id, const UserNodeID &node_id, const UserNodeLabel &node_label) |
Adds a labeled node. More... | |
void | add_edge (GEDGraph::GraphID graph_id, const UserNodeID &tail, const UserNodeID &head, const UserEdgeLabel &edge_label, bool ignore_duplicates=true) |
Adds a labeled edge. More... | |
GEDGraph::GraphID | load_exchange_graph (const ged::ExchangeGraph< UserNodeID, UserNodeLabel, UserEdgeLabel > &exchange_graph, GEDGraph::GraphID graph_id=ged::undefined(), const std::string &graph_name="", const std::string &graph_class="") |
Loads ged::ExchangeGraph into the environment. More... | |
GEDGraph::GraphID | load_gxl_graph (const std::string &file_name, Options::GXLNodeEdgeType node_type, Options::GXLNodeEdgeType edge_type, const std::unordered_set< std::string > &irrelevant_node_attributes, const std::unordered_set< std::string > &irrelevant_edge_attributes, GEDGraph::GraphID graph_id=ged::undefined(), const std::string &graph_class="") |
Load graph given in the GXL file format. More... | |
std::vector< GEDGraph::GraphID > | load_gxl_graphs (const std::string &graph_dir, const std::string &collection_file, Options::GXLNodeEdgeType node_type=Options::GXLNodeEdgeType::LABELED, Options::GXLNodeEdgeType edge_type=Options::GXLNodeEdgeType::LABELED, const std::unordered_set< std::string > &irrelevant_node_attributes=std::unordered_set< std::string >(), const std::unordered_set< std::string > &irrelevant_edge_attributes=std::unordered_set< std::string >()) |
Loads graphs given in the GXL file format. More... | |
void | init (Options::InitType init_type=Options::InitType::EAGER_WITHOUT_SHUFFLED_COPIES) |
Initializes the environment. More... | |
void | set_method (Options::GEDMethod method, const std::string &options=std::string("")) |
Sets the GEDMethod to be used by run_method(). More... | |
void | run_method (GEDGraph::GraphID g_id, GEDGraph::GraphID h_id) |
Runs the GED method specified by call to set_method() between the graphs with IDs g_id and h_id . More... | |
void | init_method () |
Initializes the method specified by call to set_method(). | |
std::pair< GEDGraph::GraphID, GEDGraph::GraphID > | graph_ids () const |
Provides access to the IDs of the graphs contained in the environment. More... | |
std::size_t | num_graphs () const |
The number of graphs contained in the environment. More... | |
double | get_lower_bound (GEDGraph::GraphID g_id, GEDGraph::GraphID h_id) const |
Returns lower bound for edit distance between the input graphs. More... | |
double | get_upper_bound (GEDGraph::GraphID g_id, GEDGraph::GraphID h_id) const |
Returns upper bound for edit distance between the input graphs. More... | |
const NodeMap & | get_node_map (GEDGraph::GraphID g_id, GEDGraph::GraphID h_id) const |
Returns node map between the input graphs. More... | |
double | get_runtime (GEDGraph::GraphID g_id, GEDGraph::GraphID h_id) const |
Returns runtime. More... | |
double | get_init_time () const |
Returns initialization time. More... | |
void | compute_induced_cost (GEDGraph::GraphID g_id, GEDGraph::GraphID h_id, NodeMap &node_map) const |
Computes the edit cost between two graphs induced by a node map. More... | |
ExchangeGraph< UserNodeID, UserNodeLabel, UserEdgeLabel > | get_graph (GEDGraph::GraphID graph_id) const |
Returns ged::ExchangeGraph representation. More... | |
const std::string & | get_graph_class (GEDGraph::GraphID graph_id) const |
Returns the graph class. More... | |
const std::string & | get_graph_name (GEDGraph::GraphID graph_id) const |
Returns the graph name. More... | |
bool | quasimetric_costs () const |
Checks if the edit costs are quasimetric. More... | |
std::size_t | get_num_nodes (GEDGraph::GraphID graph_id) const |
Returns the number of nodes. More... | |
double | get_avg_num_nodes () const |
Returns average number of nodes. More... | |
Provides the API of GEDLIB.
UserNodeID | Class of user-specific node IDs. |
UserNodeLabel | Class of user-specific node labels. If nodes are unlabeled, use ged::NoLabel or define your own dummy label class. |
UserEdgeLabel | Class of user-specific edge labels. If edges are unlabeled, use ged::NoLabel or define your own dummy label class. |
Definition at line 48 of file ged_data.hpp.
void ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::add_edge | ( | GEDGraph::GraphID | graph_id, |
const UserNodeID & | tail, | ||
const UserNodeID & | head, | ||
const UserEdgeLabel & | edge_label, | ||
bool | ignore_duplicates = true |
||
) |
Adds a labeled edge.
[in] | graph_id | ID of graph that has been added to the environment. |
[in] | tail | The user-specific ID of the tail of the edge that has to be added. |
[in] | head | The user-specific ID of the head of the edge that has to be added. |
[in] | edge_label | The label of the vertex that has to be added. Set to ged::NoLabel() if template parameter UserEdgeLabel equals ged::NoLabel. |
[in] | ignore_duplicates | If true , duplicate edges are ignores. Otherwise, an exception is thrown if an existing edge is added to the graph. |
Definition at line 359 of file ged_env.ipp.
GEDGraph::GraphID ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::add_graph | ( | const std::string & | graph_name = "" , |
const std::string & | graph_class = "" |
||
) |
Adds a new uninitialized graph to the environment. Call init() after calling this method.
[in] | graph_name | The name of the added graph. Empty if not specified. |
[in] | graph_class | The class of the added graph. Empty if not specified. |
Definition at line 69 of file ged_env.ipp.
void ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::add_node | ( | GEDGraph::GraphID | graph_id, |
const UserNodeID & | node_id, | ||
const UserNodeLabel & | node_label | ||
) |
Adds a labeled node.
[in] | graph_id | ID of graph that has been added to the environment. |
[in] | node_id | The user-specific ID of the vertex that has to be added. |
[in] | node_label | The label of the vertex that has to be added. Set to ged::NoLabel() if template parameter UserNodeLabel equals ged::NoLabel. |
Definition at line 339 of file ged_env.ipp.
void ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::clear_graph | ( | GEDGraph::GraphID | graph_id | ) |
Clears and de-initializes a graph that has previously been added to the environment. Call init() after calling this method.
[in] | graph_id | ID of graph that has to be cleared. |
Definition at line 89 of file ged_env.ipp.
void ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::compute_induced_cost | ( | GEDGraph::GraphID | g_id, |
GEDGraph::GraphID | h_id, | ||
NodeMap & | node_map | ||
) | const |
Computes the edit cost between two graphs induced by a node map.
[in] | g_id | ID of input graph. |
[in] | h_id | ID of input graph. |
[in,out] | node_map | Node map whose induced edit cost is to be computed. |
Definition at line 641 of file ged_env.ipp.
double ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::get_avg_num_nodes | ( | ) | const |
Returns average number of nodes.
Definition at line 592 of file ged_env.ipp.
ExchangeGraph< UserNodeID, UserNodeLabel, UserEdgeLabel > ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::get_graph | ( | GEDGraph::GraphID | graph_id | ) | const |
Returns ged::ExchangeGraph representation.
graph_id | ID of the selected graph. |
Definition at line 610 of file ged_env.ipp.
const std::string & ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::get_graph_class | ( | GEDGraph::GraphID | graph_id | ) | const |
Returns the graph class.
[in] | graph_id | ID of an input graph that has been added to the environment. |
Definition at line 578 of file ged_env.ipp.
const std::string & ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::get_graph_name | ( | GEDGraph::GraphID | graph_id | ) | const |
Returns the graph name.
[in] | graph_id | ID of an input graph that has been added to the environment. |
Definition at line 603 of file ged_env.ipp.
double ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::get_init_time | ( | ) | const |
Returns initialization time.
Definition at line 634 of file ged_env.ipp.
double ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::get_lower_bound | ( | GEDGraph::GraphID | g_id, |
GEDGraph::GraphID | h_id | ||
) | const |
Returns lower bound for edit distance between the input graphs.
[in] | g_id | ID of an input graph that has been added to the environment. |
[in] | h_id | ID of an input graph that has been added to the environment. |
g_id
and h_id
. Definition at line 534 of file ged_env.ipp.
const NodeMap & ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::get_node_map | ( | GEDGraph::GraphID | g_id, |
GEDGraph::GraphID | h_id | ||
) | const |
Returns node map between the input graphs.
[in] | g_id | ID of an input graph that has been added to the environment. |
[in] | h_id | ID of an input graph that has been added to the environment. |
g_id
and h_id
. Definition at line 556 of file ged_env.ipp.
std::size_t ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::get_num_nodes | ( | GEDGraph::GraphID | graph_id | ) | const |
Returns the number of nodes.
[in] | graph_id | ID of an input graph that has been added to the environment. |
Definition at line 585 of file ged_env.ipp.
double ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::get_runtime | ( | GEDGraph::GraphID | g_id, |
GEDGraph::GraphID | h_id | ||
) | const |
Returns runtime.
[in] | g_id | ID of an input graph that has been added to the environment. |
[in] | h_id | ID of an input graph that has been added to the environment. |
g_id
and h_id
. Definition at line 567 of file ged_env.ipp.
double ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::get_upper_bound | ( | GEDGraph::GraphID | g_id, |
GEDGraph::GraphID | h_id | ||
) | const |
Returns upper bound for edit distance between the input graphs.
[in] | g_id | ID of an input graph that has been added to the environment. |
[in] | h_id | ID of an input graph that has been added to the environment. |
g_id
and h_id
. Definition at line 545 of file ged_env.ipp.
std::pair< GEDGraph::GraphID, GEDGraph::GraphID > ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::graph_ids | ( | ) | const |
Provides access to the IDs of the graphs contained in the environment.
(ID of first graphs, ID of last graph + 1)
of graph IDs. If both entries equal 0, the environment does not contain any graphs. Definition at line 507 of file ged_env.ipp.
void ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::init | ( | Options::InitType | init_type = Options::InitType::EAGER_WITHOUT_SHUFFLED_COPIES | ) |
Initializes the environment.
[in] | init_type | Select initialization type. |
Definition at line 655 of file ged_env.ipp.
GEDGraph::GraphID ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::load_exchange_graph | ( | const ged::ExchangeGraph< UserNodeID, UserNodeLabel, UserEdgeLabel > & | exchange_graph, |
GEDGraph::GraphID | graph_id = ged::undefined() , |
||
const std::string & | graph_name = "" , |
||
const std::string & | graph_class = "" |
||
) |
Loads ged::ExchangeGraph into the environment.
[in] | exchange_graph | The ged::ExchangeGraph graph that should be loaded. |
[in] | graph_id | The ID of a graph contained the environment (overwrite existing graph) or ged::undefined() (add new graph). |
[in] | graph_name | The name of newly added graph. Empty if not specified. Has no effect unless graph_id equals ged::undefined(). |
[in] | graph_class | The class of newly added graph. Empty if not specified. Has no effect unless graph_id equals ged::undefined(). |
graph_id
is set to ged::undefined(), all graphs contained in the environment have to be re-initialized. Definition at line 104 of file ged_env.ipp.
GEDGraph::GraphID ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::load_gxl_graph | ( | const std::string & | file_name, |
Options::GXLNodeEdgeType | node_type, | ||
Options::GXLNodeEdgeType | edge_type, | ||
const std::unordered_set< std::string > & | irrelevant_node_attributes, | ||
const std::unordered_set< std::string > & | irrelevant_edge_attributes, | ||
GEDGraph::GraphID | graph_id = ged::undefined() , |
||
const std::string & | graph_class = "" |
||
) |
Load graph given in the GXL file format.
[in] | file_name | Complete path to GXL file. |
[in] | node_type | Select if nodes are labeled or unlabeled. |
[in] | edge_type | Select if edges are labeled or unlabeled. |
[in] | irrelevant_node_attributes | Set of node attributes that are irrelevant for the selected edit costs. |
[in] | irrelevant_edge_attributes | Set of edge attributes that are irrelevant for the selected edit costs. |
[in] | graph_id | The ID of a graph contained the environment (overwrite existing graph) or ged::undefined() (add new graph). |
[in] | graph_class | The class of the added graph. Empty if not specified. Has no effect unless graph_id equals ged::undefined(). |
graph_id
is set to ged::undefined(), all graphs contained in the environment have to be re-initialized. UserNodeID
is set to ged::GXLUserNodeID and the template parameters UserNodeLabel
and UserEdgeLabel
are set to ged::GXLLabel. std::vector<GEDGraph::GraphID> ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::load_gxl_graphs | ( | const std::string & | graph_dir, |
const std::string & | collection_file, | ||
Options::GXLNodeEdgeType | node_type = Options::GXLNodeEdgeType::LABELED , |
||
Options::GXLNodeEdgeType | edge_type = Options::GXLNodeEdgeType::LABELED , |
||
const std::unordered_set< std::string > & | irrelevant_node_attributes = std::unordered_set< std::string >() , |
||
const std::unordered_set< std::string > & | irrelevant_edge_attributes = std::unordered_set< std::string >() |
||
) |
Loads graphs given in the GXL file format.
[in] | graph_dir | The path to the directory containing the graphs. |
[in] | collection_file | The path to a XML file thats lists the graphs contained in graph_dir that should be loaded. |
[in] | node_type | Select if nodes are labeled or unlabeled. |
[in] | edge_type | Select if edges are labeled or unlabeled. |
[in] | irrelevant_node_attributes | Set of node attributes that are irrelevant for the selected edit costs. |
[in] | irrelevant_edge_attributes | Set of edge attributes that are irrelevant for the selected edit costs. |
UserNodeID
is set to ged::GXLUserNodeID and the template parameters UserNodeLabel
and UserEdgeLabel
are set to ged::GXLLabel. std::size_t ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::num_graphs | ( | ) | const |
The number of graphs contained in the environment.
Definition at line 514 of file ged_env.ipp.
bool ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::quasimetric_costs | ( | ) | const |
Checks if the edit costs are quasimetric.
true
if the edit costs are quasimetric and false
, otherwise. Definition at line 648 of file ged_env.ipp.
void ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::run_method | ( | GEDGraph::GraphID | g_id, |
GEDGraph::GraphID | h_id | ||
) |
Runs the GED method specified by call to set_method() between the graphs with IDs g_id
and h_id
.
[in] | g_id | ID of an input graph that has been added to the environment. |
[in] | h_id | ID of an input graph that has been added to the environment. |
Definition at line 471 of file ged_env.ipp.
void ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::set_edit_costs | ( | Options::EditCosts | edit_costs, |
std::initializer_list< double > | edit_cost_constants = {} |
||
) |
Sets the edit costs to one of the predefined edit costs.
[in] | edit_costs | Select one of the predefined edit costs. |
[in] | edit_cost_constants | Constants passed to the constructor of the edit cost class selected by edit_costs . |
Definition at line 55 of file ged_env.ipp.
void ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::set_edit_costs | ( | EditCosts< UserNodeLabel, UserEdgeLabel > * | edit_costs | ) |
Sets the edit costs to user defined edit costs.
[in] | edit_costs | Pointer to user defined edit costs. Must be freed by the user. |
Definition at line 62 of file ged_env.ipp.
void ged::GEDEnv< UserNodeID, UserNodeLabel, UserEdgeLabel >::set_method | ( | Options::GEDMethod | method, |
const std::string & | options = std::string("") |
||
) |
Sets the GEDMethod to be used by run_method().
[in] | method | Select the method that is to be used. |
[in] | options | An options string of the form "[--<option> <arg>] [...]" passed to the selected method. |
Definition at line 384 of file ged_env.ipp.