about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/SLP/misc/isdag.m
blob: 8335d58c52dc57750b7d1b60efadd05507598928 (plain)
1
2
3
4
5
6
7
8
9
function b = isdag(G)
% b = isdag(G)
% 
b = sum(sum(G.*G'));        % How many undirected arcs ? (x2)
b=~b & ~isempty(G);
if b
  M = expm(full(G)) - eye(length(G)); M = (M>0);
  b = isempty(find(sum(sum(eye(length(G)).*M)))); % is there no cycle ?
end