Representation of a Graph ?


Representation of a  graph is the way of storing data values in  memory location as graph data structure. There are two types  of graph representation techniques.

1. Adjacency matrix representation.

2. Adjacency list representation

Adjacency Matrix Representation :

According to this representation graph is stored using arrays in memory. This representation uses two types of arrays for storing data in memory.

    1.    An 1 – D array of size ‘n’ for storing all vertices in a graph . Here ‘n’ is the no. of vertices in  a graph.

    2.    Use 2 – D array of size(n,m) for storing information about edges b/w vertices . In this 2 – D array we have to enter either zero or one. If there is an edge between two vertices then one is placed in corresponding cell otherwise zero is placed.


graph reprasentation














10 :V
V ={ 10 , 20, 30, 40, 50}
T={(10, 20),(10, 30),(10, 50),(50 , 40),(20 , 50),(30 , 40),(50 , 30),(40 , 20)}

Adjacency list representation :

In this representation the vertices of the graph are represented as linked lists of nodes with one of the vertex as the starting vertex. Each vertex again has a different linked list connecting to some other vertices which are having this vertices. In first list of vertices , every node contains two links. In second list of edges every node contains one link this is explained by the following.

graphreprasentation2



Related

What is Spanning Tree?

Spanning tree: A spanning tree for an undirected graph G is a graph consisting of all the nodes of ‘G’ together with enough edges from G such that 1.There is a path b/w each pair of nodes i...

What is Binary Tree and Representation of Binary Tree?

Binary Tree: A binary tree is also a tree which is either empty or non empty . If it is non empty it should satisfy the following properties. 1. one of the element is identified as root. ...

Graph Traversals?

Graph traversals : v   Traversing a graph is visiting all nodes exactly once in the graph. v  

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item