Unit_V__Graphs.pptx - Unit V Graphs Application/System/Case Study Communication networking Road maps(Game path finding system Web graph system Contents

Unit_V__Graphs.pptx - Unit V Graphs Application/System/Case...

This preview shows page 1 - 15 out of 158 pages.

Unit V : Graphs Application/System/Case Study: Communication networking, Road maps (Game path finding system, Web graph system) Contents: Graph: Introduction, types of graph, representation of graphs: adjacency matrix, adjacency list, BFS, DFS & traversal, spanning trees, topological sorting Self study: Warshall’s algorithm Further reading: Page ranking
Image of page 1

Subscribe to view the full document.

Graphs Graph G = ( V , E ) V = set of vertices E = set of edges ( V V ) Types of graphs Undirected: edge ( u , v ) = ( v , u ) ; for all v , ( v , v ) E ( No self loops. ) Directed: ( u , v ) is edge from u to v , denoted as u v . Self loops are allowed. Weighted : each edge has an associated weight , given by a weight function w : E R . 1 2 3 4
Image of page 2
3 Applications Applications that involve not only a set of items, but also the connections between them Computer networks Circuits Schedules Hypertext Maps
Image of page 3

Subscribe to view the full document.

4 Terminology Directed vs Undirected graphs
Image of page 4
5 Terminology (cont’d) Complete graph A graph with an edge between each pair of vertices Subgraph A graph (V , E ) such that V V and E E Path from v to w A sequence of vertices <v 0 , v 1 , , v k > such that v 0 =v and v k =w Length of a path Number of edges in the path 1 2 3 4 path from v 1 to v 4 <v 1 , v 2 , v 4 >
Image of page 5

Subscribe to view the full document.

6 Terminology (cont’d) w is reachable from v If there is a path from v to w Simple path All the vertices in the path are distinct Cycles A path <v 0 , v 1 , , v k > forms a cycle if v 0 =v k and k≥2 Acyclic graph A graph without any cycles 1 2 3 4 cycle from v 1 to v 1 <v 1 , v 2 , v 3 ,v 1 >
Image of page 6
7 Terminology (cont’d) Connected and Strongly Connected
Image of page 7

Subscribe to view the full document.

8 Terminology (cont’d) A tree is a connected, acyclic undirected graph
Image of page 8
Graphs If ( u , v ) E , then vertex v is adjacent to vertex u . Adjacency relationship is : Symmetric if G is undirected. Not necessarily so if G is directed. If G is connected : There is a path between every pair of vertices . | E | | V | – 1. Furthermore, if | E | = | V | – 1, then G is a tree.
Image of page 9

Subscribe to view the full document.

Representation of Graphs Two standard ways . Adjacency Lists. Adjacency Matrix. a d c b a b c d b a d d c c a b a c a d c b 1 2 3 4 1 2 3 4 1 0 1 1 1 2 1 0 1 0 3 1 1 0 1 4 1 0 1 0 Adjacency matrix (Sequential representation) Adjacency list ( linked representation)
Image of page 10
Adjacency Lists Consists of an array Adj of | V | lists. One list per vertex. For u V , Adj [ u ] consists of all vertices adjacent to u . a d c b a b c d b c d d c a d c b a b c d b a d d c c a b a c If weighted, store weights also in adjacency lists.
Image of page 11

Subscribe to view the full document.

Storage Requirement For directed graphs: Sum of lengths of all adj. lists is out-degree( v ) = | E | v V Total storage: ( V + E ) For undirected graphs: Sum of lengths of all adj. lists is degree( v ) = 2| E | v V Total storage: ( V + E ) No. of edges leaving v No. of edges incident on v. Edge ( u , v ) is incident on vertices u and v .
Image of page 12
Operations performed on graph Insertion of vertex Deletion of vertex Insertion of edge Deletion of edge To find particular vertex Traversing the graph
Image of page 13

Subscribe to view the full document.

Graph traversal Depth first search(DFS) Breadth first search(BFS)
Image of page 14
Image of page 15
  • Winter '18
  • Mr M V Joshi

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes