Group Abstract Group Abstract

Message Boards Message Boards

0
|
6.6K Views
|
5 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Difference between these codes plotting a TreeGraph?

Posted 8 years ago

Consider the following code:

TreeGraph[{Labeled[1, "Color?"], Labeled[2, "Size?"], 
      Labeled[3, "Shape?"], Labeled[4, "Size?"], Labeled[5, "Watermelon"],
       Labeled[6, "Apple"], Labeled[7, "Grape"], Labeled[8, "\!\(\*
    StyleBox[\"Size\",\nFontWeight->\"Bold\"]\)\!\(\*
    StyleBox[\"?\",\nFontWeight->\"Plain\"]\)"], Labeled[9, "Banana"], 
      Labeled[10, "Apple"], Labeled[11, "Taste?"], Labeled[12, "Pomelo"], 
      Labeled[13, "Lemon"], Labeled[14, "Cherry"], Labeled[15, "Grape"]},
     {Labeled[1 \[DirectedEdge] 2, "Green"], 
      Labeled[1 \[DirectedEdge] 3, "Yellow"], 
      Labeled[1 \[DirectedEdge] 4, "Red"], 
      Labeled[2 \[DirectedEdge] 5, "Big"], 
      Labeled[2 \[DirectedEdge] 6, "Middle"], 
      Labeled[2 \[DirectedEdge] 7, "Small"], 
      Labeled[3 \[DirectedEdge] 8, "Round"], 
      Labeled[3 \[DirectedEdge] 9, "Slimness"], 
      Labeled[4 \[DirectedEdge] 10, "Middle"], 
      Labeled[4 \[DirectedEdge] 11, "Small"], 
      Labeled[8 \[DirectedEdge] 12, "Big"], 
      Labeled[8 \[DirectedEdge] 13, "Small"], 
      Labeled[11 \[DirectedEdge] 14, "Sweet"], 
      Labeled[11 \[DirectedEdge] 15, "Sour"]}]

Above codes don't work, But it works when I change the last term like this:

TreeGraph[{Labeled[1, "Color?"], Labeled[2, "Size?"], 
  Labeled[3, "Shape?"], Labeled[4, "Size?"], Labeled[5, "Watermelon"],
   Labeled[6, "Apple"], Labeled[7, "Grape"], Labeled[8, "Size?"], 
  Labeled[9, "Banana"], Labeled[10, "Apple"], Labeled[11, "Taste?"], 
  Labeled[12, "Pomelo"], Labeled[13, "Lemon"], Labeled[14, "Cherry"], 
  Labeled[15, "Grape"]},
 {Labeled[1 \[DirectedEdge] 2, "Green"], 
  Labeled[1 \[DirectedEdge] 3, "Yellow"], 
  Labeled[1 \[DirectedEdge] 4, "Red"], 
  Labeled[2 \[DirectedEdge] 5, "Big"], 
  Labeled[2 \[DirectedEdge] 6, "Middle"], 
  Labeled[2 \[DirectedEdge] 7, "Small"], 
  Labeled[3 \[DirectedEdge] 8, "Round"], 
  Labeled[3 \[DirectedEdge] 9, "Slimness"], 
  Labeled[4 \[DirectedEdge] 10, "Middle"], 
  Labeled[4 \[DirectedEdge] 11, "Small"], 
  Labeled[8 \[DirectedEdge] 12, "Big"], 
  Labeled[8 \[DirectedEdge] 13, "Small"], 
  Labeled[11 \[DirectedEdge] 14, "Sweet"], 11 \[DirectedEdge] 15}].

I don't understand why ?

POSTED BY: Huadun Wang
5 Replies
POSTED BY: Michael Rogers

Sorry Michael! Your comments appears after I published mine :(

Hi Valeriu!

We were probably typing at the same time. :) I didn't see your response until now.

POSTED BY: Michael Rogers
Posted 8 years ago

these codes generate a graph like this: enter image description here

POSTED BY: Huadun Wang
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard