-
Notifications
You must be signed in to change notification settings - Fork 0
/
FocusPreProcess.m
50 lines (48 loc) · 1.44 KB
/
FocusPreProcess.m
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
function [M0] = FocusPreProcess(A_list_H, A_list_G, A_H, A_G)
%FocusPreProcess Generate the initial domain in focus search
% FocusPreProcess(A_list_H, A_list_G, A_H, A_G) returns a matrix M0 of
% size (N_G, N_H) where each row of the matrix represents the domain of a
% query vertex
%
% REQUIRED INPUTS:
% A_list_H - the adjacency list of the data graph
% A_list_G - the adjacency list of the query graph
% A_H - the adjacency matrix of the data graph
% A_G - the adjacency matrix of the query graph
% initialise variables
N_H = size(A_list_H , 1);
N_G = size(A_list_G , 1);
deg_H = sum(A_H, 2);
deg_G = sum(A_G, 2);
deg_neig_H = cell(N_H, 1);
deg_neig_G = cell(N_G, 1);
M0 = ones(N_G,N_H);
% create degree of neighbours list used in iterated labeling filtering
for v_H = 1:N_H
for j = 1:deg_H(v_H)
deg_neig_H{v_H} = [deg_neig_H{v_H} deg_H(A_list_H(v_H,j))];
end
deg_neig_H{v_H} = sort(deg_neig_H{v_H},'descend');
end
for v_G = 1:N_G
for j = 1:deg_G(v_G)
deg_neig_G{v_G} = [deg_neig_G{v_G} deg_G(A_list_G(v_G,j))];
end
deg_neig_G{v_G} = sort(deg_neig_G{v_G},'descend');
end
% filtering domains
for v_H=1:N_H
for v_G=1:N_G
if deg_H(v_H)<deg_G(v_G)
M0(v_G,v_H)=0;
else
for k = 1:deg_G(v_G)
if deg_neig_H{v_H}(k) < deg_neig_G{v_G}(k)
M0(v_G,v_H)=0;
break
end
end
end
end
end
end