To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Revision:

root / _FullBNT / BNT / graph / connected_graph.m @ 8:b5b38998ef3b

History | View | Annotate | Download (221 Bytes)

1
function b = connected(adj_mat, directed)
2
%
3
% b = connected(adj_mat).
4
% Returns true iff the graph is connected.
5

    
6
n = length(adj_mat);
7
start = 1;
8
[d, pre] = dfs(adj_mat, start, directed);
9
b = (length(pre) == n);