clc,clear;
label=[237 137
232 127
204 119
188 100
168 94
143 74
117 67
122 48
108 38
102 23
99 3
170 145
150 133
140 120
105 108
85 92
63 73
53 57
37 41
18 37
130 135
110 139
93 138
66 132
86 122
49 123
18 108
37 91
44 74
24 75
23 57
175 132
175 115
155 105
140 105
137 87
106 94
102 72
77 79
83 65
58 47
93 45
33 29
58 24
80 30
80 13
234 118
220 110
168 83
193 78
149 68
143 55
195 60
164 50
183 50
221 54
165 40
178 33
196 39
226 43
160 18
214 23
121 8
193 137
205 92
159 62
143 38
108 80
55 38
62 105
135 142
127 143
124 129
115 130
105 130
108 145
90 145
72 142
60 139
70 121
100 121
53 132
37 127
25 120
15 115
7 105
28 106
24 90
45 90
49 82
16 76
15 70
14 56
168 126
165 117
165 105
145 113
132 100
130 94
130 80
110 100
114 90
95 90
95 77
106 63
86 75
72 70
74 60
79 53
68 46
46 20
59 15
77 5
240 127
240 107
230 100
220 98
158 77
176 75
206 77
184 62
215 62
227 64
206 46
231 49
232 37
148 15
170 17
201 22
224 20 ];
relat=zeros(130,130);
ll=[1 2
2 64
2 3
2 47
47 48
64 3
3 48
64 12
64 32
3 32
3 33
3 4
48 65
65 4
65 50
50 4
4 33
33 32
12 13
13 32
13 14
13 21
21 14
35 14
35 34
34 5
4 5
5 49
49 50
50 53
53 56
60 56
60 62
59 62
59 53
55 59
59 58
55 58
58 57
61 58
55 53
54 55
57 54
54 66
66 51
6 51
6 5
36 6
36 34
22 21
22 23
24 23
24 26
27 26
27 28
30 28
30 31
20 31
20 19
43 19
43 44
46 44
46 11
63 11
63 67
61 67
67 57
52 67
67 9
66 52
52 7
8 52
7 8
42 8
8 9
63 9
9 10
45 9
45 10
46 45
45 44
42 45
69 44
41 69
41 18
19 18
18 29
17 18
29 31
30 29
29 28
70 28
70 26
25 70
70 16
24 25
25 23
15 25
37 15
15 14
39 16
39 40
42 40
42 38
68 38
68 37
19 31
10 11
10 63
16 17
15 16
7 68
12 32
33 34
6 7
71 21
72 21
73 21
74 22
75 22
76 22
77 23
78 24
79 24
80 25
81 25
82 26
83 26
84 27
85 27
86 27
87 27
88 28
89 28
90 29
91 30
92 30
93 31
94 32
95 33
96 34
97 35
98 35
99 36
100 36
101 37
102 37
103 37
104 38
105 38
106 39
107 40
108 40
109 40
110 41
111 44
112 44
113 46
114 47
115 47
116 48
117 48
118 49
119 49
120 50
121 53
122 56
123 56
124 59
125 60
126 60
127 61
128 61
129 62
130 62];
for i=1:175
relat(ll(i,1),ll(i,2))=1;
relat(ll(i,2),ll(i,1))=1;
end
for i=1:130
relat(i,i)=1;
end
for i=1:130
for j=1:130
p2p(i,j)=sqrt((label(i,1)-label(j,1))^2+(label(i,2)-label(j,2))^2);
p2p(i,j)=p2p(i,j)/relat(i,j);
if (abs(i-j)==1&i<=11&j<=11)
p2pa(i,j)=60*p2p(i,j)/70;
p2pb(i,j)=60*p2p(i,j)/60;
p2pc(i,j)=60*p2p(i,j)/50;
elseif (abs(i-j)==1&i<=20&i>=12&j<=20&j>=12)
p2pa(i,j)=60*p2p(i,j)/70;
p2pb(i,j)=60*p2p(i,j)/60;
p2pc(i,j)=60*p2p(i,j)/50;
else
p2pa(i,j)=60*p2p(i,j)/45;
p2pb(i,j)=60*p2p(i,j)/35;
p2pc(i,j)=60*p2p(i,j)/30;
end
end
end
p2p(isinf(p2p))=0;
p2pa(isinf(p2pa))=0;
p2pb(isinf(p2pb))=0;
p2pc(isinf(p2pc))=0;
for i=1:130
[d, p, pred] = graphshortestpath(sparse(p2p),i);
dist(i,:)=d;%记录任意点到点间的距离
path(i,:)=p;%记录点到点间最短距离的路径
[da, pa, pred] = graphshortestpath(sparse(p2pa),i);
dista(i,:)=da;%记录任意点到点间的距离
patha(i,:)=pa;%记录点到点间最短距离的路径
[db, pb, pred] = graphshortestpath(sparse(p2pb),i);
distb(i,:)=db;%记录任意点到点间的距离
pathb(i,:)=pb;%记录点到点间最短距离的路径
[dc, pc, pred] = graphshortestpath(sparse(p2pc),i);
distc(i,:)=dc;%记录任意点到点间的距离
pathc(i,:)=pc;%记录点到点间最短距离的路径
end
e=[1 0 0 0
12 0 0 0
20 0 0 0
43 0.016383513 0 0.022936918
19 0.018817718 0 0.026344805
54 0.020588169 0 0.028823437
2 0.023004233 0 0.032205926
17 0.030577737 0 0.042808831
51 0.033558213 0 0.046981499
52 0.033558213 0 0.046981499
11 0.061182447 0 0.085655426
5 0.06188349 0 0.086636886
10 0.065710183 0 0.091994256
55 0.070424023 0 0.098593632
45 0.076110225 0 0.106554314
58 0.091876096 0 0.128626534
8 0.137558182 0 0.192581455
9 0.137558182 0 0.192581455
57 0.148783018 0 0.208296225
4 0.152754495 0 0.213856293
16 0.1620296 0 0.22684144
18 0.171132183 0 0.239585056
31 0 0.25 0.25
46 0.01672097 0.25 0.273409357
7 0.197957406 0 0.277140369
3 0.23459371 0 0.328431195
39 0.082009826 0.25 0.364813757
6 0.286886585 0 0.401641218
29 0.109678098 0.25 0.403549337
23 0.116973417 0.25 0.413762784
59 0.118518814 0.25 0.415926339
34 0.12119015 0.25 0.419666211
33 0.126709415 0.25 0.427393181
41 0.132974006 0.25 0.436163608
42 0.341073661 0 0.477503125
30 0 0.5 0.5
35 0 0.5 0.5
47 0 0.5 0.5
49 0 0.5 0.5
60 0 0.5 0.5
61 0 0.5 0.5
62 0.003558045 0.5 0.504981263
38 0.003929448 0.5 0.505501227
14 0.362431057 0 0.50740348
48 0.03338929 0.5 0.546745006
36 0.03371844 0.5 0.547205816
26 0.047006252 0.5 0.565808752
56 0.05126291 0.5 0.571768073
32 0.233390363 0.25 0.576746508
24 0.079127613 0.5 0.610778658
28 0.108482317 0.5 0.651875244
25 0.110695944 0.5 0.654974322
15 0.522434358 0 0.731408101
40 0.06298562 0.75 0.838179868
22 0.122915949 0.75 0.922082328
27 0 1 1
37 0.21426536 0.75 1.049971504
44 0.443784677 0.5 1.121298548
50 0.639425048 0.25 1.145195067
53 0.695560546 0.25 1.223784764
21 0.386771533 0.75 1.291480146
13 1 0 1.4];
for i=63:130
for j=1:4
e(i,j)=0;
end
end
e=sortrows(e,1);
pathe=zeros(130,130);
pathae=zeros(130,130);
pathbe=zeros(130,130);
pathce=zeros(130,130);
for i=1:130
for j=1:130
r=size(path{i,j},2);
ra=size(patha{i,j},2);
rb=size(pathb{i,j},2);
rc=size(pathc{i,j},2);
for q=1:r
pathe(i,j)=pathe(i,j)+e(path{i,j}(1,q),4);
end
pathe(i,j)=pathe(i,j)-0.5*(path{i,j}(1,1)+path{i,j}(1,r));
for q=1:ra
pathae(i,j)=pathae(i,j)+e(patha{i,j}(1,q),4);
end
pathae(i,j)=pathae(i,j)-0.5*(patha{i,j}(1,1)+patha{i,j}(1,ra));
for q=1:rb
pathbe(i,j)=pathbe(i,j)+e(pathb{i,j}(1,q),4);
end
pathbe(i,j)=pathbe(i,j)-0.5*(pathb{i,j}(1,1)+pathb{i,j}(1,rb));
for q=1:rc
pathce(i,j)=pathce(i,j)+e(pathc{i,j}(1,q),4);
end
pathce(i,j)=pathce(i,j)-0.5*(pathc{i,j}(1,1)+pathc{i,j}(1,rc));
dist(i,j)=dist(i,j)/17+1.6*pathe(i,j);
dista(i,j)=dista(i,j)/17+1.6*pathae(i,j);
distb(i,j)=distb(i,j