The Network model replaces the hierarchical tree with a graph thus allowing more general connections among the nodes. The main difference of the network model from the hierarchical model, is its ability to handle many to many (N:N) relations. In other words, it allows a record to have more than one parent. Suppose an employee works for two departments. The strict hierarchical arrangement is not possible here and the tree becomes a more generalized graph – a network. The network model was evolved to specifically handle non-hierarchical relationships. As shown below data can belong to more than one parent. Note that there are lateral connections as well as top-down connections. A network structure thus allows 1:1 (one: one), l: M (one: many), M: M (many: many) relationships among entities.
In network database terminology, a relationship is a set. Each set is made up of at least two types of records: an owner record (equivalent to parent in the hierarchical model) and a member record (similar to the child record in the hierarchical model).
The database of Customer-Loan, which we discussed earlier for hierarchical model, is now represented for Network model as shown.
In can easily depict that now the information about the joint loan L1 appears single time, but in case of hierarchical model it appears for two times. Thus, it reduces the redundancy and is better as compared to hierarchical model.
We’ll be covering the following topics in this tutorial:
Network view of Sample Database
Considering again the sample supplier-part database, its network view is shown. In addition to the part and supplier record types, a third record type is introduced which we will call as the connector. A connector occurrence specifies the association (shipment) between one supplier and one part. It contains data (quantity of the parts supplied) describing the association between supplier and part records.
All connector occurrences for a given supplier are placed on a chain .The chain starts from a supplier and finally returns to the supplier. Similarly, all connector occurrences for a given part are placed on a chain starting from the part and finally returning to the same part.
Operations on Network Model
Detailed description of all basic operations in Network Model is as under:
Insert Operation: To insert a new record containing the details of a new supplier, we simply create a new record occurrence. Initially, there will be no connector. The new supplier’s chain will simply consist of a single pointer starting from the supplier to itself.
For example, supplier S4 can be inserted in network model that does not supply any part as a new record occurrence with a single pointer from S4 to itself. This is not possible in case of hierarchical model. Similarly a new part can be inserted who does not supplied by any supplier.
Consider another case if supplier S 1 now starts supplying P3 part with quantity 100, then a new connector containing the 100 as supplied quantity is added in to the model and the pointer of S1 and P3 are modified as shown in the below.
We can summarize that there is no insert anomalies in network model as in hierarchical model.
Update Operation: Unlike hierarchical model, where updation was carried out by search and had many inconsistency problems, in a network model updating a record is a much easier process. We can change the city of S I from Qadian to Jalandhar without search or inconsistency problems because the city for S1 appears at just one place in the network model. Similarly, same operation is performed to change the any attribute of part.
Delete operation: If we wish to delete the information of any part say PI, then that record occurrence can be deleted by removing the corresponding pointers and connectors, without affecting the supplier who supplies that part i.e. P1, the model is modified as shown. Similarly, same operation is performed to delete the information of supplier.
In order to delete the shipment information, the connector for that shipment and its corresponding pointers are removed without affecting supplier and part information.
For example, if supplier SI stops the supply of part PI with 250 quantity the model is modified as shown below without affecting P1 and S1 information.
Retrieval Operation: Record retrieval methods for network model are symmetric but complex. In order to understand this considers the following example queries:
Query 1. Find supplier number for suppliers who supply part P2.
Solution: In order to retrieve the required information, first we search for the required part i.e. P2 we will get only one occurrence of P2 from the entire database, Then a loop is constructed to visit each connector under this part i.e. P2. Then for each connector we check the supplier over that connector and supplier number for the concerned supplier record occurrence is printed as shown in below algorithm.
Algorithm:
get [next] part where PNO=P2; do until no more connectors under this part; get next connector under this part; get supplier over this connector; print SNO;Query 2. Find part number for parts supplied by supplier S2.
Solution: In order to retrieve the required information, same procedure is adopted. First we search for the required supplier i.e. S2 and we will get only one occurrence of S2 from the entire database. Then a loop is constructed to visit each connector under this supplier i.e. S2. Then for each connector we check the part over that connector and part number for the concerned part record occurrence is printed as shown in below algorithm.
Algorithm :
get [next] supplier where SNO=S2; do until no more connectors under this supplier; get next connector under this supplier; get part over this connector; print PNO; end;From both the above algorithms, we can conclude that retrieval algorithms are symmetric, but they are complex because they involved lot of pointers.
Conclusion: As explained earlier, we can conclude that network model does not suffers from the Insert anomalies, Update anomalies and Deletion anomalies, also the retrieve operation is symmetric, as compared to hierarchical model, but the main disadvantage is the complexity of the model. Since, each above operation involves the modification of pointers, which makes whole model complicated and complex.
Advantages and Disadvantages of Network Model
The Network model retains almost all the advantages of the hierarchical model while eliminating some of its shortcomings.
The main advantages of the network model are:
Conceptual simplicity: Just like the hierarchical model, the network model IS also conceptually simple and easy to design.
Capability to handle more relationship types: The network model can handle the one to- many (l:N) and many to many (N:N) relationships, which is a real help in modeling the real life situations.
Ease of data access: The data access is easier and flexible than the hierarchical model.
Data Integrity: The network model does not allow a member to exist without an owner. Thus, a user must first define the owner record and then the member record. This ensures the data integrity.
Data independence: The network model is better than the hierarchical model in isolating the programs from the complex physical storage details.
Database Standards: One of the major drawbacks of the hierarchical model was the non-availability of universal standards for database design and modeling. The network model is based on the standards formulated by the DBTG and augmented by ANSI/SP ARC (American National Standards Institute/Standards Planning and Requirements Committee) in the 1970s. All the network database management systems conformed to these standards. These standards included a Data Definition Language (DDL) and the Data Manipulation Language (DML), thus greatly enhancing database administration and portability.
Disadvantages of Network Model
Even though the network database model was significantly better than the hierarchical database model, it also had many drawbacks. Some of them are:
System complexity: All the records are maintained using pointers and hence the whole database structure becomes very complex.
Operational Anomalies: As discussed earlier, network model’s insertion, deletion and updating operations of any record require large number of pointer adjustments, which makes its implementation very complex and complicated.
Absence of structural independence: Since the data access method in the network database model is a navigational system, making structural changes to the database is very difficult in most cases and impossible in some cases. If changes are made to the database structure then all the application programs need to be modified before they can access data. Thus, even though the network database model succeeds in achieving data independence, it still fails to achieve structural independence.
Because of the disadvantages mentioned and the implementation and administration complexities, the relational database model replaced both the hierarchical and network database models in the 1980s. The evolution of the relational database model is considered as one of the greatest events-a major breakthrough in the history of database management.