Virus scan in progress. Please wait to download attachments.
In the context of computer programs "Data" is a unit of information. A "Data Structure" is when you organize data for your application. LabVIEW has many native data structures like clusters, queues, and objects. This article is dedicated to talking about building higher and more advanced forms of data structures in LabVIEW. For the 1.0 version we will be providing examples of Linked Lists, Trees, and Graphs in entirely native LabVIEW. LabVIEW Object-Oriented programming (LVOOP) and Data Value References (DVRs) technology was used to implement these examples.
A linked list is a data structure that consists of nodes that are linked sequentially. Linked lists can be visualized as a chain, where each link in the chain is a node. In AdvDataStructures.lvproj (attached below) navigate to the LinkedList virtual folder to see the implementation in LabVIEW. An example of how to use the linked list can be found in ClassBased\Applications\PriorityQueue\PQMain.vi. PQMain.vi demonstrates how to build upon a linked list to make a Priority Queue. Priority Queues are used in applications that need schedulers.
A tree data structure is similar to linked list, except each node has a single parent node, and unlimited child nodes. In AdVDataStructures.lvproj navigate to the Tree virtual folder to see a implementation of a tree in LabVIEW. To see an example of how to solve the travelling salesman problem using a tree data structure open Applications\RouteMinimizing\FindRouteExample.vi.
A graph is a data structure that allows for any number of nodes to link to another node. In the most generic graph definition, there are no restrictions on how nodes are linked. In AdvDataStructures.lvproj navigate to the Graph virtual folder to see graph implementation in LabVIEW. There are two examples of how to use a graph. The first is a shortest path demonstration located in Applications\Occupancy Grid\ShorestPath.vi. The second is a sudoku puzzle solver found in Applications\SudokuSolver\SudokuSolver.vi.
The code provided is meant to be a starting place for developers who would like to solve problems that can benefit from a linked list, tree, or graph example. Below are two versions of the code AdvDataStructures100.zip (LV2009) and AdvancedDataStructures110.zip (LV2010). Both are very similar, but I updated the content in AdvancedDataStructures110.zip for the NI Week Alliance Day 2011. I have included a UML representation of the class hierarchy. Anyone may contribute to the source code. If there are specific problems you would like to see solved email me at email@example.com.
Steps to Implement or Execute Code
Open one of the attached .zip files
Copy the "Advanced Data Structures" folder to your computer
Open relevant code
Requirements to Run
LabVIEW 2010 or Later
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.