GEDLIB
1.0
|
Abstract class for methods that use lossy transformations to LSAPE for approximating the graph edit distance. More...
#include <lsape_based_method.hpp>
Public Member Functions | |
virtual | ~LSAPEBasedMethod ()=0 |
Pure virtual destructor. More... | |
LSAPEBasedMethod (const GEDData< UserNodeLabel, UserEdgeLabel > &ged_data) | |
Constructor. More... | |
void | populate_instance_and_run_as_util (const GEDGraph &g, const GEDGraph &h, Result &result, DMatrix &lsape_instance) |
Runs the method with options specified by set_options() and provides access to constructed LSAPE instance. More... | |
void | populate_instance (const GEDGraph &g, const GEDGraph &h, DMatrix &lsape_instance) |
Populates the LSAPE instance. More... | |
Public Member Functions inherited from ged::GEDMethod< UserNodeLabel, UserEdgeLabel > | |
virtual | ~GEDMethod ()=0 |
Pure virtual destructor. More... | |
GEDMethod (const GEDData< UserNodeLabel, UserEdgeLabel > &ged_data) | |
Constructor. More... | |
void | set_options (const std::string &options) |
Sets the options of the method. More... | |
void | run (GEDGraph::GraphID g_id, GEDGraph::GraphID h_id) |
Runs the method with options specified by set_options(). More... | |
void | run_as_util (const GEDGraph &g, const GEDGraph &h, Result &result) |
Runs the method with options specified by set_options(). More... | |
void | init () |
Initializes the method with options specified by set_options(). | |
double | get_upper_bound () const |
Returns an upper bound. More... | |
double | get_lower_bound () const |
Returns a lower bound. More... | |
Seconds | get_runtime () const |
Returns the runtime. More... | |
Seconds | get_init_time () const |
Returns the initialization time. More... | |
const NodeMap & | get_node_map () const |
Returns a graph matching. More... | |
Protected Attributes | |
LSAPESolver::Model | lsape_model_ |
Specifies model for optimal LSAPE solver. | |
LSAPESolver::GreedyMethod | greedy_method_ |
Specifies method for greedy LSAPE solver. | |
bool | compute_lower_bound_ |
Flag that should be set to true if and only if the method computes a lower bound. | |
bool | solve_optimally_ |
Flag that equals true if an optimal LSAPE solver is used and false if a greedy method is employed. | |
std::size_t | num_threads_ |
The number of threads to be used. | |
Protected Attributes inherited from ged::GEDMethod< UserNodeLabel, UserEdgeLabel > | |
bool | initialized_ |
A flag that equals true if init() has been called and false otherwise. | |
const GEDData< UserNodeLabel, UserEdgeLabel > & | ged_data_ |
The data on which the method is run. | |
Private Member Functions | |
virtual void | ged_init_ () final |
Initializes the method. More... | |
virtual void | ged_run_ (const GEDGraph &g, const GEDGraph &h, Result &result) final |
Runs the method with options specified by set_options(). More... | |
virtual bool | ged_parse_option_ (const std::string &option, const std::string &arg) final |
Parses one option. More... | |
virtual std::string | ged_valid_options_string_ () const final |
Returns string of all valid options. More... | |
virtual void | ged_set_default_options_ () final |
Sets all options to default values. More... | |
virtual void | lsape_init_ () |
Initializes the method after initializing the global variables for the graphs. More... | |
virtual bool | lsape_parse_option_ (const std::string &option, const std::string &arg) |
Parses one option that is not among the ones shared by all derived classes of ged::LSAPEBasedMethod. More... | |
virtual std::string | lsape_valid_options_string_ () const |
Returns string of all valid options that are not among the ones shared by all derived classes of ged::LSAPEBasedMethod. More... | |
virtual void | lsape_set_default_options_ () |
Sets all options that are not among the ones shared by all derived classes of ged::LSAPEBasedMethod to default values. More... | |
virtual void | lsape_populate_instance_ (const GEDGraph &g, const GEDGraph &h, DMatrix &lsape_instance) |
Populates the LSAPE instance. More... | |
virtual void | lsape_init_graph_ (const GEDGraph &graph) |
Initializes global variables for one graph. More... | |
virtual void | lsape_pre_graph_init_ (bool called_at_runtime) |
Initializes the method at runtime or during initialization before initializing the global variables for the graphs. More... | |
virtual void | lsape_default_post_graph_init_ () |
Default initializes the method at runtime after initializing the global variables for the graphs. More... | |
virtual double | lsape_lower_bound_scaling_factor_ (const GEDGraph &g, const GEDGraph &h) |
Returns scaling factor for lower bound. More... | |
Abstract class for methods that use lossy transformations to LSAPE for approximating the graph edit distance.
Implements the paradigm LSAPE-GED described in:
and the extension of LSAPE-GED which uses node centrality measures:
All derived classes support the following options:
--<option> <arg> | modified parameter | default | more information |
---|---|---|---|
--threads <convertible to int greater 0> | number of threads | 1 | can be used by derived classes |
--lsape-model ECBP|EBP|FLWC|FLCC|FBP|SFBP|FBP0 | model for optimally solving LSAPE | ECBP | ged::LSAPESolver::Model |
--greedy-method BASIC|REFINED|LOSS|BASIC_SORT|INT_BASIC_SORT | method for greedily solving LSAPE | BASIC | ged::LSAPESolver::GreedyMethod |
--optimal TRUE|FALSE | solve optimally or greedily | TRUE | if TRUE , the option --greedy-method has no effect if FALSE , the option --lsape-method has no effect |
--centrality-method NONE|DEGREE|EIGENVECTOR|PAGERANK | node centrality method | NONE | https:://doi.org/10.1016/j.patcog.2014.11.002 if NONE , the option --centrality-weight has no effect |
--centrality-weight <convertible to double between 0 and 1> | weight of node centralities | 0.7 | https:://doi.org/10.1016/j.patcog.2014.11.002 |
--max-num-solutions ALL|<convertible to int greater 0> | maximal number of solutions | 1 | the actual number of computed solutions might be smaller than the specified value |
Definition at line 56 of file lsape_based_method.hpp.
|
pure virtual |
Pure virtual destructor.
Definition at line 35 of file lsape_based_method.ipp.
ged::LSAPEBasedMethod< UserNodeLabel, UserEdgeLabel >::LSAPEBasedMethod | ( | const GEDData< UserNodeLabel, UserEdgeLabel > & | ged_data | ) |
Constructor.
[in] | ged_data | The instance on which the method should be run. |
Definition at line 39 of file lsape_based_method.ipp.
|
finalprivatevirtual |
Initializes the method.
Reimplemented from ged::GEDMethod< UserNodeLabel, UserEdgeLabel >.
Definition at line 116 of file lsape_based_method.ipp.
|
finalprivatevirtual |
Parses one option.
[in] | option | The name of the option. |
[in] | arg | The argument of the option. |
true
if option
is a valid option name for the method and false
otherwise. Reimplemented from ged::GEDMethod< UserNodeLabel, UserEdgeLabel >.
Definition at line 135 of file lsape_based_method.ipp.
|
finalprivatevirtual |
Runs the method with options specified by set_options().
[in] | g | Input graph. |
[in] | h | Input graph. |
[out] | result | Result variable. |
Reimplemented from ged::GEDMethod< UserNodeLabel, UserEdgeLabel >.
Definition at line 127 of file lsape_based_method.ipp.
|
finalprivatevirtual |
Sets all options to default values.
Reimplemented from ged::GEDMethod< UserNodeLabel, UserEdgeLabel >.
Definition at line 273 of file lsape_based_method.ipp.
|
finalprivatevirtual |
Returns string of all valid options.
[–<option> <arg>] [...]
. Reimplemented from ged::GEDMethod< UserNodeLabel, UserEdgeLabel >.
Definition at line 263 of file lsape_based_method.ipp.
|
privatevirtual |
Default initializes the method at runtime after initializing the global variables for the graphs.
Reimplemented in ged::MLBasedMethod< UserNodeLabel, UserEdgeLabel >, and ged::Ring< UserNodeLabel, UserEdgeLabel >.
Definition at line 415 of file lsape_based_method.ipp.
|
privatevirtual |
Initializes the method after initializing the global variables for the graphs.
Reimplemented in ged::MLBasedMethod< UserNodeLabel, UserEdgeLabel >, ged::Walks< UserNodeLabel, UserEdgeLabel >, ged::Ring< UserNodeLabel, UserEdgeLabel >, and ged::Subgraph< UserNodeLabel, UserEdgeLabel >.
Definition at line 376 of file lsape_based_method.ipp.
|
privatevirtual |
Initializes global variables for one graph.
[in] | graph | Graph for which the global variables have to be initialized. |
Reimplemented in ged::MLBasedMethod< UserNodeLabel, UserEdgeLabel >, ged::Walks< UserNodeLabel, UserEdgeLabel >, ged::Ring< UserNodeLabel, UserEdgeLabel >, ged::BranchUniform< UserNodeLabel, UserEdgeLabel >, ged::Star< UserNodeLabel, UserEdgeLabel >, ged::BranchFast< UserNodeLabel, UserEdgeLabel >, and ged::Subgraph< UserNodeLabel, UserEdgeLabel >.
Definition at line 405 of file lsape_based_method.ipp.
|
privatevirtual |
Returns scaling factor for lower bound.
[in] | g | g Input graph. |
[in] | h | h Input graph. |
Reimplemented in ged::Star< UserNodeLabel, UserEdgeLabel >.
Definition at line 420 of file lsape_based_method.ipp.
|
privatevirtual |
Parses one option that is not among the ones shared by all derived classes of ged::LSAPEBasedMethod.
[in] | option | The name of the option. |
[in] | arg | The argument of the option. |
option
is a valid option name for the method and false otherwise. Reimplemented in ged::MLBasedMethod< UserNodeLabel, UserEdgeLabel >, ged::Walks< UserNodeLabel, UserEdgeLabel >, ged::Ring< UserNodeLabel, UserEdgeLabel >, ged::Subgraph< UserNodeLabel, UserEdgeLabel >, ged::BranchUniform< UserNodeLabel, UserEdgeLabel >, ged::Star< UserNodeLabel, UserEdgeLabel >, and ged::BranchFast< UserNodeLabel, UserEdgeLabel >.
Definition at line 381 of file lsape_based_method.ipp.
|
privatevirtual |
Populates the LSAPE instance.
[in] | g | Input graph. |
[in] | h | Input graph. |
[out] | lsape_instance | LSAPE instance of size (n + 1) x (m + 1), where n and m are the number of nodes in g and h . The last row and the last column represent insertion and deletion. |
Reimplemented in ged::MLBasedMethod< UserNodeLabel, UserEdgeLabel >, ged::Walks< UserNodeLabel, UserEdgeLabel >, ged::Ring< UserNodeLabel, UserEdgeLabel >, ged::Subgraph< UserNodeLabel, UserEdgeLabel >, ged::BranchUniform< UserNodeLabel, UserEdgeLabel >, ged::BranchFast< UserNodeLabel, UserEdgeLabel >, ged::Star< UserNodeLabel, UserEdgeLabel >, ged::Bipartite< UserNodeLabel, UserEdgeLabel >, ged::Branch< UserNodeLabel, UserEdgeLabel >, and ged::Node< UserNodeLabel, UserEdgeLabel >.
Definition at line 400 of file lsape_based_method.ipp.
|
privatevirtual |
Initializes the method at runtime or during initialization before initializing the global variables for the graphs.
[in] | called_at_runtime | Equals true if called at runtime and false if called during initialization. Must be overridden by derived classes of ged::LSAPEBasedMethod that require default initialization at runtime before initializing the global variables for the graphs. |
Reimplemented in ged::MLBasedMethod< UserNodeLabel, UserEdgeLabel >, ged::Walks< UserNodeLabel, UserEdgeLabel >, ged::Ring< UserNodeLabel, UserEdgeLabel >, and ged::Subgraph< UserNodeLabel, UserEdgeLabel >.
Definition at line 410 of file lsape_based_method.ipp.
|
privatevirtual |
Sets all options that are not among the ones shared by all derived classes of ged::LSAPEBasedMethod to default values.
Reimplemented in ged::MLBasedMethod< UserNodeLabel, UserEdgeLabel >, ged::Walks< UserNodeLabel, UserEdgeLabel >, ged::Ring< UserNodeLabel, UserEdgeLabel >, ged::BranchUniform< UserNodeLabel, UserEdgeLabel >, ged::Star< UserNodeLabel, UserEdgeLabel >, ged::BranchFast< UserNodeLabel, UserEdgeLabel >, and ged::Subgraph< UserNodeLabel, UserEdgeLabel >.
Definition at line 395 of file lsape_based_method.ipp.
|
privatevirtual |
Returns string of all valid options that are not among the ones shared by all derived classes of ged::LSAPEBasedMethod.
Reimplemented in ged::MLBasedMethod< UserNodeLabel, UserEdgeLabel >, ged::Walks< UserNodeLabel, UserEdgeLabel >, ged::Ring< UserNodeLabel, UserEdgeLabel >, ged::BranchUniform< UserNodeLabel, UserEdgeLabel >, ged::Star< UserNodeLabel, UserEdgeLabel >, ged::Subgraph< UserNodeLabel, UserEdgeLabel >, and ged::BranchFast< UserNodeLabel, UserEdgeLabel >.
Definition at line 388 of file lsape_based_method.ipp.
void ged::LSAPEBasedMethod< UserNodeLabel, UserEdgeLabel >::populate_instance | ( | const GEDGraph & | g, |
const GEDGraph & | h, | ||
DMatrix & | lsape_instance | ||
) |
Populates the LSAPE instance.
[in] | g | Input graph. |
[in] | h | Input graph. |
[out] | lsape_instance | LSAPE instance. |
Definition at line 56 of file lsape_based_method.ipp.
void ged::LSAPEBasedMethod< UserNodeLabel, UserEdgeLabel >::populate_instance_and_run_as_util | ( | const GEDGraph & | g, |
const GEDGraph & | h, | ||
Result & | result, | ||
DMatrix & | lsape_instance | ||
) |
Runs the method with options specified by set_options() and provides access to constructed LSAPE instance.
[in] | g | Input graph. |
[in] | h | Input graph. |
[out] | result | Result variable. |
[out] | lsape_instance | LSAPE instance. |
Definition at line 71 of file lsape_based_method.ipp.