MathGroup Archive 2011

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

Search the Archive

Bug: Combinatorica Neighborhood doesn't do anything.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119188] Bug: Combinatorica Neighborhood doesn't do anything.
  • From: BernieTheJet <berniethejet at gmail.com>
  • Date: Tue, 24 May 2011 05:58:37 -0400 (EDT)

I am not sure what the relationship between Combinatorica and the
built in Mathematica functions is anymore.  It seems a lot of Combinatorica
has been moved to the kernel.  That being said, I believe there is no
kernel Neighborhood function for graphs yet, and if so, the one in
Combinatorica doesn't do much of anything:

So, for example, try:

GraphPlot[ nn = {1 -> 2, 1 -> 3, 2 -> 5, 2 -> 3, 3 -> 4, 4 -> 3, 3 ->
6,  5 -> 6}, VertexLabeling -> True, DirectedEdges -> True]

Then

Needs["Combinatorica`"]

and

Neighborhood[nn, 2, 1]

Out[3] = {2, 1 -> 3}

which makes no sense.  The answer should be {3,5}.

Even better, try:

Neighborhood[nn, 2, 2]

Out[4]=
Part::pspec: Part specification {2,1->3} is neither an integer nor a
list of integers. >>
Part::pspec: Part specification {2,1->3} is neither an integer nor a
list of integers. >>
Union::heads: Heads Part and List at positions 2 and 1 are expected to
be the same. >>

{2, 1 -> 3} \[Union] {1 -> 2, 1 -> 3, 2 -> 5, 2 -> 3, 3 -> 4, 4 -> 3,
3 -> 6, 5 -> 6}[[{2, 1 -> 3}]]

which is even more entertaining.

regards,

Bernard


  • Prev by Date: Re: Series[log[x], {x, 0, 3}]
  • Next by Date: Re: Very (very very) slow typing for Mathematica in large cells.
  • Previous by thread: Re: How to plot y=f(x) or given y interval?
  • Next by thread: Permute in KroneckerProduct