diff options
Diffstat (limited to 'sourcecodes/bnt-master/SLP/misc/isdag.m')
| -rw-r--r-- | sourcecodes/bnt-master/SLP/misc/isdag.m | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/SLP/misc/isdag.m b/sourcecodes/bnt-master/SLP/misc/isdag.m new file mode 100644 index 00000000..8335d58c --- /dev/null +++ b/sourcecodes/bnt-master/SLP/misc/isdag.m @@ -0,0 +1,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 |
