2
$\begingroup$

I would like make the attached image by Mathematica. someone who could help me? Thank!enter image description here

$\endgroup$
3
  • 3
    $\begingroup$ Or CompleteKaryTree $\endgroup$
    – Öskå
    Jun 12, 2014 at 14:20
  • $\begingroup$ And at least but not last.., have you even tried anything? Like getting the coordinates of the points? $\endgroup$
    – Öskå
    Jun 12, 2014 at 15:05
  • $\begingroup$ Now I just saw the comments ... thanks everyone for the help $\endgroup$
    – user15850
    Jun 13, 2014 at 6:46

2 Answers 2

6
$\begingroup$

Not a perfect match but a start

Partition[Table[Column[{"i = " <> ToString[2^(n - 1)], 
 CompleteKaryTree[n, 
  ImagePadding -> 
   10, (AbsoluteOptions[
     CompleteKaryTree[n, VertexLabels -> "Name", ImagePadding -> 10], 
     VertexCoordinates] /. {x_?NumericQ, y_?NumericQ} :> {x, -y})], 
 "\[Omega] = " <> ToString[n]}, Center], {n, 2, 5}], 2] // Grid

enter image description here

$\endgroup$
0
6
$\begingroup$

If you have Version 9, you can use the GraphLayout suboptions as follows:

bbt[n_] := 
Labeled[GraphUnion[CompleteKaryTree[n], Graph[{UndirectedEdge[0, 1]}],
                   BaseStyle ->Directive[Opacity[1], Black, PointSize[.015]],
                   EdgeStyle -> Directive[{Black, Thick}], AspectRatio -> 1,
                   VertexShapeFunction -> "Point",  ImageSize -> 300,
                   GraphLayout -> {"LayeredEmbedding", "RootVertex" -> 0,
                                   "Orientation" -> Bottom, 
                                   LayerSizeFunction -> (If[# == 1, 1, 2^(n - #)] &)}],
       {"i = " <> ToString[2^(n - 1)],"\[Omega] = " <> ToString[n]}, 
       {Top, Bottom}];

Row[bbt /@ Range[2,7], Spacer[5]]

enter image description here

$\endgroup$
5
  • $\begingroup$ I'm afraid that it doesn't look the same on v8. None of the GraphLayout options seem to work for me. $\endgroup$
    – Öskå
    Jun 13, 2014 at 9:26
  • $\begingroup$ @Öskå, right - these GraphLayout options are new-in-version-9. $\endgroup$
    – kglr
    Jun 13, 2014 at 9:31
  • $\begingroup$ Well, they seem to be very useful! You already have my +1 $\endgroup$
    – Öskå
    Jun 13, 2014 at 9:38
  • $\begingroup$ @Oska, thank you for the +. $\endgroup$
    – kglr
    Jun 13, 2014 at 9:50
  • $\begingroup$ Well, your output looks like what the OP desired, the raw one from CompleteKaryTree is getting flatter and flatter. $\endgroup$
    – Öskå
    Jun 13, 2014 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.