| Author |
Comment/Response |
Bill Simpson
|
09/18/12 8:54pm
Make an example graph
In[4]:= g1=CompleteGraph[5];ShowGraph[g1]
<graphic snipped>
Extract all the edges
In[7]:= e=ToUnorderedPairs[g1]
Out[7]= {{1,2},{1,3},{1,4},{1,5},{2,3},{2,4},{2,5},{3,4},{3,5},{4,5}}
Extract edges that include vertex 3
In[8]:= Cases[e,{___,3,___}]
Out[8]= {{1,3},{2,3},{3,4},{3,5}}
Extract the verticies adjacent to vertex 3
In[9]:= DeleteCases[Flatten[ae],3]
Out[9]= {1,2,4,5}
Thus verticies 1,2,4,5 are adjacent to vertex 3
URL: , |
|