0001 function nlist = neighbors(g,v)
0002 % neighbors(g,v) --- neighbors of v as a list.
0003 % Note: invoking g(v) has the same effect.
0004
0005 global GRAPH_MAGIC
0006
0007 n = nv(g);
0008 if (v<0) | (v>n)
0009 nlist = [];
0010 else
0011 nlist = find(GRAPH_MAGIC.graphs{g.idx}.array(v,:));
0012 end