Data Structures(Operation on Graphs in Data structures)

 

Operations on Graphs in Data Structures:

The operations you perform on the graphs in data structures are listed below:

  • Creating graphs
  • Insert vertex
  • Delete vertex
  • Insert edge 
  • Delete edge

You will go over each operation in detail one by one:

Creating Graphs

There are two techniques to make a graph:

1. Adjacency Matrix

The adjacency matrix of a simple labeled graph, also known as the connection matrix, is a matrix with rows and columns labeled by graph vertices and a 1 or 0 in position depending on whether they are adjacent or not.

2. Adjacency List

A finite graph is represented by an adjacency list, which is a collection of unordered lists. Each unordered list describes the set of neighbors of a particular vertex in the graph within an adjacency list.

Insert Vertex

When you add a vertex that after introducing one or more vertices or nodes, the graph's size grows by one, increasing the matrix's size by one at the row and column levels.

add-vertex-operation-on-graph-in-data-structure

Delete Vertex

  • Deleting a vertex refers to removing a specific node or vertex from a graph that has been saved.
  • If a removed node appears in the graph, the matrix returns that node. If a deleted node does not appear in the graph, the matrix returns the node not available.

delete-vertex-operation-on-graph-in-data-structure

Insert Edge

Connecting two provided vertices can be used to add an edge to a graph.

add-edge-operation-on-graph-in-data-structure

Delete Edge

The connection between the vertices or nodes can be removed to delete an edge.

delete-edge-operation-on-graph-in-data-structure

Comments

Popular posts from this blog

PHP Array Functions

String Functions in C Language(C Language)

Object Instance Working with Strings