Entry
Datastructure: Graph: Presentation: List: Linked: Node: How use a linked list to show connections?
Jan 15th, 2005 11:52
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden --- 15 January 2005 - 07:50 pm --------------------
Datastructure: Graph: Presentation: List: Linked: Node: How use a
linked list to show connections?
---
A graph may be represented by an adjacency matrix (e.g. using a
rectangular array with rows and columns) or a linked list (e.g. using
an array with a fixed amount of rows and a variable amount of columns).
---
Graph: Presentation: LINKED list
---
Create an array, and put the points in the rows.
In the columns of that row, you write to which other
points it is connected via lines.
+------------+--------------------------------
|NODE | CONNECTED TO WHICH OTHER NODES
+------------+--------------------------------
|node 1 | 2, 3
+------------+--------------------------------
|node 2 | 2, 4, 6, 8
+------------+--------------------------------
|node 3 | 5, 7, 9
+------------+--------------------------------
|... |
+------------+--------------------------------
|node last | 1, 7, 9
+------------+--------------------------------
---
---
Note:
To show all nodes, you might use:
For first node to last node
Write the connections of that node
Next node
---
or thus in an array:
For first row to last row
Write the columns of that row
Next row
---
---
Internet: see also:
---
Datastructure: Link: Overview: Can you give an overview of links?
http://www.faqts.com/knowledge_base/view.phtml/aid/32054/fid/1264
----------------------------------------------------------------------