ywh19860616 发表于 2012-5-12 20:25 
epoh老师,恩,我理解您说的,可是,从40楼上传的文献,作者好像并未提到W需要那样的结构。
with dij ...
两个d是不同的
第一个 d :threshold distance d
在 distance_wm.m 就用上了
dista = GeogDistance(lat,long); % Create pairwise distance matrix
temp1 = sort(dista); % Sort the distance matrix (1st row will be zeros)
temp2 = temp1(2:end,:); % Grab the second through nth row
temp3 = min(temp2); % Find minimum values of all columns
d = max(temp3); % Find largest minimum value and use that as d
% d = user specified distance for cutoff
% e.g. d = 10 would indicate a 10 mile distance cutoff
dw = dista;
[n k] = size(dw);
for i = 1:n
for j = 1:n
if (dw(i,j)==0)
dw(i,j)=0;
elseif (
dw(i,j)<=d);
dw(i,j)=1;
else
dw(i,j)=0;
end
end
end
W = sparse(normw(dw));
第二个 d : d=max(max(dista)) %82.0487
主要是用来转换成FRACTIONAL distance matrix
with dij = 1 for the maximum pairwise distance
dista
dista =
0 26.3976 46.9654 64.7889 62.6534 36.7131 43.1493 30.9348
26.3976 0 20.6691 38.3926 39.3141 50.1330 25.8122 29.2114
46.9654 20.6691 0 18.0368 28.1406 67.6762 28.9354 43.4492
64.7889 38.3926 18.0368 0 24.4042 82.0487 37.9407 56.7230
62.6534 39.3141 28.1406 24.4042 0 68.3261 22.4538 43.2943
36.7131 50.1330 67.6762 82.0487 68.3261 0 46.2011 25.5506
43.1493 25.8122 28.9354 37.9407 22.4538 46.2011 0 20.8906
30.9348 29.2114 43.4492 56.7230 43.2943 25.5506 20.8906 0
dista/d
ans =
0 0.3217 0.5724 0.7896 0.7636 0.4475 0.5259 0.3770
0.3217 0 0.2519 0.4679 0.4792 0.6110 0.3146 0.3560
0.5724 0.2519 0 0.2198 0.3430 0.8248 0.3527 0.5296
0.7896 0.4679 0.2198 0 0.2974 1.0000 0.4624 0.6913
0.7636 0.4792 0.3430 0.2974 0 0.8328 0.2737 0.5277
0.4475 0.6110 0.8248
1.0000 0.8328 0 0.5631 0.3114
0.5259 0.3146 0.3527 0.4624 0.2737 0.5631 0 0.2546
0.3770 0.3560 0.5296 0.6913 0.5277 0.3114 0.2546 0