Questions on using or implementing more or less common data structures such as linked lists, structs, trees, tries, heaps etc. in Mathematica.

learn more… | top users | synonyms

15
votes
1answer
142 views

Why do lookup times in Dataset and Association differ by orders of magnitude?

Consider the following three data structures: a list of rules, an association, and a dataset: ...
1
vote
1answer
101 views
0
votes
1answer
34 views

Import and export without changing number format

I have a complex file that is the output of a program. The file contains multiple columns with data in different number formats. For example: ...
24
votes
3answers
826 views

Error changing Dataset using Part

bug present as of 10.1.0 bug present as of 10.0.2 In the new guide Computation With Structured Datasets we can find this part, on how to change a Dataset But if we create a ...
3
votes
0answers
61 views

Does Mathematica support an unordered set (e.g. hashset) data structure?

Does Mathematica support any data structure representing an unordered set (without multiplicity) of Mathematica expressions? I would like this data structure to support $O(1)$ insertion, deletion, and ...
2
votes
0answers
43 views

Does Mathematica support out-of-core Associations?

I often find myself collecting data in an Association[] which outgrows my computer's main memory. Does Mathematica support any out-of-core equivalent? Ideally, I ...
2
votes
2answers
153 views

Entropy of the elements of a general data set

I have the following data set, and wish to track the evolution of the entropy of each element within the set. I have evaluated the entropy for some elements, but how does one evaluate the entropy of ...
13
votes
1answer
188 views

Why won't SparseArray let me store values with the head List?

When you attempt to define a SparseArray with elements that have the head List it complains: ...
0
votes
0answers
39 views
21
votes
5answers
650 views

How can a big table be treated as a database?

I often work with big tables that I want to treat kind of like a database. Here's an example table. ...
81
votes
7answers
8k views

Struct equivalent in Mathematica?

I really miss having something like a struct in Mathematica. I know of (and regularly use) a couple of programming techniques which feel like a ...
2
votes
1answer
89 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 ...
4
votes
1answer
95 views

Parsing string with nested information

I am trying to parse a string, but I have no idea how to solve the following problem ...
4
votes
2answers
124 views

How would I programmatically add a row to a Dataset?

I would like to use a Dataset to track the process of a lengthy calculation over a large volume of material. Dataset appeals to me because of the power of the queries and it also looks like it may ...
31
votes
2answers
1k views

How can I add a column into a existing Dataset?

I'm very excited about the brand new Dataset function. I have played with it in Wolfram Cloud, and haven't figured out how can I add a new column into an existing ...
4
votes
1answer
82 views

Filtering Query Nested Data (Dataset and Association)

I am trying to filter a nested Dataset. I have some data that looks like this (curated for this example): ...
8
votes
2answers
421 views

Converting hierarchies of rules to associations

The impossibility of MatchQ-ing inside and Association MatchQ-ing Associations (MMA 10) explains a problem I have. I would like ...
28
votes
2answers
934 views

Can a Trie be implemented efficiently?

What is the most space and time efficient way to implement a Trie in Mathematica? Will it be practically faster than what is natively available in appropriate cases?
48
votes
2answers
10k views

How can I use Mathematica's graph functions to cheat at Boggle?

Boggle is a word game played with 16 dice and a 4x4 tray. This question is inspired by a Stack Overflow question about Boggle that I decided to solve using Mathematica. In addition to Mathematica, I ...
72
votes
3answers
3k views

How to make use of Associations?

I have been curious about it for long. Now that Mathematica 10 arrives, I think it's time to ask the question: How the new Association data structure would be used ...
0
votes
1answer
49 views

Right data format when EmpiricalDistribution expects “Rectangular Array”

I have the following code to generate random data (these are the eigenvalues of a non-central Wishart matrix, and I am interested in their distribution). ...
3
votes
2answers
213 views

Mathematica data structures for analysis [closed]

I'm starting to learn Mathematica and one thing that has been bugging me is the apparent lack of a good structure for keeping data and metadata for analysis. Something along R's ...
0
votes
1answer
94 views

Matrix Operation

I have a $3\times3$ matrix A, and a function sTrans that outputs two $3\times3$ matrices in a list when given a $3\times3$ ...
2
votes
1answer
111 views

Structure of KernelMixtureDistribution and SmoothKernelDistribution

I would like to know more about the structure behind the KernelMixtureDistribution and SmoothKernelDistribution in Mathematica. ...
19
votes
1answer
255 views

Make my data-structure atomic

Lately, and by lately I mean since version 7 or so, the number of atomic expressions in Mathematica constantly grew. In former times only the native types like integers and optimised arrays were ...
3
votes
3answers
168 views

Breaking up combined data into several smaller data sets

I have one combined data with first number as the x-value and the remaining as different y-axis values (y1,y2,y3...). How do I break this combined list, data= (x,y1,y2,y3...) into smaller lists, such ...
8
votes
0answers
285 views

Learning Resources for Data Science in the Wolfram Language

I'm delivering an upcoming course on Data Science with the programming/analysis done predominantly in the Wolfram Language. I created the following table to leverage students' familiarity with Lists ...
3
votes
1answer
236 views

how to create Dataset after importing txt file

I would like to translate a imported txt file to Dataset. ...
6
votes
1answer
150 views

Return struct from function (with DownValues)

In Mathematica there is a way to create struct-like data type: struct[myField]=value I want to return myStruct from a function: ...
0
votes
4answers
136 views

Using levels in MapIndexed

I am trying to use MapIndexed to manipulate a matrix of data but I am having trouble getting the levels parameter to work the way I would like. Suppose that my data ...
1
vote
0answers
110 views

What's a non-trivial Mathematica program involving conscious choice of stack vs. queue data structure?

In a typical computer science algorithms course, much attention is given to the discussion of queues vs. stacks as a data structure programmers need to consciously choose from to achieve algorithmic ...
1
vote
0answers
65 views

Data structures sought for storing particular list information

I have a set of lists. These lists contain two dimensional coordinates of natural numbers. So a list can be ...
1
vote
1answer
65 views

DownValues Type Access and Timing

I definitely use so much DownValues structure for some many applications like to replace some common structures in a some way. It seems that DownValues is so fast for access, and set. My question is ...
2
votes
2answers
114 views
4
votes
2answers
564 views

What is the Mathematica way of joining two tables?

Is there a special Mathematica way of joining tables of data together, so that I would get similar functionality as if I was running a database with sql? For example, I have one particular table ...
2
votes
2answers
632 views

Get positions of all non zero matrix elements

I want to find all non zero elements of a table and I want to create a list that contains the name of the table the element was removed from, the position of the element, and the value of the element. ...
2
votes
1answer
619 views

Interpolation: Unstructured grid error

If I try to make a table SimpleTable and to interpolate a function of two variables, I encounter a problem. For example: ...
2
votes
3answers
325 views

Re-arranging / selecting of a data table very slow in For loop [duplicate]

My task is quite simple; I have a table of data like M = {{1,2}, {1,3}, {3,4}, {5,1}, {6,9}, {6,8}, {6,1}}; so the table is sorted with respect to the first ...
3
votes
1answer
130 views

Reading many single files and creating numbered (? or indexed) variable

I tried many different approaches, but I could not solve the following problems, I appreciate your help: What is the best way to read many data files? I mean we have ...
2
votes
0answers
64 views

Autoupdate Section Numbers? - Technical Document Authoring with Mathematica

Technical document authoring systems are structured ways to create, manage, and update documentation for various mediums such as print, pdf, web, etc. Take a look at this technical document ported to ...
12
votes
3answers
3k views

Excel Headers --> Mathematica

I have a large Excel .xls file. Miniature version shown below: (formatting should appear as two columns...) ...
5
votes
1answer
175 views

What is the fastest way to maintain a large set of expressions?

In my algorithm I need to maintain a set (an unordered list of distinct elements) of expressions supporting two operations: Test an expression for membership in the set Adding a new expression to ...
8
votes
1answer
311 views

Is it possible to construct a function to make a poor man's Mathematica database?

I have a function that is set up to write to a database with 10-20 standard variables with 10 fields each, but the application is going to a place where database access is not available. Can ...
11
votes
3answers
3k views

Implementing a dictionary data structure

As one learns from a course on data structures, hash maps or dictionaries can be efficient when applied to appropriate tasks. I need a hash map in Mathematica and I've never found it. I'm scratching ...
26
votes
4answers
2k views

How to create strong types?

In a program I'm writing, I create a list of lists, that looks something like this: {{100, {1,2,3,4,5}}, {105, {2,4,6,8}}, {42, {42,39,56}}} I then pass this ...
2
votes
1answer
114 views

Distances of locations in the matrix form

I want to have the distances of the cities in the matrix form.How can I have it for example for the cities like followings that also includes the distance of the city from itself which is zero: ...
16
votes
2answers
549 views

Efficient priority queues?

I'm trying to figure out how to transfer the concept of a priority queue to the functional world. Searches have turned up some implementations that use Append and other expense list copying ...
1
vote
0answers
70 views

Efficiently generating 3D histograms for large sets 2D coordinates [duplicate]

I'm attempting to generate a 3D histogram for a large set of two-dimensional coordinates ($\approx 10^7$). the x- and y-components of each coordinate are rounded to the nearest integer, and these ...