What is Graph Data Structure

What is Graph Data Structure


Hello Friends here i will discussed the What is Data Structure ?, Why using Data Structure ? What is Directed Graph ? What is undirected Graph ? so this article read carefully.

A graph can be defined as a set of vertices and edges that are used to connect these vertices. A graph can be viewed as a cyclic tree, where the vertices(Nodes) maintain a parent-child relationship rather than any other complex relationship between them.

 

What is Graph Data Structure


A graph G can be defined as an order set G(V,E) where V(G) represents the set of vertices and E(G) represents the set of edges connecting these vertices. is used for.


Directed and Undirected Graph

A graph can be directed or undirected. However, in an undirected graph, edges are not associated with directions. An undirected graph is shown in the above figure because its edges are not attached in any direction. If an edge exists between vertex A and B, then vertices can traverse B to A as well as from A to B.


In a directed graph, the edges pair up in an order. Edges represent a specific path from one vertex A to another vertex B. Node A is called the initial node while node B is called the terminal node.


Path

A path can be defined as an order of nodes to reach a terminal node V from a starting node U.


Closed path

A path will be said as closed path if the initial node is same as the terminal node. A path will be closed when V0 = VN.


Simple path

If all nodes of the graph are distinct with the exception V 0 = V N, then such a path P is said to be a closed simple path.


Cycle

A cycle can be defined as a path that has no repeated edges or vertices except for the first and last vertices.


Connected Graph

A connected graph is one in which there exists a path between every two vertices (u, v) in V. There are no isolated nodes in a connected graph.


Complete Graph

A complete graph is one in which each node is connected with all other nodes. A complete graph has n(n-1)/2 edges where n is the number of nodes in the graph.


Weighted Graph

In a weighted graph, each edge is assigned with some data such as length or weight. The weight of edge e can be given as w(e).


Digraph

Digraph is a directed graph in which each edge of the graph is associated with some direction and traversing can be done only in the specified direction.


loop

An edge that is joined with the same end points can be called a loop.


Adjacent Nodes

If two nodes u and v are connected by means of an edge e, then nodes u and v are said to be neighbors or adjacent nodes.


Degree of Node

The degree of a node is the number of edges that are associated with that node. A node with degree 0 is called an isolated node.

Previous Post Next Post

Contact Form