How to print a tree "vertically" defined by `AbstractTrees.jl`

See the following example.

julia> using AbstractTrees

julia> function AbstractTrees.children(i::Integer)
           if i <= 3
               return i + 1, i + 2
           end 
           return ()
       end
julia> print_tree(1)
1
├─ 2
│  ├─ 3
│  │  ├─ 4
│  │  └─ 5
│  └─ 4
└─ 3
   ├─ 4
   └─ 5

Does there exist any package or utility method to print a tree in its normal looking? That is, I want the form below

Perhaps try GitHub - JuliaGraphs/GraphPlot.jl: Graph visualization for Julia.. Probably have to tweak settings to get it to look the way you want.

1 Like

Thanks. I believe Graphviz is also a good choice for printing into a file. However, I want to print the above tree into the terminal.