matlab - Determine whether a network (graph) is connected based on its matrix -
how can determine given m x n matrix desribing two-mode network whether connected or not?
of course once can create data structure finding out – there mathematical solution?
i found out n x n matrices (one-mode network) easy: solution be: m * m
, looking @ diagonal in resulting matrix. if there 0 on diagonal not connected. isn't true?
what suggestion both problems?
it not simple one-mode networks, you're close.
the network matrix m
tells node connected other node in 1 step. m * m
tells node connected other node in exactly two steps, m ^ 3
whether in exactly three steps, , on. "exactly" important, because if nodes not connected (zero diagonal elements), m * m
not obtain two-step connectivity, loses one-step connectivity.
the products (powers) therefore more useful if nodes connected themselves:
a = (m + eye(size(m)) > 0)
this step converts weighted matrix pure adjacency matrix. now
(a ^ > 0)
gives information whether 2 nodes connected in i
steps or less. in network n = size(m, 1)
nodes, distance between 2 nodes can @ n - 1
steps. therefore
c = (a ^ (n - 1) > 0)
gives information whether 2 nodes connected at all. whole network connected if there no pairs of unconnected nodes, i.e. if
connected = (sum(c(:)) == n ^ 2)
i'm not sure how 1 define connectedness in two-mode network. simple approach disregard difference between 2 types of nodes, , consider them part of one-mode network. if m
original two-mode network matrix of size [m, n] = size(m)
,
m = [zeros(m, m) , m ; m' ; zeros(n, n)];
converts matrix describing corresponding one-mode network of size (m+n)
x(m+n)
.
these matrix powers not tell whether whole network connected, can used find connected sub-networks (network clusters) if not. since behavior of powers of matrix closely connected spectral decomposition (a.k.a. eigendecomposition), idea leads approach of spectral clustering. application weighted synchronization networks, see e.g. arxiv:0706.3375.
Comments
Post a Comment