Posts

Showing posts from November 12, 2017

Graph Data Strucutre

Image
Graph is a pictorial representation of the set of the object which is connected with the link. The individual object in graph is represented as Vertices, and the connecting links called Edges. The representation of the graph in mathematical terms G{V, E}, where V is a set of vertices and E is the set of edges.   Pictorial representation of Graph Here, V={A,B,C} is set of vertices and E={AB,BC,CA} is a set of edges. A graphs are of two types as given below: Directed Graph Un-directed Graph Weighted Graph (a) Un-directed Graph, (b) Directed Graph (c) Weighted Graph The two most common representation of the Graph are: Adjacency Matrix Adjacency List Adjacency Matrix of the Graph is a product of  VxV, where V is the set of the vertices. To create the adjacency matrix, the common edge between the vertices are called adjacent vertices. For adjacent vertices we assign 1 and for non-adjacent vertices assign 0.  Adjacency Matrix