-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnodeDepth.m
More file actions
45 lines (40 loc) · 1.01 KB
/
Copy pathnodeDepth.m
File metadata and controls
45 lines (40 loc) · 1.01 KB
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
function depth=nodeDepth(G,ideal,regime)
if ideal
margin=degree(G)<6;
else
margin=findMargin(G,regime);
end
%here, impose a margin on those nodes missed out
% margin([103 128 156 177 180 181 193 255])=true;
D=distances(G);
dist2bdry=D(:,margin);
sdb=sort(dist2bdry,2,'ascend');
if size(sdb,2)<8
depth=geomean(sdb,2);
else
depth=geomean(sdb(:,1:8),2);
end
end
%
% dat=load('../Lycophytes/graphFiles/AdiantumPedatumGraph.mat');
% ctrInds=dat.ctrInds;
% edges=dat.edges;
% find(ctrInds(:,1)>334 & ctrInds(:,1)<336 & ctrInds(:,2)>1950 & ctrInds(:,2)<1952)
% [iE,~]=find(edges==103)
%
% i=287
% ctrInds(edges(i,:),:)
%
%
% figure; plot(dat.ctrInds(:,1),dat.ctrInds(:,2),'.')
%
% hold on
% plot(dat.ctrInds(margin,1),dat.ctrInds(margin,2),'ro')
%
% for i=1:dat.nE
% plot(dat.ctrInds(dat.edges(i,:),1),dat.ctrInds(dat.edges(i,:),2),'g-')
% end
%
% for i=1:dat.nT
% text(dat.ctrInds(i,1)+5,dat.ctrInds(i,2)-5,sprintf('%d',i))
% end