27 #ifndef SRC_METHODS_WALKS_HPP_ 28 #define SRC_METHODS_WALKS_HPP_ 46 template<
class UserNodeLabel,
class UserEdgeLabel>
57 typedef std::map<LabelID, double> Histogram_;
59 typedef std::map<LabelID, std::vector<std::size_t>> InverseLabelIndex_;
61 typedef std::pair<GEDGraph::NodeID, GEDGraph::NodeID> ProductNode_;
63 typedef std::map<std::pair<GEDGraph::NodeID, GEDGraph::NodeID>, std::size_t> ProductNodeSizeTMap_;
65 static std::size_t undefined_() {
return std::numeric_limits<std::size_t>::max();}
71 AdjGraph_(
const AdjGraph_ & adj_graph);
75 void operator=(
const AdjGraph_ & adj_graph);
79 std::pair<std::vector<std::size_t>::const_iterator, std::vector<std::size_t>::const_iterator> nodes_with_label(
LabelID label)
const;
81 std::size_t size()
const;
83 const Histogram_ & num_walks_from_node_to_labels(std::size_t node_id)
const;
85 double operator() (std::size_t row, std::size_t col)
const;
87 void compute_num_walks_(
const std::set<LabelID> & node_labels, std::size_t depth);
92 std::vector<Histogram_> num_walks_from_nodes_to_labels_;
96 InverseLabelIndex_ inverse_label_index_;
100 class ProductGraph_ {
104 std::pair<std::vector<std::size_t>::const_iterator, std::vector<std::size_t>::const_iterator> nodes_with_label(
LabelID label)
const;
108 void compute_num_unmatched_walks_(
const std::set<LabelID> & node_labels,
const AdjGraph_ & adj_graph_g,
const AdjGraph_ & adj_graph_h, std::size_t depth);
110 double num_substituted_walks_ending_at_same_label(std::size_t row, std::size_t col)
const;
112 double num_substituted_walks_ending_at_different_labels(std::size_t row, std::size_t col)
const;
114 double num_inserted_or_deleted_walks(std::size_t row, std::size_t col)
const;
119 DMatrix num_substituted_walks_ending_at_same_label_;
121 DMatrix num_substituted_walks_ending_at_different_labels_;
123 DMatrix num_inserted_or_deleted_walks_;
125 std::vector<ProductNode_> nodes_;
127 InverseLabelIndex_ inverse_label_index_;
129 ProductNodeSizeTMap_ product_node_to_id_;
134 std::size_t min_depth_;
136 std::size_t max_depth_;
140 std::string outfile_;
142 std::map<GEDGraph::GraphID, AdjGraph_> adj_graphs_;
150 virtual bool lsape_parse_option_(
const std::string & option,
const std::string & arg)
final;
162 void init_node_labels_(
const GEDGraph & g,
const GEDGraph & h, std::set<LabelID> & node_labels)
const;
164 bool load_config_file_()
const;
Contains the standardized input data along with basic functionality.
virtual void lsape_init_graph_(const GEDGraph &graph) final
Initializes global variables for one graph.
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...
std::map< std::size_t, NodeID > SizeTNodeMap
Map that assigns node IDs to integers.
Computes an upper bound for general edit costs.
virtual void lsape_init_() final
Initializes the method after initializing the global variables for the graphs.
virtual void lsape_populate_instance_(const GEDGraph &g, const GEDGraph &h, DMatrix &master_problem) final
Populates the LSAPE instance.
std::size_t LabelID
Internally used type of node and edge labels.
Abstract class for methods that use lossy transformations to LSAPE for approximating the graph edit d...
The normalized input graphs used by GEDLIB. All labels are integers.
virtual void lsape_pre_graph_init_(bool called_at_runtime) final
Initializes the method at runtime or during initialization before initializing the global variables f...
Global namespace for GEDLIB.
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:...
std::size_t NodeID
Internally used vertex ID type.
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.