Tagged Questions

For questions about the data structures known as trees.

learn more… | top users | synonyms

0
votes
2answers
46 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: ...
0
votes
3answers
43 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 ...
18
votes
4answers
629 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) ...
2
votes
3answers
159 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 ...
1
vote
2answers
97 views

getting vertices in order from spanning tree

I've got spanning tree for some weighted graph (edges labeled 1-6) - for example: ...
2
votes
2answers
77 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 ...
2
votes
1answer
63 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 ...
3
votes
1answer
152 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 ...
2
votes
2answers
121 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!
8
votes
1answer
114 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 ...
1
vote
1answer
244 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 ...
4
votes
1answer
124 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 ...
2
votes
1answer
98 views

Explore a nested list

This question is similar to Numbering nested list according with Depth (or Level) I have a list like ...
1
vote
1answer
157 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 ...
4
votes
1answer
351 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 ...
3
votes
1answer
83 views

Some _atomic elements' TreeForm looks confusing with Level in appearance

In[1]:= Level[1/2,{-1}] Out[1]= {1/2} TreeForm[1/2] ...
1
vote
1answer
138 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 ...
3
votes
1answer
161 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: ...
10
votes
3answers
419 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 ...
2
votes
1answer
263 views

Changing some stuff to Kruskal's Algorithm

I'm trying to modify this algorithm: http://demonstrations.wolfram.com/ConnectingTownsUsingKruskalsAlgorithm/ The thing is that I want to receive a Graph (declared outside, with all its vertex, edges ...
24
votes
3answers
2k 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 ...
13
votes
1answer
401 views

Transform an expression into a graph that can be plotted with TreeGraph (not TreeForm)

I would like to plot an expression (like TreeForm does), but using the new TreeGraph functionality. ...
20
votes
3answers
424 views

How can I regroup elements in a list into a tree based on their values?

I have a list of elements in an outline, here is an example that is only 3 levels deep: ...
14
votes
1answer
505 views

Visiting nodes in a tree bottom up

I have a problem that can be reduced to this one: Suppose I have an unbalanced (almost random) tree. The leaves of the tree have one property already set, and all vertex (including the leaves) have ...
4
votes
2answers
255 views

Access pairs of vectors, rather than the matrices, in partitioned data structure at a levelspec

I have some old code to analyze correlation between 2 time series by looking at windows of different lengths shifting across the time series data. The code: gets 2 sets of time series data (in ...
9
votes
4answers
221 views

Leave expression tree formatting the same when a replacement rule is applied

If I type e1 := 3 x + 2 (1 + y) z // TreeForm, I get an expression tree. If I then type e1 /. x -> 3, I get another ...
39
votes
1answer
1k 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 ...
6
votes
2answers
241 views

Truncate TreeForm to show only the top

For some expressions, TreeForm may grow very long. I'm only interested in the top levels of the expression. How can I get the tree form of only the first levels an ...