0001 function d = deg(g,v)
0002 % deg: degree of a vertex or degree sequence
0003 % deg(g) --- degree sequence of g
0004 % deg(g,v) --- degree of v in g
0005
0006 global GRAPH_MAGIC
0007
0008
0009 if (nargin==1)
0010 d = full(sum(GRAPH_MAGIC.graphs{g.idx}.array));
0011 else
0012 d = full(sum(GRAPH_MAGIC.graphs{g.idx}.array(v,:)));
0013 end