12
PRESENTATION ABOUT: GRAPH

Graph Basic In Data structure

Embed Size (px)

Citation preview

Page 1: Graph Basic In Data structure

PRESENTATION ABOUT:

GRAPH

Page 2: Graph Basic In Data structure

Contents For Our Presentation...

1. what is Graph,vertices and Edge?2. kinds of Graph.3. Graph Coloring.4. Adjacent Matrix.5. Adjacent List .6. Depth First search.7. Breath First search.

Page 3: Graph Basic In Data structure

WHAT IS GRAPH?

A graph is a pair of (V.E). where 'V ' is a

set of Vertices and 'E' is a set of Edges.

Vertices

Edge

Page 4: Graph Basic In Data structure

kinds of Graph:

Undirected Graph:In an undirected graph, the order of the vertices in the pairs in the Edge set doesn't matter

Directed Graph:In a directed graph the order of the vertices in the pairs in the edge set matters.

Cyclic Graph:A cyclic graph is a directed graph with at least one cycle. A cycle is a path along the directed edges from a vertex to itself. The vertex labeled graph above as several cycles.

Page 5: Graph Basic In Data structure

Directed Acyclic Graph(DAG):

A Dag is a directed graph without cycles.

Proper graph:proper graph is a graph that which has

no cycle and not more than one Edge.

Page 6: Graph Basic In Data structure

Graph Coloring:

Graph coloring is a special case of graph labeling,it is an assignment of labels traditionally called "colors" to elements of a Graph subject to certain constraints. In its simplest form, it is a way of coloring the vertices of a graph such that no two adjacent vertices share the same color; this is called a vertex coloring. Similarly, an edge coloring assigns a color to each edge so that no two adjacent edgesshare the same color, and a face coloring of a planar graph assigns a color to each face or region so that no two faces that share a boundary have the same color.

Page 7: Graph Basic In Data structure

Adjacency Matrix:

Adjacency matrix:A two-dimensional matrix, in which the rows represent source vertices and columns representdestination vertices. Data on edges and vertices

must be stored externally. Only the cost for one edge can be stored between each pair of vertices.

A

D

E

Page 8: Graph Basic In Data structure

Adjacency list:

Vertices are stored as records or objects, and every vertex stores a list of adjacent vertices. This data structure allows the storage of additional data on the vertices. Additional data can be stored if edges are also stored as objects, in which case each vertex stores its incident edges and each edge stores its incident vertices.

For That Example Adjacency list Will be:A->B->E->F->D

A->B->C->DA->C->D

Page 9: Graph Basic In Data structure

There are two types of traversal

1. Dfs(Depth first search) 2.Bfs(Breadth first search)

Page 10: Graph Basic In Data structure

Depth-first search (DFS) : DFS is an algorithm for traversing or searching tree or graph data structures. One starts at the root(selecting some arbitrary node as the root in the case of a graph) and explores as far as possible along each branch before backtracking.

1

0

6Output: 1 0 5 2 3

Page 11: Graph Basic In Data structure

Breadth-first search:(BFS) is an algorithm for traversing or searching tree

or graph data structures. It starts at the tree rootand explores the neighbor nodes first, before moving to the next level neighbours.Compare BFS with the equivalent, but more memory-efficient Interactive deeping depth and contrast with depth-first search and contrast with depth first search.

A

B

c E

F HQueue Status

OUTPUT : A B S C G D E F H G

S

Page 12: Graph Basic In Data structure

Thank you...!!!