prufer prufer --- convert a tree to/from its Prufer code
resistance R = resistance(g) --- calculate resistances between vertices
springxy springxy(g) --- find a spring embedding of g
SOURCE CODE
0001 function yn = isconnected(g)
0002 % isconnected(g) --- test if g is a connected graph
0003
0004 global GRAPH_MAGIC
0005
0006 n = nv(g);
0007 if (n==0)
0008 yn = 1;
0009 return
0010 end
0011
0012 x = zeros(n,1);
0013 x(1) = 1;
0014 while(1)
0015 y = x;
0016 x = GRAPH_MAGIC.graphs{g.idx}.array*x + x;
0017 x = double(x>0);
0018 if (x==y)
0019 break
0020 end
0021 end
0022
0023 yn = sum(x)==n;