Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*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 2006

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

Search the Archive

Re: Bizarre results with TreePlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64982] Re: Bizarre results with TreePlot
  • From: Maxim <m.r at inbox.ru>
  • Date: Fri, 10 Mar 2006 05:15:14 -0500 (EST)
  • References: <dujs54$940$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On Tue, 7 Mar 2006 11:52:04 +0000 (UTC), Renan <renan.birck at gmail.com>  
wrote:

> Hello MathGroup,
>
> From DiscreteMath`GraphPlot` help:
>
> (Apologies if there are any typos: I was unable to get it to
> copy/paste without the formatting tags)
>
> "This plots a binary tree:
>
> g = Flatten[Table[{i -> 2*i, i -> 2*i + 1}, {i, 2^4 - 1}]];
> TreePlot[g];"
>
> Graphics::gprim: DiscreteMath`Tree`Private`TreePlot0[1->3,-1,1] was
> encountered where a Graphics primitive or directive was expected.
> [More...]
>
> Graphics::gprim: DiscreteMath`Tree`Private`TreePlot0[2->4,-0.928571,1]
> was encountered where a Graphics primitive or directive was expected.
> [More...]
>
> Graphics::gprim: DiscreteMath`Tree`Private`TreePlot0[2->5,-0.928571,1]
> was encountered where a Graphics primitive or directive was expected.
> [More...]
>
> Now, I don't understand why this gives wrong result, if it was copied
> straight from the help file .
>
> Any clues? This is Mathematica 5.2 on Windows.
>
> Thanks,
> Renan
>

There are two different TreePlot functions: one in DiscreteMath`GraphPlot`  
and another in DiscreteMath`Tree`. My guess is that you loaded only init.m  
 from StandardPackages\DiscreteMath\Kernel, which is what <<discretemath`  
does (for more details see Add-Ons & Links | Standard Packages | Appendix:  
How Mathematica Packages Are Set Up and also A.6.1 in Mathematica Book;  
the latter explains about $Path):

In[1]:= <<discretemath`

In[2]:= Context /@ Names["*`TreePlot"]

Out[2]= {"DiscreteMath`GraphPlot`", "DiscreteMath`Tree`"}

DeclarePackage["DiscreteMath`Tree`", {"TreePlot", ...}] is called the  
last, so DiscreteMath`Tree` will be the first on the context search path.  
Unfortunately, DeclarePackage doesn't generate warnings about the symbol  
shadowing. You can always modify $ContextPath yourself though.

Maxim Rytin
m.r at inbox.ru


  • Prev by Date: Re: Automatic & linked axis scaling
  • Next by Date: Re: Mathematica and Education
  • Previous by thread: Re: Bizarre results with TreePlot
  • Next by thread: Listable functions with two brackets f[][] (SubValues)