-
Notifications
You must be signed in to change notification settings - Fork 10
/
vf2_sub_state.h
74 lines (57 loc) · 1.95 KB
/
vf2_sub_state.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*------------------------------------------------------------
* vf2_sub_state.h
* Interface of vf2_sub_state.cc
* Definition of a class representing a state of the matching
* process between two ARGs.
* See: argraph.h state.h
*
* Author: P. Foggia
*-----------------------------------------------------------------*/
#ifndef VF2_SUB_STATE_H
#define VF2_SUB_STATE_H
#include "argraph.h"
#include "state.h"
/*----------------------------------------------------------
* class VF2SubState
* A representation of the SSR current state
* See vf2_sub_state.cc for more details.
---------------------------------------------------------*/
class VF2SubState: public State
{ typedef ARGraph_impl Graph;
private:
int core_len, orig_core_len;
int added_node1;
int t1both_len, t2both_len, t1in_len, t1out_len,
t2in_len, t2out_len; // Core nodes are also counted by these...
node_id *core_1;
node_id *core_2;
node_id *in_1;
node_id *in_2;
node_id *out_1;
node_id *out_2;
node_id *order;
Graph *g1, *g2;
int n1, n2;
long *share_count;
public:
VF2SubState(Graph *g1, Graph *g2, bool sortNodes=false);
VF2SubState(const VF2SubState &state);
~VF2SubState();
Graph *GetGraph1() { return g1; }
Graph *GetGraph2() { return g2; }
bool NextPair(node_id *pn1, node_id *pn2,
node_id prev_n1=NULL_NODE, node_id prev_n2=NULL_NODE);
bool IsFeasiblePair(node_id n1, node_id n2);
void AddPair(node_id n1, node_id n2);
bool IsGoal() { return core_len==n1 ; };
bool IsDead() { return n1>n2 ||
t1both_len>t2both_len ||
t1out_len>t2out_len ||
t1in_len>t2in_len;
};
int CoreLen() { return core_len; }
void GetCoreSet(node_id c1[], node_id c2[]);
State *Clone();
virtual void BackTrack();
};
#endif