27 #ifndef SRC_ENV_GED_DATA_HPP_ 28 #define SRC_ENV_GED_DATA_HPP_ 35 #include "../edit_costs/edit_costs.hpp" 36 #include "../edit_costs/chem_1.hpp" 37 #include "../edit_costs/chem_2.hpp" 38 #include "../edit_costs/cmu.hpp" 39 #include "../edit_costs/grec_1.hpp" 40 #include "../edit_costs/grec_2.hpp" 41 #include "../edit_costs/protein.hpp" 42 #include "../edit_costs/fingerprint.hpp" 43 #include "../edit_costs/letter.hpp" 44 #include "../edit_costs/constant.hpp" 48 template<
class,
class,
class>
class GEDEnv;
54 template<
class UserNodeLabel,
class UserEdgeLabel>
57 template<
class,
class,
class>
friend class GEDEnv;
111 std::vector<GEDGraph>::const_iterator
begin()
const;
119 std::vector<GEDGraph>::const_iterator
end()
const;
220 double swap_cost(
const GEDGraph & g,
const GEDGraph & h,
const NodeMap::Assignment & assignment_1,
const NodeMap::Assignment & assignment_2,
NodeMap & node_map)
const;
229 void swap_assignments(
const NodeMap::Assignment & assignment_1,
const NodeMap::Assignment & assignment_2,
double swap_cost,
NodeMap & node_map)
const;
439 std::vector<GEDGraph> graphs_;
441 std::vector<std::string> graph_names_;
443 std::vector<std::string> graph_classes_;
445 std::size_t num_graphs_without_shuffled_copies_;
447 std::vector<std::map<std::string, GEDGraph::NodeID>> strings_to_internal_node_ids_;
449 std::vector<std::map<GEDGraph::NodeID, std::string>> internal_node_ids_to_strings_;
457 std::vector<UserNodeLabel> node_labels_;
459 std::vector<UserEdgeLabel> edge_labels_;
463 bool delete_edit_costs_;
465 std::size_t max_num_nodes_;
467 std::size_t max_num_edges_;
471 void set_edit_costs_(
Options::EditCosts edit_costs,
const std::vector<double> & edit_cost_constants);
475 void init_cost_matrices_();
477 bool eager_init_()
const;
479 LabelID node_label_to_id_(
const UserNodeLabel & node_label);
481 UserNodeLabel id_to_node_label(
LabelID label_id)
const;
483 LabelID edge_label_to_id_(
const UserEdgeLabel & edge_label);
485 UserEdgeLabel id_to_edge_label(
LabelID label_id)
const;
std::size_t max_num_nodes() const
Returns maximal number of nodes.
double min_node_subs_cost(const GEDGraph &g, const GEDGraph &h) const
Returns the minimal cost of substituting a node contained in a graph by a node contained in another g...
Contains the standardized input data along with basic functionality.
void compute_induced_cost(const GEDGraph &g, const GEDGraph &h, NodeMap &node_map) const
Computes the edit cost between two graphs induced by a node map.
double edge_cost(LabelID label1, LabelID label2) const
Returns edge relabeling, insertion, or deletion cost.
double node_cost(LabelID label1, LabelID label2) const
Returns node relabeling, insertion, or deletion cost.
ged::Matrix class declaration.
double max_node_ins_cost(const GEDGraph &graph) const
Returns the maximal cost of inserting a node contained in a graph.
std::vector< GEDGraph >::size_type GraphID
Type of internally used graph IDs.
std::size_t max_num_edges() const
Returns maximal number of nodes.
void swap_assignments(const NodeMap::Assignment &assignment_1, const NodeMap::Assignment &assignment_2, double swap_cost, NodeMap &node_map) const
Swaps two assignments in a node map.
ged::NodeMap class declaration.
const GEDGraph & graph(GEDGraph::GraphID graph_id) const
Provides access to a graph.
ged::GEDGraph class declaration.
void vectorize_edge_label(LabelID edge_label, std::vector< double > &vector_representation) const
Computes an edge label's representation as a real-valued vector.
double mean_node_ins_cost(const GEDGraph &graph) const
Returns the mean cost of inserting a node contained in a graph.
double min_edit_cost(const GEDGraph &g, const GEDGraph &h) const
Returns the minimal edit cost between two graphs.
ged::Result struct declaration.
double mean_node_subs_cost(const GEDGraph &g, const GEDGraph &h) const
Returns the mean cost of substituting a node contained in a graph by a node contained in another grap...
double min_node_del_cost(const GEDGraph &graph) const
Returns the minimal cost of deleting a node contained in a graph.
double min_edge_edit_cost(const GEDGraph &g, const GEDGraph &h) const
Returns the minimal edge edit cost between two graphs.
double min_edge_subs_cost(const GEDGraph &g, const GEDGraph &h) const
Returns the minimal cost of substituting a edge contained in a graph by a edge contained in another g...
std::size_t num_edge_labels() const
Returns the number of edge labels.
bool is_shuffled_graph_copy(GEDGraph::GraphID graph_id) const
Checks if a graph is a shuffled copy of another graph.
double max_node_del_cost(const GEDGraph &graph) const
Returns the maximal cost of deleting a node contained in a graph.
std::size_t LabelID
Internally used type of node and edge labels.
double mean_edge_del_cost(const GEDGraph &graph) const
Returns the mean cost of deleting a edge contained in a graph.
double max_edit_cost(const GEDGraph &g, const GEDGraph &h) const
Returns the maximal edit cost between two graphs.
std::vector< GEDGraph >::const_iterator end() const
Provides access to the graphs contained in the instance.
double max_node_edit_cost() const
Returns the maximal node edit cost between any two graphs contained in the instance.
InitType
Selects the initialization type of the environment.
bool shuffled_graph_copies_available() const
Checks if shuffled graph copies are available.
GEDGraph::GraphID id_shuffled_graph_copy(GEDGraph::GraphID graph_id) const
Returns ID of a graph's shuffled copy.
double mean_edge_ins_cost(const GEDGraph &graph) const
Returns the mean cost of inserting a edge contained in a graph.
double swap_cost(const GEDGraph &g, const GEDGraph &h, const NodeMap::Assignment &assignment_1, const NodeMap::Assignment &assignment_2, NodeMap &node_map) const
Computes the cost of swapping two assignments in a node map while leaving the node map unchanged...
void vectorize_node_label(LabelID node_label, std::vector< double > &vector_representation) const
Computes a node label's representation as a real-valued vector.
Type declarations used by various classes.
std::size_t num_graphs_without_shuffled_copies() const
Returns the number of graphs in the instance without the shuffled copies.
double max_edge_ins_cost(const GEDGraph &graph) const
Returns the maximal cost of inserting a edge contained in a graph.
double min_edge_del_cost(const GEDGraph &graph) const
Returns the minimal cost of deleting a edge contained in a graph.
double mean_edge_subs_cost(const GEDGraph &g, const GEDGraph &h) const
Returns the mean cost of substituting a edge contained in a graph by a edge contained in another grap...
std::vector< GEDGraph >::const_iterator begin() const
Provides access to the graphs contained in the instance.
double max_node_subs_cost(const GEDGraph &g, const GEDGraph &h) const
Returns the maximal cost of substituting a node contained in a graph by a node contained in another g...
double min_edge_ins_cost(const GEDGraph &graph) const
Returns the minimal cost of inserting a edge contained in a graph.
double max_edge_del_cost(const GEDGraph &graph) const
Returns the maximal cost of deleting a edge contained in a graph.
The normalized input graphs used by GEDLIB. All labels are integers.
double max_edge_edit_cost() const
Returns the maximal edge edit cost between any two graphs contained in the instance.
bool quasimetric_costs() const
Checks if the edit costs are quasimetric.
double max_edge_subs_cost(const GEDGraph &g, const GEDGraph &h) const
Returns the maximal cost of substituting a edge contained in a graph by a edge contained in another g...
double min_node_edit_cost(const GEDGraph &g, const GEDGraph &h) const
Returns the minimal node edit cost between two graphs.
Global namespace for GEDLIB.
EditCosts
Selects the edit costs.
void save_node_map(const std::string &filename, GEDGraph::NodeID g_id, GEDGraph::NodeID h_id, const NodeMap &node_map, bool append=true) const
Saves a node map.
std::size_t num_node_labels() const
Returns the number of node labels.
double mean_node_del_cost(const GEDGraph &graph) const
Returns the mean cost of deleting a node contained in a graph.
double min_node_ins_cost(const GEDGraph &graph) const
Returns the minimal cost of inserting a node contained in a graph.
ged::GEDData class definition.
std::size_t NodeID
Internally used vertex ID type.
Abstract class for defining edit cost functions.
Provides the API of GEDLIB.
void load_node_map(const std::string &filename, GEDGraph::NodeID g_id, GEDGraph::NodeID h_id, NodeMap &node_map) const
Loads a node map from a file.
std::size_t num_graphs() const
Returns the number of graphs.