has --- check if the graph has a particular vertex or edge has(g,u) --- check if g contains the vertex u has(g,u,v) --- check if g contains the edge uv
0001 function yn = has(g,u,v) 0002 % has --- check if the graph has a particular vertex or edge 0003 % has(g,u) --- check if g contains the vertex u 0004 % has(g,u,v) --- check if g contains the edge uv 0005 0006 global GRAPH_MAGIC; 0007 n = nv(g); 0008 0009 if (nargin==1) 0010 yn = (u>0) & (u<=n) 0011 else 0012 if (u<0) | (u>n) | (v<0) | (v>n) | (u==v) 0013 yn = 0; 0014 else 0015 yn = GRAPH_MAGIC.graphs{g.idx}.array(u,v); 0016 end 0017 end