# \#tree

**URL:** https://discourse.julialang.org/tag/tree/629.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Persistent vertex identities for Steiner tree, vertex removal](https://discourse.julialang.org/t/persistent-vertex-identities-for-steiner-tree-vertex-removal/119568)

<div class="topic-metadata">

**Author:** [@bremez](https://discourse.julialang.org/u/bremez)\
**Replies:** 7\
**Last updated:** [September 20, 2024, 2:32pm UTC](https://discourse.julialang.org/t/persistent-vertex-identities-for-steiner-tree-vertex-removal/119568 "2024-09-20T14:32:39Z")

</div>

I have a use case for a large graph, from which I iteratively remove vertices, and at each step compute some Steiner trees from its current state. Specifically, my use case requires to know to which vertices in the origi…

---

## [Why does recursive dereferencing occur during printing of a tree?](https://discourse.julialang.org/t/why-does-recursive-dereferencing-occur-during-printing-of-a-tree/110008)

<div class="topic-metadata">

**Author:** [@Julia2001](https://discourse.julialang.org/u/Julia2001)\
**Replies:** 12\
**Last updated:** [February 12, 2024, 3:31am UTC](https://discourse.julialang.org/t/why-does-recursive-dereferencing-occur-during-printing-of-a-tree/110008 "2024-02-12T03:31:35Z")

</div>

Hi! With my bidirectional tree (see below) I fell into the “circular reference” trap which makes me wonder why Julia (or something inside Julia?) shows this behavior in the first place. Coming from C I would expect the…

---

## [Use Dict to store tree with uninitialized tree nodes](https://discourse.julialang.org/t/use-dict-to-store-tree-with-uninitialized-tree-nodes/109895)

<div class="topic-metadata">

**Author:** [@Julia2001](https://discourse.julialang.org/u/Julia2001)\
**Replies:** 4\
**Last updated:** [February 8, 2024, 8:03pm UTC](https://discourse.julialang.org/t/use-dict-to-store-tree-with-uninitialized-tree-nodes/109895 "2024-02-08T20:03:02Z")

</div>

I would like to use a Dict with string keys to store a tree. The relations between nodes evolve over time. So they have to be left uninitialized for the most part during initial construction. I read about inner and oute…

---

## [Implementing a Trie](https://discourse.julialang.org/t/implementing-a-trie/99022)

<div class="topic-metadata">

**Author:** [@spionkaese](https://discourse.julialang.org/u/spionkaese)\
**Replies:** 6\
**Last updated:** [May 19, 2023, 4:06pm UTC](https://discourse.julialang.org/t/implementing-a-trie/99022 "2023-05-19T16:06:10Z")

</div>

I am currently trying to implement a (bitwise?) Trie mapping Ints to some type V, and want to branch k bits at a time (resulting in 2^k children per node). For a first attempt I went with k = 1 and my nodes looked like …

---

## [A Tree? Multi-dimensional Array? hmm](https://discourse.julialang.org/t/a-tree-multi-dimensional-array-hmm/89969)

<div class="topic-metadata">

**Author:** [@theboiwholived](https://discourse.julialang.org/u/theboiwholived)\
**Replies:** 9\
**Last updated:** [November 13, 2022, 11:02am UTC](https://discourse.julialang.org/t/a-tree-multi-dimensional-array-hmm/89969 "2022-11-13T11:02:25Z")

</div>

Hey all, could really use your expertise in determining if what i need here is a tree… and how i would go about doing that At the moment my code basically determines out the difference of all trades between currencies. …

---

## [Is it possible to traverse a tree without allocations](https://discourse.julialang.org/t/is-it-possible-to-traverse-a-tree-without-allocations/85490)

<div class="topic-metadata">

**Author:** [@peremato](https://discourse.julialang.org/u/peremato)\
**Replies:** 10\
**Last updated:** [August 15, 2022, 1:51pm UTC](https://discourse.julialang.org/t/is-it-possible-to-traverse-a-tree-without-allocations/85490 "2022-08-15T13:51:02Z")

</div>

I have defined a tree made of ‘nodes’ and ‘leaves’ as follows. Each leaf has a vector of indices that I would like to iterate under certain conditions. using AbstractTrees struct BVH name::String children::Unio…

---

## [Random file access](https://discourse.julialang.org/t/random-file-access/75842)

<div class="topic-metadata">

**Author:** [@skypuppy](https://discourse.julialang.org/u/skypuppy)\
**Replies:** 1\
**Last updated:** [February 5, 2022, 5:51pm UTC](https://discourse.julialang.org/t/random-file-access/75842 "2022-02-05T17:51:31Z")

</div>

I’ve not seen much code with core functions relating to files open and used in random access mode. I’ve seen a couple commands (but I’ve forgotten the details) that appear to be like C’s seek() and lseek() and such like…

---

## [Generate Tree Struct using EzXML.jl?](https://discourse.julialang.org/t/generate-tree-struct-using-ezxml-jl/73770)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 1\
**Last updated:** [February 2, 2022, 7:04pm UTC](https://discourse.julialang.org/t/generate-tree-struct-using-ezxml-jl/73770 "2022-02-02T19:04:59Z")

</div>

Hello! Is it possible to use EzXML.jl to extract the full tree of an XML file I am generating? For example if I have an XML as such: \<Main\> \<SubTag1\> \<LowerTag1 x="0" y="0" z="0" /\> \</SubTag1\> …

---

## [Best way to store a sparse, unbalanced, and not complete binary tree](https://discourse.julialang.org/t/best-way-to-store-a-sparse-unbalanced-and-not-complete-binary-tree/74902)

<div class="topic-metadata">

**Author:** [@AlessioLapolla](https://discourse.julialang.org/u/AlessioLapolla)\
**Replies:** 18\
**Last updated:** [January 23, 2022, 12:09pm UTC](https://discourse.julialang.org/t/best-way-to-store-a-sparse-unbalanced-and-not-complete-binary-tree/74902 "2022-01-23T12:09:43Z")

</div>

I am implementing a binary tree where given the key of the root and a function the left and right children are defined up to a given depth that is an other parameter of the constructing function: create\_tree!(tree, key, …

---

## [Help diagnosing a slow iterator](https://discourse.julialang.org/t/help-diagnosing-a-slow-iterator/74413)

<div class="topic-metadata">

**Author:** [@tecosaur](https://discourse.julialang.org/u/tecosaur)\
**Replies:** 5\
**Last updated:** [January 13, 2022, 9:56am UTC](https://discourse.julialang.org/t/help-diagnosing-a-slow-iterator/74413 "2022-01-13T09:56:16Z")

</div>

Note, this was asked on Zulip a week ago, but received no responses. Reposting in the hope that someone else might see and comment I have a tree-like structure, composed of a mix of types, and I’m looking to iterate th…

---

## [How to retrieve the edge list from a Dict reprepresenting a tree data structure](https://discourse.julialang.org/t/how-to-retrieve-the-edge-list-from-a-dict-reprepresenting-a-tree-data-structure/68802)

<div class="topic-metadata">

**Author:** [@empet](https://discourse.julialang.org/u/empet)\
**Replies:** 6\
**Last updated:** [September 27, 2021, 5:56pm UTC](https://discourse.julialang.org/t/how-to-retrieve-the-edge-list-from-a-dict-reprepresenting-a-tree-data-structure/68802 "2021-09-27T17:56:29Z")

</div>

I’m reading a tree data structure fron a json file, and I need to retrieve the vector of edge tuples, (parent, child), to define a LightGraphs.SimpleDiGraph and get the node positions via NetworkLayout.Buchheim layou…

---

## [Help design a node for a tree](https://discourse.julialang.org/t/help-design-a-node-for-a-tree/67444)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 20\
**Last updated:** [September 1, 2021, 2:37pm UTC](https://discourse.julialang.org/t/help-design-a-node-for-a-tree/67444 "2021-09-01T14:37:23Z")

</div>

I’m tracking moving animals in a video. Each video frame has a few “things” that may qualify to be an animal (dirt, experimenter’s hand, shadows, objects, etc). I’d like to keep track of most of these things, and then on…

---

## [Data type for a “stupid” binary search tree](https://discourse.julialang.org/t/data-type-for-a-stupid-binary-search-tree/64474)

<div class="topic-metadata">

**Author:** [@circonflexe](https://discourse.julialang.org/u/circonflexe)\
**Replies:** 4\
**Last updated:** [July 13, 2021, 3:59am UTC](https://discourse.julialang.org/t/data-type-for-a-stupid-binary-search-tree/64474 "2021-07-13T03:59:51Z")

</div>

I need a data type for a collection of objects (stored in a given order) which supports both O(log n) insertion and deletion methods, as well as some way to perform a dichotomic search (where I provide the left-or-right …

---

## [Pairwise computation slower than Python (Cython) code (BallTree very slow!)](https://discourse.julialang.org/t/pairwise-computation-slower-than-python-cython-code-balltree-very-slow/62273)

<div class="topic-metadata">

**Author:** [@florpi](https://discourse.julialang.org/u/florpi)\
**Replies:** 27\
**Last updated:** [June 18, 2021, 3:08pm UTC](https://discourse.julialang.org/t/pairwise-computation-slower-than-python-cython-code-balltree-very-slow/62273 "2021-06-18T15:08:07Z")

</div>

Hi everyone ! I’m new to Julia, and so far have found it very nice and neat. However, my Julia implementation is still slower than the python one I was trying to beat. The goal is to compute the mean radial pairwise vel…

---

## [Iterating over a Tree recursively with Base.iterate](https://discourse.julialang.org/t/iterating-over-a-tree-recursively-with-base-iterate/62512)

<div class="topic-metadata">

**Author:** [@BALLsyman](https://discourse.julialang.org/u/BALLsyman)\
**Replies:** 8\
**Last updated:** [June 9, 2021, 7:42pm UTC](https://discourse.julialang.org/t/iterating-over-a-tree-recursively-with-base-iterate/62512 "2021-06-09T19:42:10Z")

</div>

I want to implement Base.iterate so that it can recursively iterate over a tree - it seems to me that gives the best performance. The type is defined as follows: mutable struct node next::Union{node,Missing} fi…

---

## [How to print a tree "vertically" defined by \`AbstractTrees.jl\`](https://discourse.julialang.org/t/how-to-print-a-tree-vertically-defined-by-abstracttrees-jl/56729)

<div class="topic-metadata">

**Author:** [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Replies:** 2\
**Last updated:** [March 8, 2021, 1:57pm UTC](https://discourse.julialang.org/t/how-to-print-a-tree-vertically-defined-by-abstracttrees-jl/56729 "2021-03-08T13:57:53Z")

</div>

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\> pr…

---

## [Anatomical based tree (help with early conceptual framework)](https://discourse.julialang.org/t/anatomical-based-tree-help-with-early-conceptual-framework/27899)

<div class="topic-metadata">

**Author:** [@Zach\_Christensen](https://discourse.julialang.org/u/Zach_Christensen)\
**Replies:** 2\
**Last updated:** [August 24, 2019, 9:12am UTC](https://discourse.julialang.org/t/anatomical-based-tree-help-with-early-conceptual-framework/27899 "2019-08-24T09:12:15Z")

</div>

Background I work with anatomically relevant data and often do analyses that involve recoding variables manually based on some anatomical structure. Some convenient defaults for referencing these structures by relation a…

---

## [Trees in Julia](https://discourse.julialang.org/t/trees-in-julia/12173)

<div class="topic-metadata">

**Author:** [@microlifecc](https://discourse.julialang.org/u/microlifecc)\
**Replies:** 14\
**Last updated:** [July 15, 2019, 11:59am UTC](https://discourse.julialang.org/t/trees-in-julia/12173 "2019-07-15T11:59:31Z")

</div>

Hi Guys! I am new to Julia and am trying to learn by writing some code. So I was trying to implement a tree and get the sum of node of all the elements in the sub-tree given a particular node. Here is my work: struc…

---

## [How to unroll tree traversal efficiently?](https://discourse.julialang.org/t/how-to-unroll-tree-traversal-efficiently/23994)

<div class="topic-metadata">

**Author:** [@jonalm](https://discourse.julialang.org/u/jonalm)\
**Replies:** 1\
**Last updated:** [May 8, 2019, 1:05pm UTC](https://discourse.julialang.org/t/how-to-unroll-tree-traversal-efficiently/23994 "2019-05-08T13:05:48Z")

</div>

Hi, Consider a number of intervals on the real line (Interval), defined by their endpoints. I want to calculate whether a given point x is inside any of these intervals. I’m actually interested in a more complex case in…

---

## [Recursive Iterators (or some other way to do this)](https://discourse.julialang.org/t/recursive-iterators-or-some-other-way-to-do-this/20216)

<div class="topic-metadata">

**Author:** [@pazzo83](https://discourse.julialang.org/u/pazzo83)\
**Replies:** 2\
**Last updated:** [January 30, 2019, 2:29pm UTC](https://discourse.julialang.org/t/recursive-iterators-or-some-other-way-to-do-this/20216 "2019-01-30T14:29:57Z")

</div>

Hi, I am experimenting with some custom iterators, and I’m wondering why this particular construction does not work as I would think (it returns nothing): struct TreeNodeLeaves{T \<: TreeNode} node::T end function i…

---

## [TreeView package release for visualizing syntax trees](https://discourse.julialang.org/t/treeview-package-release-for-visualizing-syntax-trees/1759)

<div class="topic-metadata">

**Author:** [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Replies:** 18\
**Last updated:** [January 31, 2017, 7:07am UTC](https://discourse.julialang.org/t/treeview-package-release-for-visualizing-syntax-trees/1759 "2017-01-31T07:07:38Z")

</div>

I have just released the first version of the TreeView package, which makes it easy to visualize the syntax tree of a Julia Expression as a graph. It is as simple as typing using TreeView @tree x^2 + y^2 in an IJulia …
