Re: Element test
- To: mathgroup at smc.vnet.net
- Subject: [mg61218] Re: Element test
- From: Joerg Schaber <schaber at molgen.mpg.de>
- Date: Thu, 13 Oct 2005 01:39:28 -0400 (EDT)
- References: <dii8pd$9cq$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
to test wether an element is member of a list you might try
In[61]:=
(#\[Equal]39)&/@{4,2,9,39,40}
Out[61]=
{False,False,False,True,False}
best,
joerg
leigh pascoe wrote:
> 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
>