# Data Models: Network Model

Network model is based on graph structure. A network database consists of collection of records, which  are  connected to  each  other  by links.

Record : A record  is a  collection  of attributes,  each contain  only one  data value.

Link : A link is an association between two records.

So, network model is a collection of graphs.

### 1. Graph Structure Diagrams

Graph structure consists of two basic components.

• Rectangular boxes : Rectangular boxes represent various record types.
• Line : Line represents link between two A link cannot contain data value. A graph structure diagram specifies the overall logical structure of  database.

Example. Consider the relation Working-for between Employee and Department.

• First suppose an employee can work only in one department but any department can have more  than  one employee.

Corresponding graph structure diagram is shown in Figure 4.13(a) and sample database in Figure  4.13(b).

• Now suppose an employee can work only in one department as well as every department can have only one employee.

Corresponding graph structure diagram is shown in Figure 4.14(a) and sample database in Figure  4.14(b).

• Now suppose an employee can work in more than one department and any department can have more  than  one employee.

Corresponding graph structure diagram is shown in Figure 4.15(a) and sample database in Figure  4.15(b).

• In case of descriptive attribute, graph structure diagram is more Consider the E-R diagram in  Figure  4.16.

Because a   link   cannot   have   any   value,   so   we   have   to   make   a   new   record for descriptive attribute. Corresponding graph structure diagram is   shown   in Figure 4.17(a)  and  sample database  is  shown  in Figure  4.17(b).

• Consider the case of ternary relationship. Consider three entities Employee, Department and Company  with  no descriptive  attribute.  E-R diagram  is  shown in  Figure  4.18.

Here we make records for each entity and one more record, R-link that is used to connect rest of the records. R-link is an empty record or contains a unique identifier. Graph structure  is  shown  in Figure  4.19.

Corresponding sample database is shown in Figure 4.20.

### 2. Operations on Network Data Model

The basic operations that can be performed on network data model are insertion, deletion, updation and  retrieval. All these  operations are discussed  briefly:

1. Insertion : The insert operation  is used  to insert a  new record  into the database.
2. Deletion : The deletion operation is used to delete a record from the database.
3. Updation : Since the record appears only once in the network model so changes made to any attributes or columns of the record can be performed easily without any inconsistency.
4. Retrieval : The process of searching and fetching of a record in the database is known as retrieval of a Unlike the hierarchical model, the retrieval operation in network data model is symmetric but complex.

3. Query Language for Network Databases

Consider the  example of  Employee-Department  relation schema.

Program Work Area

Program work area is a buffer storage area which contains the following variables.

• Record template : Record template is a record for each record  type ex. Employee record for employee record type, Department record for department record type.
• Currency pointers : It is a set of pointers, one for each database tree which contains the address of most  recently  used record.
• Status flag : It is a variable which represents the result of most recent database operation.

Get and  Find  Commands

Find : Find command  is used to locate  record in database.

Get : Get command is used to copy the record from database to template. Its general form is

• Find any : Its general format is

This command locates a record of type <record type> whose record–field value is same as <record-field>.

Ex.                                          employee.name = “Sam”;

find any employee using name;

get employee;

• Find duplicate : Its general format is

Find any command gives the first record which matches the condition while

Find duplicate gives  any  other record  that  matches the  same  condition.

Update Commands

• Creation of new record : Store command is used to create new records of a specified Its general format is

Ex.                                          employee.name = “Sahil”;

employee.Age = “25”;

employee.Salary= “18000”;

store employee;

• Deletion of a record : Erase command is used to delete any existing Its general format is

Ex.                                          erase department;

• Modify a record : Modify command is used to make changes in any existing Its general format is

Ex.                                          employee.name = “Sam”;

find for update any employee using name;

get employee;

employee.name = “Rupesh”;

modify employee;

To modify any record first we have to find that record.

4.  Implementation of Graph Structure Diagram

To implement graph structure in practical, a pointer field is added to each record. Each record must  have one  pointer field  for each  link  with which  it is  associated.

Consider Figure 4.13(b), the corresponding graph structure diagram is shown in Figure 4.21.

### Advantages of Network Model

The network model is better than the hierarchical model and eliminates some of the limitations of hierarchical  model. The  following are  major advantages of  network model:

1. Eliminate Data Redundancy : In network model, we have only one occurrence for a particular record in the database which can refer to other records using links or pointers. Since there is no multiple occurrence of records so it eliminates data redundancy.
1. Lesser Storage Requirements : Since in this model, a record occurs only once without repetition so lesser storage requirements are there for storing the records in the database.
2. Better Performance : In this model the relationships are defined directly which leads to better performance.
3. Handle Many Types of Relationships : As we know that a large number of different type or relationships like one to one (1 : 1), one to many (1 : N) and many to many (N : N) , exist in the real world situations. These relationships can easily defined in the database  definition  using  network  model.
4. Easy Access of Data : Since records in the network model are linked together through use of pointers so it is very easy to move from one owner record to Also an application can access an owner record and all the member records in the set.
5. Promotes Data Integrity : The network model promotes data integrity because of the required owner-member relationships e., user must first design the owner record and then the  member  record.
6. Enforce Standards : The network model was standardized as CODASYL DBTG Model so all the network database management systems confirm to these The standards include Data Definition Language (DDL) and Data Manipulation Language (DML) which improves the database administration and portability.
7. Data Independence : In network model the structure of the data can be changed without modifying application programs which leads to independence of data but this data independence is partially not fully unlike the hierarchical model where data independence is very low.

### Disadvantages of Network Model

The drawbacks  or disadvantages  of  the Network  model  are as  follows:

1. Complexity : Although the conceptual designing of the network model is simple but the design at the hardware level is very complex because a large number of pointers are required to show the relationship between the owner records and the member This makes this  model  obsolete for  all  the practical  purposes.
2. Difficulty in Querying Data : For querying data in network model the programmer is forced to think in terms of links and how to traverse them to get the needed So proper technical skills are required on part of a programmer.
3. Lack of Structural Independence : Although the network model achieves data independence but it fails to achieve structural independence. Since the various records are linked through pointers, which forms a navigational chain. So making structural changes to the databases is very difficult. If changes are to be made to the database structure then all the application programs using it also need to be modified before accessing the data.

### Commercially Available Network Database Systems

There are number of Database systems based on network model. Some of them are as follows :

1. UNIVAC’s DMS 1100
2. Cullinane’s IDMS
3. Cincom’s TOTAL
4. IBM’s DBOMP
5. Honeywell’s Integrated Data Store (IDS).

Source: Gupta Satinder Bal, Mittal Aditya (2017), Introduction to Database Management System, 2nd Edition-University Science Press (2017)