Algorithmic Solutions > LEDA > LEDA Guide > Graphs and Related Data Types > Associate Information with Graphs > Node Arrays

Node Arrays

The data type node_array<E> can be used to associate additional (LEDA or user defined) information of type E with the nodes of a graph.

Example of how to use a node array for a graph

Strengths

  • more efficient access than with Node Maps
  • there can be an arbitrary number of Node Arrays for a graph
  • Node Arrays can be defined at any point in a program

Disadvantages

  • less efficient than Parameterized Graphs
  • only works well for static graphs: A new node will not have a corresponding entry in the Node Array (explicit init() is necessary)
  • cost of declaring a Node Array is proportional to the number of nodes in the graph

Tips

  • Node Arrays are primarily useful for static graphs. They are the most convenient and most widely used way to associate information with nodes of static graphs and for dense arrays, that is, most of nodes need an entry.
  • Using Node Arrays for highly dynamic graphs is quite inconvenient.

See also:

Parameterized Graphs

Node Maps

Two Dimensional Node Arrays


Associate Information with Graphs

Graphs and Related Data Types

Arrays


Manual Entries:

Manual Page Node Arrays

User Defined Parameter Types




Please send any suggestions, comments or questions to leda@algorithmic-solutions.com
© Copyright 2001-2003, Algorithmic Solutions Software GmbH