Top 5 Graph Data Structure Question and Answers

A graph is a fundamental concept in Data Structure and algorithms. In this article, some basic concept related to Graph is covered.  

 

Q1.Explain the Basic Concept Of Graph.

Graphs are compelling and versatile data structures that easily represent real-life relationships between different data types.

There are two main parts of graphs-

The vertices (nodes) where the data is stored.

The edge (connections) connect the nodes.

 

Q2.Define the term Graph and explain terminologies of graph

The graph is a collection of sets of vertices V where the actual data is stored and edges E which connects those vertices.

Terminologies of Graph-

Node- Every individual element in a graph in a graph is known as Vertex. Vertex is also called a Node.

Arc (Edge) - An Edge is a connecting link between two vertices. Edge is also called Arc.

Directed Edge - The edge which has specific directions is called directed edges.

 

Undirected Graph - The graph in which the edge does not show any direction is called Undirected Graph.

 

Directed Graph - The graph in which all the edges have a specific direction is called a directed graph.  

 

Degree - Total number of edges connected to a vertex is the degree of the vertex.

Adjacent - If there is an edge between A and B, both A and B are adjacent.

Successor - A vertex coming after a given vertex in a directed path is called a successor.

Relation - Relation is a set of ordered pairs.

 

Weight - A numerical value assigned as a label to a vertex or edge of a graph is weight.

Length - The length of the path is the total number of edges includes.

 

Q3.What do you mean by adjacency matrix?

This is a simple way to represent a graph; the 2D array is used for this representation.

An Adjacency Matrix Graph is represented using a matrix of size total number of vertices by a total number of vertices.

That means if a graph has 5 vertices, then a matrix of 5*5 will be used. In this method, rows and columns both represent vertices.

 

Q4.Which are the basic traversal techniques of the Graph?

Graph traversal refers to the process of visiting each vertex in a graph at least once. There is the various reason for which we may have to traverse a graph:

1. Finding all reachable nodes.

2. Finding the best reachable.

3. Finding the best path through a graph.

4. Topologically sorting a graph.

 

Graph traversal is classified by the order in which the vertices are visited. There are two most frequently used graph traversal methods - 

1. Depth First Search

2. Breadth-First Search

 

Q5.What are the applications of Graph?

  1. In computer science, graphs represent networks of communications, data organization, and computational devices.
  2. Graph theory is also used to study molecules in chemistry and physics.
  3. In mathematics, graphs are useful in geometry.
  4. Graph algorithms are useful for calculating the shortest path of routing.
  5. Weighted graphs are used to represent structures in which pairwise connections have some numerical values. Ex- Raod network.

 

So here are some basic questions which would be helpful to understand the concept of Graphs in Data Structure and Algorithms.

To know more basic concepts about graphs, you can visit these websites tutorialspoint/graph javatpoint. Comes-graph geeks for geeks-Graph.

Enjoyed this article? Stay informed by joining our newsletter!

Comments

You must be logged in to post a comment.

About Author