Parameterized Graphs
The data type GRAPH is a parameterized version of the data type
graph . The nodes and edges of a Parameterized
Graph contain additional (user defined) information.
Parameterized Graphs can represent directed and undirected
graphs G=(V,E), where V is the list of nodes and E is the list of directed,
respectively undirected, edges. Nodes and edges are of type item.
Simple example of
how to use a parameterized graph
Strengths
- all operations available for
graph are also defined for
Parameterized Graphs.
- additional operations to access and update information associated
with nodes and edges conveniently
- can be used whereever
graph is possible (assignments,
arguments to functions with formal parameter graph& )
- flexible: Parameterized Graphs work well for dynamic graphs. It is
possible to associate information with new nodes and edges without restriction.
This is not possible for Node Arrays
and Edge Arrays.
- faster than Node Arrays and Edge Arrays
Disadvantages
- Only one piece of information can be associated with each node/edge
of a graph
Tips
- Use Parameterized Graphs if the information to associate with nodes
and edges is an essential part of the graph.
- If you need to associate more than one piece of information with
each node/edge of a graph, consider using one of the related
data types.
- If you know the number of objects you want to associate with a node/edge
beforehand, you can use the special constructor G(int
n_slots,int e_slots) for graphs.
|
See also:
Graphs
How to Associate Information
with graphs
Node Arrays
Edge Arrays
Graphs
and Related Data Types
Graph Algorithms
GraphWin for visualizing graphs
and graph algorithms
Manual Entries:
Page Parameterized Graphs
LEDA
Item Concept
User
Defined Parameter Types
|