Graph data structure, directed graph, undirected graph and weighted graph

Graph (ग्राफ):-
Graph is a non linear data structure. it is combination of vertices and edges. Vertices are also called nodes/points of graph and Edges are direct lines or arcs that connect any two vertices of graph. Every edge is either ordered or unordered pair of two vertices of graph. 
ग्राफ एक नॉन लीनियर डाटा स्ट्रक्चर है जिसे वरटाइस एवं एजेस का समूह कहा जाता है। वरटाइस को नोड/ बिंदु भी कहा जाता है एवं एजेस ग्राफ के किन्ही दो नोड को जोड़ने के लिए खिंची गयी एक प्रत्यक्ष रेखा या चाप होता है।एक एज आर्डरड या अनआर्डरड पेअर हो सकती है।  

In other words, Graph G has following two properties:
दुसरे शब्दों में ग्राफ G में निम्न दो विशेषताए होती है:
1.) Set of vertices (वरटाइस का समूह) V = {v1,v2,.......,vn} 
2.) Set of edges (एजेस का समूह) E ={e1,e2,.......,en}
so,the graph G = {V,E}
अतः ग्राफ G ={V,E}

Let e1= (v1,v2), then e1 is an edge between the starting node v1 and ending node v2 also known as ordered pair and this edge is used in directed graph. If e1= [v1,v2] then e1 is a bidirectional edge between adjacent nodes v1 and v2 also known as unordered pair and this edge is used in undirected graph. 
माना कि e1= (v1,v2), तब e1 प्रारंभिक नोड v1 एवं अंतिम नोड v2 के मध्य एक एज है इसे आर्डरड पेअर कहा जाता है यह एज डायरेक्टेड ग्राफ में प्रयुक्त की जाती है। यदि e1= [v1,v2], तब e1, दो नज़दीकी नोड v1 एवं v2 के मध्य एक द्विदिशीय एज है इसे अनआर्डरड पेअर कहा जाता है यह एज अनडायरेक्टेड ग्राफ में प्रयुक्त की जाती है।  

In following diagram we represent the directed and undirected graph:-
निम्न चित्र में डायरेक्टेड एवं अनडायरेक्टेड ग्राफ को दर्शाया गया है :-








Directed graph (डायरेक्टेड ग्राफ):-

 it is a set of vertices and directed edges which contains ordered pair between two vertices like e₁ = (v₁, v2) is a direct edge present between starting node v1 and ending node v2.

यह वरटाइस एवं डायरेक्टेड एजेस का समूह होता है जो किन्ही दो वरटाइस के मध्य आर्डरड पेअर होती है जैसे   e₁ = (v₁, v2) प्रारंभिक नोड v1 एवं अंतिम नोड v2 के मध्य एक डायरेक्ट एज है 

G1={V,E}

V={v1,v2,v3,v4,v5}

E={e1,e2,e3,e4,e5,e6}

e1=(v1,v2), e2=(v2,v3), e3=(v5,v1), e4=(v4,v5), e5=(v3,v5), e6=(v4,v2).


Undirected graph(अनडायरेक्टेड ग्राफ):- 

It is a set of vertices and set of un-directed(bidirectional) edges which contains an unordered pair between two adjacent vertices like e1=[v1,v2] e1 is an undirected edge between two adjacent nodes v1 and v2. any one among v1 or v2 can be starting node or ending node.

यह वरटाइस एवं अनडायरेक्टेड (द्विदिशीय) एजेस का समूह होता है जो किन्ही दो वरटाइस के मध्य अनआर्डरड पेअर होती है जैसे  e₁ = [v₁, v2] किन्ही दो नज़दीकी नोड v1 एवं v2 के मध्य एक अनडायरेक्ट एज है। v1 या v2 में से कोई भी नोड प्रारंभिक या अंतिम नोड हो सकता है।  


G2={V,E}

V={v1,v2,v3,v4,v5}

E={e1,e2,e3,e4,e5,e6}

e1=[v1,v2], e2=[v2,v3], e3=[v5,v1], e4=[v4,v5], e5=[v3,v5], e6=[v4,v2]


Weighted graph (वेटेड ग्राफ):-

A graph is said to be a weighted graph if it contains edge weights. it means a value (cost) associated with every edge of graph. Generally it is non-negative integer value.

एक ग्राफ वेटेड ग्राफ कहा जाता है यदि उसकी एजेस का वज़न हो अर्थात प्रत्येक एज के साथ एक वैल्यू(कॉस्ट) सम्बंधित हो। सामान्यतः यह एक धनात्मक पूर्णांक संख्या होती है।    


G3={V,E}

V={v1,v2,v3,v4,v5}

E={e1,e2,e3,e4,e5,e6}

Cost (वज़न)

e1=[v1,v2]=4, e2=[v2,v3]=6, 

e3=[v5,v1]=3, e4=[v4,v5]=2, 

e5=[v3,v5]=7, e6=[v4,v2]=9.

No comments:

Post a Comment

Stack Data Structure, Push, Pop and Peek Operations , Applications of Stack

Stack is a linear data structure. It is collection of ordered data elements. It is also known as LIFO system (last in first out). It means i...