Presentation is loading. Please wait.

Presentation is loading. Please wait.

 Graph Graph  Types of Graphs Types of Graphs  Data Structures to Store Graphs Data Structures to Store Graphs  Graph Definitions Graph Definitions.

Similar presentations


Presentation on theme: " Graph Graph  Types of Graphs Types of Graphs  Data Structures to Store Graphs Data Structures to Store Graphs  Graph Definitions Graph Definitions."— Presentation transcript:

1

2  Graph Graph  Types of Graphs Types of Graphs  Data Structures to Store Graphs Data Structures to Store Graphs  Graph Definitions Graph Definitions

3  A graph is a pictorial representation of data.  A graph connects different vertices and provides a flow of data. Back

4 Definition (undirected, unweighted): ◦ A Graph G, consists of ◦ a set of vertices, V ◦ a set of edges, E ◦ where each edge is associated with a pair of vertices.  We write: G = (V, E)

5 Directed Graph: ◦ Same as above, but where each edge is associated with an ordered pair of vertices.

6 Weighted Graph: ◦ Same as above, but where each edge also has an associated real number with it, known as the edge weight. Back

7  Adjacency Matrix Structure ◦ Certain operations are slow using just an adjacency list because one does not have quick access to incident edges of a vertex. ◦ We can add to the Adjacency List structure:  a list of each edge that is incident to a vertex stored at that vertex.  This gives the direct access to incident edges that speeds up many algorithms.

8  Adjacency Matrix ◦ The standard adjacency matrix stores a matrix as a 2-D array with each slot in A[i][j] being a 1 if there is an edge from vertex i to vertex j, or storing a 0 otherwise. 123456 1010010 2101010 3010100 4001011 5110100 6000100 Back

9  A complete undirected unweighted graph ◦ is one where there is an edge connecting all possible pairs of vertices in a graph. The complete graph with n vertices is denoted as K n.  A graph is bipartite ◦ if there exists a way to partition the set of vertices V, in the graph into two sets V 1 and V 2 ◦ where V 1  V 2 = V and V 1  V 2 = , such that each edge in E contains one vertex from V 1 and the other vertex from V 2.

10  Complete bipartite graph ◦ A complete bipartite graph on m and n vertices is denoted by K m,n and consists of m+n vertices, with each of the first m vertices is connected to all of the other n vertices, and no other vertices.

11  A weighted graph ◦ A weighted graph associates a label (weight) with every edge in the graph.  The weight of a path or the weight of a tree in a weighted graph is the sum of the weights of the selected edges.  The function dist(v,w) ◦ The function dist(v, w), where v and w are two vertices in a graph, is defined as the length of the shortest weight path from v to w.  dist(b,e) = 8

12  A subgraph ◦ A graph G'= (V', E') is a subgraph of G = (V, E) if V'  V, E'  E, and for every edge e'  E', if e' is incident on v' and w', then both of these vertices are contained in V'.

13  A simple path ◦ A simple path is one that contains no repeated vertices.  A cycle ◦ A path of non-zero length from and to the same vertex with no repeated edges.  A simple cycle ◦ A cycle with no repeated vertices except for the first and last ones. 6 4 5 1 2 3

14  A path ◦ A path of length n from vertex v 0 to vertex v n is an alternating sequence of n+1 vertices and n edges beginning with vertex v 0 and ending with vertex v n in which edge e i incident upon vertices v i-1 and v i.  (The order in which these are connected matters for a path in a directed graph in the natural way.)  A connected graph ◦ A connected graph is one where any pair of vertices in the graph is connected by at least one path Back

15 THANK YOU Back


Download ppt " Graph Graph  Types of Graphs Types of Graphs  Data Structures to Store Graphs Data Structures to Store Graphs  Graph Definitions Graph Definitions."

Similar presentations


Ads by Google