-
Notifications
You must be signed in to change notification settings - Fork 1
/
DFSprint.m
executable file
·24 lines (24 loc) · 955 Bytes
/
DFSprint.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
% =======================================================================
% author: Xueqing Liu
% =======================================================================
% % Chi Wang et al., Towards Interactive Construction of Topical Hierarchy: A
% Recursive Tensor Decomposition Approach, KDD 2015.
% =======================================================================
% print indented tree text file
% =======================================================================
function DFSprint(currentnode, fid, spaces)
fprintf(fid, spaces);
fprintf(fid, '%s:\t', currentnode.name);
if isempty(currentnode.topici) == 0
for i = 1:size(currentnode.topici)
fprintf(fid, '%s,\t', currentnode.topici{i});
end
end
fprintf(fid, '\n');
if isempty(currentnode.children) == 0
for i = 1:size(currentnode.children, 2)
DFSprint(currentnode.children{i}, fid, [spaces, '\t']);
end
end
end