GEDLIB  1.0
branch_uniform.hpp
Go to the documentation of this file.
1 /***************************************************************************
2 * *
3 * Copyright (C) 2018 by David B. Blumenthal *
4 * *
5 * This file is part of GEDLIB. *
6 * *
7 * GEDLIB is free software: you can redistribute it and/or modify it *
8 * under the terms of the GNU Lesser General Public License as published *
9 * by the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * GEDLIB is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU Lesser General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU Lesser General Public *
18 * License along with GEDLIB. If not, see <http://www.gnu.org/licenses/>. *
19 * *
20 ***************************************************************************/
21 
27 #ifndef SRC_METHODS_BRANCH_UNIFORM_HPP_
28 #define SRC_METHODS_BRANCH_UNIFORM_HPP_
29 
30 namespace ged {
31 
45 template<class UserNodeLabel, class UserEdgeLabel>
46 class BranchUniform : public LSAPEBasedMethod<UserNodeLabel, UserEdgeLabel> {
47 
48 public:
49  virtual ~BranchUniform();
50 
52 
53 private:
54 
55  enum SortMethod_ {STD, COUNTING};
56 
57  class SortedEdgeLabels_ {
58  public:
59  SortedEdgeLabels_(const GEDGraph & g, SortMethod_ sort_method);
60 
61  SortedEdgeLabels_();
62 
63  void operator=(const SortedEdgeLabels_ & sorted_edge_labels);
64 
65  const std::vector<LabelID> & get_incident_labels(GEDGraph::NodeID) const;
66 
67  private:
68  std::map<GEDGraph::NodeID, std::vector<LabelID>> sorted_edge_labels_;
69  };
70 
71  SortMethod_ sort_method_;
72 
73  bool wildcard_option_;
74 
75  std::map<GEDGraph::GraphID, SortedEdgeLabels_> sorted_edge_labels_;
76 
77  // Member functions inherited from LSAPEBasedMethod.
78 
79  virtual bool lsape_parse_option_(const std::string & option, const std::string & arg) final;
80 
81  virtual std::string lsape_valid_options_string_() const final;
82 
83  virtual void lsape_set_default_options_() final;
84 
85  virtual void lsape_populate_instance_(const GEDGraph & g, const GEDGraph & h, DMatrix & master_problem) final;
86 
87  virtual void lsape_init_graph_(const GEDGraph & graph) final;
88 
89  // Private helper member functions.
90 
91  double compute_substitution_cost_(const GEDGraph & g, const GEDGraph & h, GEDGraph::NodeID i, GEDGraph::NodeID k,
92  const SortedEdgeLabels_ & sorted_edge_labels_g, const SortedEdgeLabels_ & sorted_edge_labels_h,
93  double min_edge_subs_cost, double min_edge_del_cost, double min_edge_ins_cost) const;
94 
95  double compute_deletion_cost_(const GEDGraph & g, GEDGraph::NodeID i, double min_edge_edit_cost) const;
96 
97  double compute_insertion_cost_(const GEDGraph & h, GEDGraph::NodeID k, double min_edge_edit_cost) const;
98 
99 };
100 
101 }
102 
103 #endif /* SRC_METHODS_BRANCH_UNIFORM_HPP_ */
Contains the standardized input data along with basic functionality.
Definition: ged_data.hpp:55
virtual void lsape_set_default_options_() final
Sets all options that are not among the ones shared by all derived classes of ged::LSAPEBasedMethod t...
virtual void lsape_init_graph_(const GEDGraph &graph) final
Initializes global variables for one graph.
virtual std::string lsape_valid_options_string_() const final
Returns string of all valid options that are not among the ones shared by all derived classes of ged:...
Abstract class for methods that use lossy transformations to LSAPE for approximating the graph edit d...
virtual bool lsape_parse_option_(const std::string &option, const std::string &arg) final
Parses one option that is not among the ones shared by all derived classes of ged::LSAPEBasedMethod.
The normalized input graphs used by GEDLIB. All labels are integers.
Definition: ged_graph.hpp:104
virtual void lsape_populate_instance_(const GEDGraph &g, const GEDGraph &h, DMatrix &master_problem) final
Populates the LSAPE instance.
Global namespace for GEDLIB.
Computes lower and upper bounds for uniform edit costs.
std::size_t NodeID
Internally used vertex ID type.
Definition: ged_graph.hpp:108