# Tagged Questions

For questions about the data structures known as trees.

279 views

### How to construct a tree from a notebook?

Given the notebook itself we can think of it as a tree graph: the root vertex is the empty notebook itself, the headers of cell groups are vertices, and all other cells as leaf vertices. I'd like to ...
128 views

### TreeForm outputs different results for the same inputs but why?

First of all, please look at the below inputs and outputs: ...
52 views

### How do I create a recursive tree plot for the Fibonacci sequence?

I would like to create a plot that shows the recursive tree for the nth number of the fibonacci sequence, as the one below. http://faculty.ycp.edu/~dhovemey/fall2005/cs102/lecture/fib5.png Ideally, ...
39 views

### Minimal Spanning Tree with EdgeWeights

Given a graph with EdgeWeights, I'm finding the minimal spanning tree: ...
51 views

### KaryTree of Text .csv and Correlation

How can I make a KaryTree of this raw-data (raw-data at the end of the question): This is is data from a political survey in which I ask 5 questions with the following possible answers: Q1: 'Y'= ...
207 views

### Using different colors in TreeForm?

I've used TreeForm, and I appreciate that the syntax is fairly short, especially in comparison with TreeGraph. Is it possible ...
108 views

### VertexDelete Problem

I am doing a straightforward deletion of a set of vertices in a Tree using Mathematica. ...
46 views

### how to use a tree as a key to construct a table of key values

I have an interesting problem that I was able to summarize in the form of trees, sets, and key value pairs. I have the following sets of keys and values \begin{aligned} k_0 &= [A]...
110 views

### Conditional tree vertex rendering?

I use the following code to plot a binary tree ...
115 views

### Plot tree edges of a tree-form list

I'm trying to plot a tree from a tree-form list. The nodes should be connected from left to right (as usual). My range values are ...
85 views

### Merge two trees into a rectangular matrix in Mathematica

How can I merge two trees, t and s, so as to form a square matrix below, where both trees starts from top-left (as shown), and ...
272 views

### Extract left-upper triangular data from a square matrix-form list

Hopefully, this question is not too basic or obscure. I'd like an idea on how to extract this {{1}, {5, 2}, {9, 6, 3}, {13, 10, 7, 4}} from ...
53 views

### How to transform a tree-form list to matrix-form list in Mathematica? [closed]

Excuse my naive question. Is there a quick/efficient way to transform {{1}, {1, 2}, {1, 2, 3}, {1, 2, 3, 4}} to a lower-triangular matrix-form ...
58 views

### Visualizing site map using a Tree

I've been trying to visualize a sitemap for analysis purposes. So far, using Leonid Shifrin's makeTreeRojo function, I've been able to build a somehow decent visualization. First, I fetch and format ...
445 views

### Creating Identification/Classification trees

I have data given in following format; from which I need to create identification/classification trees (three different trees from three different criterion, that is average disorder, gain ratio and ...
2k views

### How to construct a treemap using non-rectangles?

I've written the standard version of a tree map (a graphic that shows nested data) and I'm looking to improve on this layout by switching to different types of polygons or perhaps circles. Can anyone ...
62 views

### Why does the Derivative function not appear in the tree form? [closed]

I was learning that set delay doesn't evaluate things until its calling time. Hence, I thought that something like the followng: dfdt := D[f[t],t] would not ...
90 views

### Tree graph showing the orbits under the Collatz map?

ReverseCollatzPaths is a nice demonstration of a radial tree graph showing the orbits under the Collatz map. However, Jason Davies gives, I think, a nicer visulalization using Python, with a ...
105 views

### Some _atomic elements' TreeForm looks confusing with Level in appearance

In[1]:= Level[1/2,{-1}] Out[1]= {1/2} TreeForm[1/2] ...
94 views

### Multi-named Vertices (or Overlapping Vertices) in TreePlot/LayeredGraphPlot, or Merging Trees

If there is a series of rules from which a TreePlot/LayeredGraphPlot is made: ...
86 views

### Why does TreePlot ignore the vertex labels in a TreeGraph argument?

Example (watch the vertex labels): aTree = TreeGraph[{"a" -> "b", "a" -> "c"}, VertexLabels -> "Name"] ...
100 views

### Extracting subtree for a TreeForm

How can I extract an entire subtree from a TreeForm starting from a specific point of the tree? Because with Extract or Part you can take only that specific point...
230 views

### How to set the Y coordinates for a Graph with defined X coordinates to prevent overlap of nodes?

I would like to draw a Graph with defined $x$ coordinates and variable node sizes. If I simply replace the $x$ coordinates of a graph, then nodes can overlap and ...
180 views

### How to create a recursive TreeGraph

How could I create a recursive tree graph, such as one defined by the following: A family of trees $T_n$ are defined recursively as follows, for all integers $n \ge 1$. The tree $T_1$ consists of a ...
85 views

### Is there a way to combine VertexLabeling->True and VertexLabels/Tooltip in TreePlot?

Basically, I'm trying to make Mathematica give me a tree with names inside the rectangles like so: ...while also having the properties of VertexLabels or Tooltip, which lets me place my mouse over ...
153 views

### ordered tree data structure

I have a map $f:X\to \mathbb{N}$ and I wish to find $x,x'\in X$ such that $f(x)=f(x')$. Since such elements are rare, I will have to check very many elements and perform many comparisons, so I suspect ...
68 views

### AdjacencyList of DirectedEdges in Graph ignore edge direction

I have a simple tree graph with directed edges: In: AdjacencyList[Graph[{a -> b, a -> c, b -> d, b -> e}], b] Out: {a, d, e} I wonder how I can ...
127 views

### TreePlot remove an arrow

Is it possible to make Mathematica make a connection to p2 from both SysVar 2 and SysVar3 like I drawn ? Code: ...
127 views

### how to move the root from a tree?

I have the code : ...
117 views

### Is it possible to mark a Tree node and path to it?

I have the Tree : ...
5k views

### How to generate a random tree?

Is it possible to generate a random tree without explicitly constructing a random adjacency matrix that satisfies tree properties? How about a random directed tree? Edit: incredible answer by ...
543 views

### Visualizing directories

How do I plot the content of a directory and all its subdirectories into infinity using TreeForm? I've tried using a mix of ...
176 views

### TreePlot Vertex Labelling

I have plot: TreePlot[{1 -> 4, 1 -> 6, 1 -> 8, 2 -> 6, 3 -> 8, 4 -> 5, 7 -> 8}, VertexLabeling -> True] Can the labeling on the second level be done as 8, 6 ,4 while keeping the command vertex ...
892 views

### Drawing the schematic diagram of algorithm

The B-Spline function used the alogrithm as shown below: I would like to draw it in Mathematica (Although this is my first time to use TreePlot) ...
289 views

### Graph showing valid English words obtained by insertion of single characters

I'd like the most efficient Mathematica code for making a formal tree graph whose nodes are valid English word strings (in DictionaryLookup[ ]) and directed links represent the relation 'insertion of ...
252 views

### How to generate a random binary tree with a given number of vertices and with a given shape, namely compact or elongated

I tried to generate a random binary tree with a Table of RandomInteger and to give a shape with a ...
186 views

### getting vertices in order from spanning tree

I've got spanning tree for some weighted graph (edges labeled 1-6) - for example: ...
92 views

### Adding a tree to a list of trees within a loop [duplicate]

I'm trying to write a function which for a list of trees checks if a given tree is isomorphic with any of the listed, and if not - adds it to the list. I tried to use both ...
108 views

### TreeForm expression that will automatically spread nodes vertically so labels do not overlap

My deeply and unevenly nested lists and equations generate a TreeForm image which is too small and compressed to use. Then we must expand it manually by grabbing the edge of the image, and sometimes ...
177 views

### Create a Figure with a sequence of Balanced Binary Trees

I would like make the attached image by Mathematica. someone who could help me? Thank!
240 views

### CSS Selectors for Symbolic XML

Symbolic XML is a convenient way of managing XML in Mathematica, at least for casual use or small tasks. Here and elsewhere you can find examples of XML handling in Mathematica, including XSLT/XPath ...
1k views

### How to make Huffman coding by using tree representation

I want to make Huffman coding with Mathematica. I saw a demonstration, but it is not the thing I want to make. I want to show the tree for given string. Here is an example picture: You can see the ...
155 views

### Generate expressions equivalent to rooted trees

I would like to know how to generate all rooted trees on $n$ vertices using Mathematica? More precisely, I am interested in generating algebraic expressions equivalent to rooted trees and constructed ...
152 views

### Explore a nested list

This question is similar to Numbering nested list according with Depth (or Level) I have a list like ...
246 views

### TreeForm display with nested lists as nodes

If i have a nested list representing nodes in a binary tree, {3, {2, {1, None, None}, None}, None}, what is the easiest way to show the hierarchy, without all the ...
573 views

### Extracting text from nested HTML lists <ul> <li>

We wish to analyze the tree structure of HTML documents that consist of nested lists, ie, using the HTML tags <ul> and ...
196 views

### Table/Tree of values

My question: Is there a way to create a tree of values? Something like the output of the command TreeForm, but with values in the nodes? Why do I want this? I'm trying to do a complete program to ...
192 views

### How to make a simple tree yourself with defined distances for each generation?

I'm trying to make a function that generates a tree for spin spin analysis in spectroscopy. I though it would be pretty easy, but I'm totally stocked. The tree should look something like this: ...