Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

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


  • Prev by Date: Re: Re: Language vs. Library
  • Next by Date: Re: sqrt(x^2) = x
  • Previous by thread: Re: "Leibnitz" from for partial differentiation?
  • Next by thread: Re: Element test