Index Representation of Trees
A tree structure can readily be represented using indexes. The technique is to store each one-to-many
relationship as an index. These lists are then used to match parents and children.
Using the VENDOR and INVOICE records in Figure H-19, we see that VENDOR AA (in RRN1) owns INVOICEs
110 (RRN7) and 118 (RRN3). Thus, RRN1 is the parent of RRN7 and RRN3. We can represent this
fact with the index in Figure H-24. The list simply associates a parent’s address with the addresses of
each of its children.
If the tree has several 1:N relationships, several indexes will be required—one for each relationship. For
example, for the structure in Figure H-13, five indexes are needed.
How Can We Represent Simple Networks?
As with trees, simple networks can also be represented using linked lists and indexes.
Linked-List Representation of Simple Networks
Consider the simple network shown in Figure H-25. It is a simple network because all of the relationships
are 1:N, and the SHIPMENT records have two parents of different types. Each SHIPMENT has a CUSTOMER
parent and a TRUCK parent. The relationship between CUSTOMER and SHIPMENT is 1:N because
a customer can have several shipments, and the relationship from TRUCK to SHIPMENT is 1:N because