Element test
- To: mathgroup at smc.vnet.net
- Subject: [mg61180] Element test
- From: leigh pascoe <leigh at cephb.fr>
- Date: Wed, 12 Oct 2005 01:42:05 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Dear Group,
I have a defined a graph that is a function of n, gr1[n], with n^2 +4
vertices and 2n(n+1) edges.
I would like to remove some edges from this graph, corresponding to all
edges leading to the vertices in the set list[n]. Since Ma doesn't seem
to have a PERL like Foreach construct, I tried something like the following:
In[42]:=
Do[If[Element[i,list[6]],
ShowGraph[test=DeleteEdges[gr1[6],{{{i,j}} ,{ j,1,40}}],
VertexNumber\[Rule]True]],{i,1,40}]
Unfortunately this doesn't work. The problem (apart from possible syntax
errors) seems to lie in the fact that
Element[i, list[6]] never evaluates to True. For a specific example
using the list {4,2,9,39,40},
In[33]:=
Element[39,list[6]]
Out[33]=
39\[Element]{4,2,9,39,40}
whereas the similar statement
In[27]:=
149\[Element]Primes
Out[27]=
True
How can I delete the edges to the vertices in list[n] from my graph?
Thanks
LP