Skip to main content

Data Structures

Merlin provides several built-in data structure types that you can use to create interactive visualizations. Each data structure has its own set of properties and methods for manipulation.

Available Data Structures

  • Array - Linear sequences of elements with indexing
  • Matrix - Two-dimensional grids of elements
  • Graph - Nodes connected by edges
  • Tree - Hierarchical structures with parent-child relationships
  • Stack - Last-in-first-out (LIFO) data structure
  • LinkedList - Sequentially linked nodes
  • Text - Formatted text blocks with styling options

Common Properties

Most data structures share these common properties:

  • value - The actual data content
  • color - Visual coloring for elements
  • arrow - Arrows or labels pointing to elements
  • above, below, left, right - Labels positioned around the structure

Common Methods

All data structures support these core operations:

  • Set methods - Modify individual elements (e.g., setColor, setValue)
  • Set multiple methods - Modify multiple elements at once (e.g., setColors, setValues)
  • Add/Insert methods - Add new elements (e.g., addValue, insertValue)
  • Remove methods - Remove elements (e.g., removeValue, removeAt)

For a complete list of all available methods, see the Methods Reference.

Next Steps

Choose a data structure type to learn more about its specific properties, methods, and usage examples.