GEDLIB  1.0
hed.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_HED_HPP_
28 #define SRC_METHODS_HED_HPP_
29 
30 namespace ged {
31 
45 template<class UserNodeLabel, class UserEdgeLabel>
46 class HED : public GEDMethod<UserNodeLabel, UserEdgeLabel> {
47 
48 public:
49 
50  virtual ~HED();
51 
53 
54 private:
55 
56  LSAPESolver::Model lsape_model_;
57 
58  std::size_t num_threads_;
59 
60  // Inherited member functions from GEDMethod.
61 
62  virtual void ged_run_(const GEDGraph & g, const GEDGraph & h, Result & result) final;
63 
64  virtual bool ged_parse_option_(const std::string & option, const std::string & arg) final;
65 
66  virtual std::string ged_valid_options_string_() const final;
67 
68  virtual void ged_set_default_options_() final;
69 
70  // Helper member functions.
71 
72  void populate_instance_(const GEDGraph & g, const GEDGraph & h, DMatrix & lsape_instance) const;
73 
74  double compute_substitution_cost_(const GEDGraph & g, const GEDGraph & h, GEDGraph::NodeID i, GEDGraph::NodeID k) const;
75 
76  double compute_deletion_cost_(const GEDGraph & g, GEDGraph::NodeID i) const;
77 
78  double compute_insertion_cost_(const GEDGraph & h, GEDGraph::NodeID k) const;
79 };
80 
81 }
82 
83 
84 
85 
86 
87 #endif /* SRC_METHODS_HED_HPP_ */
Computes a lower bound for general edit costs.
Definition: hed.hpp:46
Contains the standardized input data along with basic functionality.
Definition: ged_data.hpp:55
virtual std::string ged_valid_options_string_() const final
Returns string of all valid options.
Definition: hed.ipp:103
A wrapper structure for the result of calls to ged::GEDMethod::run_as_util() and ged::GEDMethod::ged_...
Definition: result.hpp:38
Abstract class for the (suboptimal) computation of the graph edit distance.
Definition: ged_method.hpp:40
virtual void ged_run_(const GEDGraph &g, const GEDGraph &h, Result &result) final
Runs the method with options specified by set_options().
Definition: hed.ipp:48
The normalized input graphs used by GEDLIB. All labels are integers.
Definition: ged_graph.hpp:104
Global namespace for GEDLIB.
virtual bool ged_parse_option_(const std::string &option, const std::string &arg) final
Parses one option.
Definition: hed.ipp:60
virtual void ged_set_default_options_() final
Sets all options to default values.
Definition: hed.ipp:110
std::size_t NodeID
Internally used vertex ID type.
Definition: ged_graph.hpp:108
Model
Selects a model for solving LSAPE with the Hungarian algorithm.