main page
namespaces
classes
files
GGL home
Generated on Wed Apr 29 2015 11:51:40 for GGL-4.1.2 by
doxygen
1.8.3.1
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
src
sgm
SGM_vf2.hh
Go to the documentation of this file.
1
#ifndef SGM_VF2_H_
2
#define SGM_VF2_H_
3
4
#include "
sgm/SubGraphMatching.hh
"
5
#include "
sgm/VF2_MatchingHandler.hh
"
6
7
namespace
sgm {
8
9
10
/*! @brief VF2-based subgraph matching
11
*
12
* An sgm::SubGraphMatching interface implementation that uses the
13
* implementation of the VF-2 algorithm for its computation.
14
*
15
* @author Martin Mann (c) 2008 http://www.bioinf.uni-freiburg.de/~mmann/
16
*/
17
class
SGM_vf2
:
public
SubGraphMatching
,
public
VF2_MatchingHandler
{
18
19
protected
:
20
21
typedef
VF2_MatchingHandler::Label
Label
;
22
typedef
VF2_MatchingHandler::LabelComparator
LabelComparator
;
23
typedef
VF2_MatchingHandler::NodeData
NodeData
;
24
typedef
VF2_MatchingHandler::NodeDataVec
NodeDataVec
;
25
typedef
VF2_MatchingHandler::EdgeLabel
EdgeLabel
;
26
typedef
VF2_MatchingHandler::EdgeLabelVec
EdgeLabelVec
;
27
typedef
VF2_MatchingHandler::PatternMap
PatternMap
;
28
typedef
VF2_MatchingHandler::VF2_match_handler
VF2_match_handler
;
29
typedef
VF2_MatchingHandler::PatternVec
PatternVec
;
30
typedef
VF2_MatchingHandler::ReporterVec
ReporterVec
;
31
32
//! Comparator class for the node data used in the internal VF-2
33
//! data structures
34
class
NodeComparator
:
public
LabelComparator
{
35
public
:
36
//! the label defining the wildcard to use
37
using
LabelComparator::pWildcard
;
38
//! access to the pattern currently matched
39
const
sgm::Pattern_Interface
&
pattern
;
40
//! access to the target graph processed
41
const
sgm::Graph_Interface
&
target
;
42
//! construction
43
//! @param pWildcard access to the wildcard label
44
//! @param pattern the pattern currently matched
45
//! @param target the target graph currently processed
46
NodeComparator
(
const
Label
&
pWildcard
47
,
const
sgm::Pattern_Interface
&
pattern
48
,
const
sgm::Graph_Interface
&
target
);
49
//! comparison of the two pointers and objects.
50
//! @param pa first label pointer, assumed to be the pattern
51
//! @param pb second label pointer, assumed to be the target
52
//! @return true if the node data is compatible for matching
53
virtual
bool
compatible
(
void
*pa,
void
*pb);
54
};
55
56
//! Comparator class for the edge label used in the internal VF-2
57
//! data structures
58
class
EdgeLabelComparator
:
public
LabelComparator
{
59
public
:
60
//! the label defining the wildcard to use
61
using
LabelComparator::pWildcard
;
62
//! construction
63
//! @param pWildcard access to the wildcard label
64
EdgeLabelComparator
(
const
Label
&
pWildcard
);
65
//! comparison of the two pointers and objects.
66
//! @param pa first label pointer, assumed to be the pattern
67
//! @param pb second label pointer, assumed to be the target
68
//! @return true if pa and pb are Label pointers != NULL and pa
69
//! has a lexicographically smaller text
70
virtual
bool
compatible
(
void
*pa,
void
*pb);
71
};
72
73
74
public
:
75
76
77
//////////////////// SUB GRAPH MATCHING //////////////////////////////
78
79
80
//! Performs exact sub graph matching to find maxHits occurrences of
81
//! the pattern graph within the target graph. Each hit is reported to
82
//! the Match_Reporter object.
83
//! @param pattern the pattern graph to search for
84
//! @param target the graph to search the pattern within
85
//! @param reporter all hits are reported to that object
86
//! @param maxHits the maximal number of hits to find
87
//! @return the number of exact matches found
88
virtual
89
size_t
90
findMatches
(
const
Pattern_Interface
& pattern,
91
const
Graph_Interface
& target,
92
Match_Reporter
& reporter,
93
const
size_t
maxHits );
94
95
//! Performs exact sub graph matching to find maxHits occurrences of
96
//! the pattern graphs within the target graph. Each hit is reported
97
//! to the Match_Reporter object.
98
//! NOTE, the first maxHits matches of the pattern graphs according
99
//! to their order in the patterns container are reported, i.e. first
100
//! all occurrences of the first pattern are identified. If this does
101
//! not exceed the maxHits limit, the next pattern is matched and so
102
//! on until either no pattern is left or the maxHits limit is
103
//! exceeded.
104
//! @param patterns the container of the pattern graphs to search for
105
//! @param target the graph to search the pattern within
106
//! @param reporter all hits are reported to that object
107
//! @param maxHits the maximal number of hits to find
108
//! @return the number of exact matches found
109
virtual
110
size_t
111
findMatches
(
const
std::vector< const Pattern_Interface*> & patterns,
112
const
Graph_Interface
& target,
113
Match_Reporter
& reporter,
114
const
size_t
maxHits );
115
116
//! Performs exact sub graph matching to find maxHits occurrences of
117
//! the pattern graphs within the target graph. Each hit is reported
118
//! to the Match_Reporter object.
119
//! NOTE, the first maxHits matches of the pattern graphs according
120
//! to their order in the patterns container are reported, i.e. first
121
//! all occurrences of the first pattern are identified. If this does
122
//! not exceed the maxHits limit, the next pattern is matched and so
123
//! on until either no pattern is left or the maxHits limit is
124
//! exceeded.
125
//! @param patterns the container of the pattern graphs to search for
126
//! @param target the graph to search the pattern within
127
//! @param reporters each hit is reported to the corresponding object,
128
//! the container has to have the same length as patterns
129
//! @param maxHits the maximal number of hits to find
130
//! @return the number of exact matches found
131
virtual
132
size_t
133
findMatches
(
const
std::vector< const Pattern_Interface*> & patterns,
134
const
Graph_Interface
& target,
135
std::vector<Match_Reporter*> & reporters,
136
const
size_t
maxHits );
137
138
};
139
140
}
// namespace sgm
141
142
#endif
/*SGM_VF2_H_*/