DaveM@16
|
1 function linkList = depthCheck(linkList)
|
DaveM@19
|
2 %% linkList = depthCheck(linkList)
|
DaveM@19
|
3 % depthCheck will extend a linkList, created by the linkages algorithm, and
|
DaveM@19
|
4 % append an extra column on the end which indicated the depth of the
|
DaveM@19
|
5 % linkage, so the top level is 1, and each following level is the number of
|
DaveM@19
|
6 % links needed to get to the top level - which could be considered the
|
DaveM@19
|
7 % number of rules that exist.
|
DaveM@19
|
8 %
|
DaveM@19
|
9 % The other method for measuring depth would be
|
DaveM@19
|
10 % to look at the value of the linkage distance - thresholding and grouping
|
DaveM@19
|
11 % the linkage distances could be beneficial for some analysis.
|
DaveM@16
|
12
|
DaveM@16
|
13 listSize = size(linkList,1)+1;
|
DaveM@16
|
14
|
DaveM@16
|
15 linkList = cat(2,linkList, zeros(size(linkList,1),1));
|
DaveM@16
|
16 currentRow = size(linkList,1);
|
DaveM@16
|
17 r = [0;0];
|
DaveM@16
|
18 % depth = 1;
|
DaveM@16
|
19
|
DaveM@16
|
20 linkList(currentRow,end) = 1;
|
DaveM@16
|
21 % depth = depth + 1;
|
DaveM@16
|
22 %%
|
DaveM@16
|
23 while (~isempty(currentRow))
|
DaveM@16
|
24 row = currentRow(1);
|
DaveM@16
|
25 for i = 1:2
|
DaveM@16
|
26 r(i) = linkList(row,i);
|
DaveM@16
|
27 if(r(i) > listSize)
|
DaveM@16
|
28 r(i) = linkList(row,i) - listSize;
|
DaveM@16
|
29 linkList(r(i),end) = linkList(currentRow(1),end)+1;
|
DaveM@16
|
30 currentRow = [currentRow; r(i)];
|
DaveM@16
|
31 end
|
DaveM@16
|
32 end
|
DaveM@16
|
33 currentRow = currentRow(2:end);
|
DaveM@16
|
34 end
|
DaveM@16
|
35 end
|
DaveM@16
|
36
|