Graph Algorithms. Parallel and Distributed Computing. Department of Computer Science and Engineering (DEI) Instituto Superior Técnico.
|
|
- Chrystal Holt
- 6 years ago
- Views:
Transcription
1 Graph Algorithms Parallel and Distributed Computing Department of Computer Science and Engineering (DEI) Instituto Superior Técnico May, 0 CPD (DEI / IST) Parallel and Distributed Computing /
2 Outline Problems Described on Graphs Graph Representations Parallel Graph Algorithms Connected Components Maximal Independent Set Breath First Search CPD (DEI / IST) Parallel and Distributed Computing /
3 Graph Definition Graph G = (V, E) V is a finite set of vertices (or nodes) E is a finite set of edges (or lines) Directed graph: (u, v) E, incident from vertex u to vertex v Weighted graph: value (cost) w assigned to each (u, v) E Path from a vertex u to v: sequence <v 0, v, v,..., v k > of vertices, v 0 = u, v k = v, and (v i, v i+ ) E path length: number of edges in a path, or sum of weights of the edges CPD (DEI / IST) Parallel and Distributed Computing /
4 Sample Application Areas of Graphs AREA VERTICES EDGES Communication telephones, computers fiber optic cable Circuits gates, registers, processors wires Mechanical joints rods, beams, springs Hydraulic reservoirs, pumping stations pipelines Financial stocks, currency transactions Transportation street intersections, airports highways, air routes Scheduling tasks precedence constraints Software systems functions function calls Internet web pages hyperlinks Games board positions legal moves Social networks people, actors, terrorists friendships, movie casts, etc Protein interaction networks proteins protein-protein interactions Genetic regulatory networks genes regulatory interactions Neural networks neurons synapses Infectious disease people infections Electrical power grid transmission stations cable Chemical compounds molecules chemical bonds CPD (DEI / IST) Parallel and Distributed Computing /
5 Graph Representation Adjacency Matrix ( E V ) Adjacency List ( E V ) CPD (DEI / IST) Parallel and Distributed Computing /
6 Distributed Graph Representation each processor stores the entire graph CPD (DEI / IST) Parallel and Distributed Computing /
7 Distributed Graph Representation each processor stores the entire graph each processor stores n p vertices (and all edges out of these vertices) CPD (DEI / IST) Parallel and Distributed Computing /
8 Distributed Graph Representation each processor stores the entire graph each processor stores n p vertices (and all edges out of these vertices) How to create these p vertex partitions? CPD (DEI / IST) Parallel and Distributed Computing /
9 Distributed Graph Representation each processor stores the entire graph each processor stores n p vertices (and all edges out of these vertices) How to create these p vertex partitions? graph partitioning algorithms: recursively optimize while minimizing edges crossing partitions balance vertices or edges inside partitions? CPD (DEI / IST) Parallel and Distributed Computing /
10 D Graph Partioning consider a logical D processor grid (p = p r p c ) and the matrix representation of the graph assign each processor a sub-matrix (edges within the sub-matrix) Example: consider the previous graph, and p = : CPD (DEI / IST) Parallel and Distributed Computing /
11 Sample Graph Algorithms Searches (breadth-first, depth-first, A*) Single-source shortest paths (Dijkstra, Bellman-Ford, DAG) All-pairs shortest paths (Johnson, Floyd-Warshall) Minimum spanning tree (Kruskal, Prim) Components (connected, strongly connected, biconnected) Maximum cardinality matching Max-flow (Edmonds-Karp, push-relabel) Sparse matrix ordering (Cuthill-McKee, King, Sloan, minimum degree) Layout (Kamada-Kawai, Fruchterman-Reingold, Gursoy-Atun) Betweenness centrality PageRank Isomorphism Vertex coloring Transitive closure Dominator tree CPD (DEI / IST) Parallel and Distributed Computing /
12 All-pairs Shortest Path Floyd-Warshall Algorithm:. for k 0 to V. for i 0 to V. for j 0 to V. d[i, j] min(d[i, j], d[i, k] + d[k, j]) Complexity: Θ( V ) CPD (DEI / IST) Parallel and Distributed Computing /
13 Graph Algorithms Irregular and unbalanced Non-local Data driven High data to computation ratio CPD (DEI / IST) Parallel and Distributed Computing /
14 Connected Components Connected Components Equivalence classes of vertices under the is reachable from relation for undirected graphs. Serial algorithm: perform depth-first search (DFS) on a graph. Number of trees in the forest = separate connected component. CPD (DEI / IST) Parallel and Distributed Computing /
15 Parallel Connected Components CPD (DEI / IST) Parallel and Distributed Computing /
16 Parallel Connected Components Processor Processor CPD (DEI / IST) Parallel and Distributed Computing /
17 Parallel Connected Components Each process computes DFS to obtain a forest of trees for its subgraph. Processor Processor Merge forests of trees to form the final solution. CPD (DEI / IST) Parallel and Distributed Computing /
18 Parallel Connected Components Merge pairs of spanning forests using disjoint sets of vertices. Consider the following operations on the disjoint sets: find(x) returns pointer to representative element of the set containing x each set has its own unique representative union(x, y) merges the sets containing the elements x and y the sets are assumed disjoint prior to the operation A simple linked list, with clever heuristics (ranking and path compression) provides a very efficient implementation for these operations. CPD (DEI / IST) Parallel and Distributed Computing /
19 Parallel Connected Components To merge forest A into forest B: for each edge (u,v) of A, perform find operations on u and v to determine if u and v are in same tree of B: if not, then union the two trees (sets) of B containing u and v else, no union operation is necessary Merging forest A and forest B requires at most: ( V ) find operations ( V ) union operations These operations can be performed in time Θ( V ). CPD (DEI / IST) Parallel and Distributed Computing /
20 Analysis of Parallel Connected Components Partition the V V adjacency matrix into p blocks V Each processor computes local spanning forest: Θ( p ) Merging approach: use a tree of processes. log p merging stages each merge stage takes time Θ( V ) total cost due to merging is Θ( V log p) During each merging stage, spanning forests are sent between nearest neighbors: Θ( V ) edges of the spanning forest are transmitted Parallel execution time: Θ( V p ) + Θ( V log p) (the corresponding scalability function is p log p...) CPD (DEI / IST) Parallel and Distributed Computing /
21 Maximal Independent Sets Independent Vertices A set of vertices I V is called independent if no pair of vertices in I is connected via an edge in G. Maximal Independent Sets (MIS) An independent set is called maximal if by including any other vertex not in I, the independence property is violated. CPD (DEI / IST) Parallel and Distributed Computing /
22 Serial Algorithms for MIS Practical MIS algorithms are incremental in nature. Start with an empty set. Add the vertex with the smallest degree. Remove node and adjacent vertices from graph. While graph not empty, Goto. CPD (DEI / IST) Parallel and Distributed Computing /
23 Serial Algorithms for MIS Practical MIS algorithms are incremental in nature. Start with an empty set. Add the vertex with the smallest degree. Remove node and adjacent vertices from graph. While graph not empty, Goto. CPD (DEI / IST) Parallel and Distributed Computing /
24 Serial Algorithms for MIS Practical MIS algorithms are incremental in nature. Start with an empty set. Add the vertex with the smallest degree. Remove node and adjacent vertices from graph. While graph not empty, Goto. CPD (DEI / IST) Parallel and Distributed Computing /
25 Serial Algorithms for MIS Practical MIS algorithms are incremental in nature. Start with an empty set. Add the vertex with the smallest degree. Remove node and adjacent vertices from graph. While graph not empty, Goto. CPD (DEI / IST) Parallel and Distributed Computing /
26 Serial Algorithms for MIS Practical MIS algorithms are incremental in nature. Start with an empty set. Add the vertex with the smallest degree. Remove node and adjacent vertices from graph. While graph not empty, Goto. CPD (DEI / IST) Parallel and Distributed Computing /
27 Serial Algorithms for MIS Practical MIS algorithms are incremental in nature. Start with an empty set. Add the vertex with the smallest degree. Remove node and adjacent vertices from graph. While graph not empty, Goto. These algorithms are intrinsically serial! CPD (DEI / IST) Parallel and Distributed Computing /
28 Luby s MIS Algorithm Randomized algorithm. Start with an empty set. Assign a random number to each vertex. Vertices whose random number are smaller than all of the numbers assigned to their adjacent vertices are included in the MIS. Vertices adjacent to the newly inserted vertices are removed. While graph not empty, Goto. CPD (DEI / IST) Parallel and Distributed Computing /
29 Luby s MIS Algorithm Randomized algorithm. Start with an empty set. Assign a random number to each vertex. Vertices whose random number are smaller than all of the numbers assigned to their adjacent vertices are included in the MIS. Vertices adjacent to the newly inserted vertices are removed. While graph not empty, Goto. CPD (DEI / IST) Parallel and Distributed Computing /
30 Luby s MIS Algorithm Randomized algorithm. Start with an empty set. Assign a random number to each vertex. Vertices whose random number are smaller than all of the numbers assigned to their adjacent vertices are included in the MIS. Vertices adjacent to the newly inserted vertices are removed. While graph not empty, Goto. CPD (DEI / IST) Parallel and Distributed Computing /
31 Luby s MIS Algorithm Randomized algorithm. Start with an empty set. Assign a random number to each vertex. Vertices whose random number are smaller than all of the numbers assigned to their adjacent vertices are included in the MIS. Vertices adjacent to the newly inserted vertices are removed. While graph not empty, Goto. CPD (DEI / IST) Parallel and Distributed Computing /
32 Luby s MIS Algorithm Randomized algorithm. Start with an empty set. Assign a random number to each vertex. Vertices whose random number are smaller than all of the numbers assigned to their adjacent vertices are included in the MIS. Vertices adjacent to the newly inserted vertices are removed. While graph not empty, Goto. This algorithm will terminate in O(log V ) iterations. Why is this a good algorithm to parallelize? CPD (DEI / IST) Parallel and Distributed Computing /
33 Luby s MIS Algorithm Randomized algorithm. Start with an empty set. Assign a random number to each vertex. Vertices whose random number are smaller than all of the numbers assigned to their adjacent vertices are included in the MIS. Vertices adjacent to the newly inserted vertices are removed. While graph not empty, Goto. This algorithm will terminate in O(log V ) iterations. Why is this a good algorithm to parallelize? How will the parallel formulation proceed? shared memory distributed memory CPD (DEI / IST) Parallel and Distributed Computing /
34 Breath First Search Breath-first Search Graph traversal algorithm that is performed by starting at the source node and visit nodes in order of distance from the source. for each vertex v in V-{s} color[v]=white; d[v]=oo; p[v]=nil; color[s]=gray; d[s]=0; p[s]=nil; enqueue(q, s); while Q not empty u = gettopqueue(q); for each v adjacent to u if(color[v] == WHITE) color[v] = GREY; d[v] = d[u] + ; p[v] = u; enqueue(q, v); color[u] = BLACK; CPD (DEI / IST) Parallel and Distributed Computing /
35 Breath First Search Breath-first Search Graph traversal algorithm that is performed by starting at the source node and visit nodes in order of distance from the source. for each vertex v in V-{s} color[v]=white; d[v]=oo; p[v]=nil; color[s]=gray; d[s]=0; p[s]=nil; enqueue(q, s); while Q not empty u = gettopqueue(q); for each v adjacent to u if(color[v] == WHITE) color[v] = GREY; d[v] = d[u] + ; p[v] = u; enqueue(q, v); color[u] = BLACK; d=0 p=nil d= p= d= p= d= p= d= p= d= p= d= p= CPD (DEI / IST) Parallel and Distributed Computing /
36 Breath First Search Parallel BFS? for each vertex v in V-{s} color[v]=white; d[v]=oo; p[v]=nil; color[s]=gray; d[s]=0; p[s]=nil; enqueue(q, s); while Q not empty u = gettopqueue(q); for each v adjacent to u if(color[v] == WHITE) color[v] = GREY; d[v] = d[u] + ; p[v] = u; enqueue(q, v); color[u] = BLACK; CPD (DEI / IST) Parallel and Distributed Computing /
37 Breath First Search Parallel BFS? for each vertex v in V-{s} color[v]=white; d[v]=oo; p[v]=nil; color[s]=gray; d[s]=0; p[s]=nil; enqueue(q, s); while Q not empty u = gettopqueue(q); for each v adjacent to u if(color[v] == WHITE) color[v] = GREY; d[v] = d[u] + ; p[v] = u; enqueue(q, v); color[u] = BLACK; Primite task: enumerate out-edges of a vertex. Distributed adjacency list Problems: shared global queue vertex coloring CPD (DEI / IST) Parallel and Distributed Computing /
38 Distributed Queue Fundamental operations: gettopqueue: retrieves from top of queue enqueue: add to end of queue empty: signals termination CPD (DEI / IST) Parallel and Distributed Computing /
39 Distributed Queue Fundamental operations: gettopqueue: retrieves from top of queue enqueue: add to end of queue empty: signals termination Distributed queue: each node stores a local queue. gettopqueue: always from local queue enqueue: local if owner, otherwise sends to owner empty: wait for remote sends CPD (DEI / IST) Parallel and Distributed Computing /
40 Vertex Coloring Store data on the node that owns the vertex (or edge). Two alternatives: send message request color of a remote node CPD (DEI / IST) Parallel and Distributed Computing /
41 Vertex Coloring Store data on the node that owns the vertex (or edge). Two alternatives: send message request color of a remote node send message if color of remote node is locally changed CPD (DEI / IST) Parallel and Distributed Computing /
42 Vertex Coloring Store data on the node that owns the vertex (or edge). Two alternatives: send message request color of a remote node send message if color of remote node is locally changed Or: keep local copies of adjacent nodes CPD (DEI / IST) Parallel and Distributed Computing /
43 Vertex Coloring Store data on the node that owns the vertex (or edge). Two alternatives: send message request color of a remote node send message if color of remote node is locally changed Or: keep local copies of adjacent nodes broadcast message if color of a node (any node) is changed CPD (DEI / IST) Parallel and Distributed Computing /
44 Vertex Coloring Store data on the node that owns the vertex (or edge). Two alternatives: send message request color of a remote node send message if color of remote node is locally changed Or: keep local copies of adjacent nodes broadcast message if color of a node (any node) is changed Some problems may require arbitration when the data of a node is changed. CPD (DEI / IST) Parallel and Distributed Computing /
45 Review Problems Described on Graphs Graph Representations Parallel Graph Algorithms Connected Components Maximal Independent Set Breath First Search CPD (DEI / IST) Parallel and Distributed Computing /
46 Next Class parallel sorting CPD (DEI / IST) Parallel and Distributed Computing /
Introduction to Parallel & Distributed Computing Parallel Graph Algorithms
Introduction to Parallel & Distributed Computing Parallel Graph Algorithms Lecture 16, Spring 2014 Instructor: 罗国杰 gluo@pku.edu.cn In This Lecture Parallel formulations of some important and fundamental
More informationCS 4407 Algorithms Lecture 5: Graphs an Introduction
CS 4407 Algorithms Lecture 5: Graphs an Introduction Prof. Gregory Provan Department of Computer Science University College Cork 1 Outline Motivation Importance of graphs for algorithm design applications
More informationLecture 4: Graph Algorithms
Lecture 4: Graph Algorithms Definitions Undirected graph: G =(V, E) V finite set of vertices, E finite set of edges any edge e = (u,v) is an unordered pair Directed graph: edges are ordered pairs If e
More informationTutorial. Question There are no forward edges. 4. For each back edge u, v, we have 0 d[v] d[u].
Tutorial Question 1 A depth-first forest classifies the edges of a graph into tree, back, forward, and cross edges. A breadth-first tree can also be used to classify the edges reachable from the source
More informationOutlines: Graphs Part-2
Elementary Graph Algorithms PART-2 1 Outlines: Graphs Part-2 Graph Search Methods Breadth-First Search (BFS): BFS Algorithm BFS Example BFS Time Complexity Output of BFS: Shortest Path Breath-First Tree
More informationUNDIRECTED GRAPHS BBM 201 DATA STRUCTURES DEPT. OF COMPUTER ENGINEERING
Acknowledgement: he course slides are adapted from the slides prepared by R. Sedgewick and K. Wayne of Princeton Uniersity. BBM DAA SRUCURES DEP. O COMPUER ENGINEERING UNDIRECED GRAPHS Undirected Graphs
More informationGraph Algorithms. Definition
Graph Algorithms Many problems in CS can be modeled as graph problems. Algorithms for solving graph problems are fundamental to the field of algorithm design. Definition A graph G = (V, E) consists of
More informationBasic Graph Algorithms
Basic Graph Algorithms 1 Representations of Graphs There are two standard ways to represent a graph G(V, E) where V is the set of vertices and E is the set of edges. adjacency list representation adjacency
More informationLecture 6 Basic Graph Algorithms
CS 491 CAP Intro to Competitive Algorithmic Programming Lecture 6 Basic Graph Algorithms Uttam Thakore University of Illinois at Urbana-Champaign September 30, 2015 Updates ICPC Regionals teams will be
More informationGraph Theory. Many problems are mapped to graphs. Problems. traffic VLSI circuits social network communication networks web pages relationship
Graph Graph Usage I want to visit all the known famous places starting from Seoul ending in Seoul Knowledge: distances, costs Find the optimal(distance or cost) path Graph Theory Many problems are mapped
More informationComputer Science & Engineering 423/823 Design and Analysis of Algorithms
s of s Computer Science & Engineering 423/823 Design and Analysis of Lecture 03 (Chapter 22) Stephen Scott (Adapted from Vinodchandran N. Variyam) 1 / 29 s of s s are abstract data types that are applicable
More information3. GRAPHS. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley Copyright 2013 Kevin Wayne. Last updated on Sep 8, :19 AM
3. GRAPHS basic definitions and applications graph connectivity and graph traversal testing bipartiteness connectivity in directed graphs DAGs and topological ordering Lecture slides by Kevin Wayne Copyright
More informationGraphs. Graph G = (V, E) Types of graphs E = O( V 2 ) V = set of vertices E = set of edges (V V)
Graph Algorithms 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
More informationGraph: representation and traversal
Graph: representation and traversal CISC4080, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang! Acknowledgement The set of slides have use materials from the following resources Slides for textbook
More informationLecture 10. Elementary Graph Algorithm Minimum Spanning Trees
Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to Algorithms, 3rd Edition, MIT Press, 2009 Sungkyunkwan University Hyunseung Choo
More informationBasic Graph Algorithms (CLRS B.4-B.5, )
Basic Graph Algorithms (CLRS B.-B.,.-.) Basic Graph Definitions A graph G = (V,E) consists of a finite set of vertices V and a finite set of edges E. Directed graphs: E is a set of ordered pairs of vertices
More informationRepresentations of Graphs
ELEMENTARY GRAPH ALGORITHMS -- CS-5321 Presentation -- I am Nishit Kapadia Representations of Graphs There are two standard ways: A collection of adjacency lists - they provide a compact way to represent
More informationOutline. Graphs. Divide and Conquer.
GRAPHS COMP 321 McGill University These slides are mainly compiled from the following resources. - Professor Jaehyun Park slides CS 97SI - Top-coder tutorials. - Programming Challenges books. Outline Graphs.
More informationParallel Graph Algorithms
Parallel Graph Algorithms Design and Analysis of Parallel Algorithms 5DV050 Spring 202 Part I Introduction Overview Graphsdenitions, properties, representation Minimal spanning tree Prim's algorithm Shortest
More informationGraph Algorithms. Andreas Klappenecker
Graph Algorithms Andreas Klappenecker Graphs A graph is a set of vertices that are pairwise connected by edges. We distinguish between directed and undirected graphs. Why are we interested in graphs? Graphs
More informationGraph representation
Graph Algorithms 1 Graph representation Given graph G = (V, E). May be either directed or undirected. Two common ways to represent for algorithms: 1. Adjacency lists. 2. Adjacency matrix. When expressing
More informationCS 220: Discrete Structures and their Applications. graphs zybooks chapter 10
CS 220: Discrete Structures and their Applications graphs zybooks chapter 10 directed graphs A collection of vertices and directed edges What can this represent? undirected graphs A collection of vertices
More informationSample Solutions to Homework #4
National Taiwan University Handout #25 Department of Electrical Engineering January 02, 207 Algorithms, Fall 206 TA: Zhi-Wen Lin and Yen-Chun Liu Sample Solutions to Homework #4. (0) (a) Both of the answers
More informationIndex. stack-based, 400 A* algorithm, 325
Index Abstract transitive closure, 174-175, 217-221 Active vertex, 411 Acyclic graph. See Digraph; Directed acyclic graph (DAG) Acyclic network, 313-321, 334-335 maxflow, 427-429 Adjacency-lists representation,
More informationCS6301 Programming and Data Structures II Unit -5 REPRESENTATION OF GRAPHS Graph and its representations Graph is a data structure that consists of following two components: 1. A finite set of vertices
More informationElementary Graph Algorithms
Elementary Graph Algorithms 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)
More informationPart VI Graph algorithms. Chapter 22 Elementary Graph Algorithms Chapter 23 Minimum Spanning Trees Chapter 24 Single-source Shortest Paths
Part VI Graph algorithms Chapter 22 Elementary Graph Algorithms Chapter 23 Minimum Spanning Trees Chapter 24 Single-source Shortest Paths 1 Chapter 22 Elementary Graph Algorithms Representations of graphs
More informationAlgorithm Design (8) Graph Algorithms 1/2
Graph Algorithm Design (8) Graph Algorithms / Graph:, : A finite set of vertices (or nodes) : A finite set of edges (or arcs or branches) each of which connect two vertices Takashi Chikayama School of
More informationGraph Representation
Graph Representation Adjacency list representation of G = (V, E) An array of V lists, one for each vertex in V Each list Adj[u] contains all the vertices v such that there is an edge between u and v Adj[u]
More informationCS 341: Algorithms. Douglas R. Stinson. David R. Cheriton School of Computer Science University of Waterloo. February 26, 2019
CS 341: Algorithms Douglas R. Stinson David R. Cheriton School of Computer Science University of Waterloo February 26, 2019 D.R. Stinson (SCS) CS 341 February 26, 2019 1 / 296 1 Course Information 2 Introduction
More informationIntroduction to Algorithms. Lecture 11
Introduction to Algorithms Lecture 11 Last Time Optimization Problems Greedy Algorithms Graph Representation & Algorithms Minimum Spanning Tree Prim s Algorithm Kruskal s Algorithm 2 Today s Topics Shortest
More informationUndirected Graphs. DSA - lecture 6 - T.U.Cluj-Napoca - M. Joldos 1
Undirected Graphs Terminology. Free Trees. Representations. Minimum Spanning Trees (algorithms: Prim, Kruskal). Graph Traversals (dfs, bfs). Articulation points & Biconnected Components. Graph Matching
More informationDHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI. Department of Computer Science and Engineering CS6301 PROGRAMMING DATA STRUCTURES II
DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI Department of Computer Science and Engineering CS6301 PROGRAMMING DATA STRUCTURES II Anna University 2 & 16 Mark Questions & Answers Year / Semester: II / III
More informationGraph Search. Adnan Aziz
Graph Search Adnan Aziz Based on CLRS, Ch 22. Recall encountered graphs several weeks ago (CLRS B.4) restricted our attention to definitions, terminology, properties Now we ll see how to perform basic
More informationParallel Graph Algorithms
Parallel Graph Algorithms Design and Analysis of Parallel Algorithms 5DV050/VT3 Part I Introduction Overview Graphs definitions & representations Minimal Spanning Tree (MST) Prim s algorithm Single Source
More informationKonigsberg Bridge Problem
Graphs Konigsberg Bridge Problem c C d g A Kneiphof e D a B b f c A C d e g D a b f B Euler s Graph Degree of a vertex: the number of edges incident to it Euler showed that there is a walk starting at
More informationChapter 14. Graphs Pearson Addison-Wesley. All rights reserved 14 A-1
Chapter 14 Graphs 2011 Pearson Addison-Wesley. All rights reserved 14 A-1 Terminology G = {V, E} A graph G consists of two sets A set V of vertices, or nodes A set E of edges A subgraph Consists of a subset
More information3.1 Basic Definitions and Applications
Graphs hapter hapter Graphs. Basic efinitions and Applications Graph. G = (V, ) n V = nodes. n = edges between pairs of nodes. n aptures pairwise relationship between objects: Undirected graph represents
More informationChapter 9 Graph Algorithms
Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 3 Definitions an undirected graph G = (V, E)
More informationComputer Science & Engineering 423/823 Design and Analysis of Algorithms
Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 04 Elementary Graph Algorithms (Chapter 22) Stephen Scott (Adapted from Vinodchandran N. Variyam) sscott@cse.unl.edu Introduction
More information11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions
Introduction Chapter 9 Graph Algorithms graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 2 Definitions an undirected graph G = (V, E) is
More information! Interesting and broadly useful abstraction. ! Challenging branch of computer science and discrete math. ! Hundreds of graph algorithms known.
Undirected Graphs Undirected Graphs Graph. Set of objects with pairwise connections. Why study graph algorithms?! Interesting and broadly useful abstraction.! Challenging branch of computer science and
More informationTrees and Graphs Shabsi Walfish NYU - Fundamental Algorithms Summer 2006
Trees and Graphs Basic Definitions Tree: Any connected, acyclic graph G = (V,E) E = V -1 n-ary Tree: Tree s/t all vertices of degree n+1 A root has degree n Binary Search Tree: A binary tree such that
More informationCOP 4531 Complexity & Analysis of Data Structures & Algorithms
COP Complexity & Analysis of Data Structures & Algorithms Overview of Graphs Breadth irst Search, and Depth irst Search hanks to several people who contributed to these slides including Piyush Kumar and
More informationHomework Assignment #3 Graph
CISC 4080 Computer Algorithms Spring, 2019 Homework Assignment #3 Graph Some of the problems are adapted from problems in the book Introduction to Algorithms by Cormen, Leiserson and Rivest, and some are
More informationReview: Graph Theory and Representation
Review: Graph Theory and Representation Graph Algorithms Graphs and Theorems about Graphs Graph implementation Graph Algorithms Shortest paths Minimum spanning tree What can graphs model? Cost of wiring
More informationTaking Stock. Last Time Flows. This Time Review! 1 Characterize the structure of an optimal solution
Taking Stock IE170: Algorithms in Systems Engineering: Lecture 26 Jeff Linderoth Last Time Department of Industrial and Systems Engineering Lehigh University April 2, 2007 This Time Review! Jeff Linderoth
More informationDesign and Analysis of Algorithms
Design and Analysis of Algorithms CSE 5311 Lecture 18 Graph Algorithm Junzhou Huang, Ph.D. Department of Computer Science and Engineering CSE5311 Design and Analysis of Algorithms 1 Graphs Graph G = (V,
More informationElementary Graph Algorithms. Ref: Chapter 22 of the text by Cormen et al. Representing a graph:
Elementary Graph Algorithms Ref: Chapter 22 of the text by Cormen et al. Representing a graph: Graph G(V, E): V set of nodes (vertices); E set of edges. Notation: n = V and m = E. (Vertices are numbered
More informationCS521 \ Notes for the Final Exam
CS521 \ Notes for final exam 1 Ariel Stolerman Asymptotic Notations: CS521 \ Notes for the Final Exam Notation Definition Limit Big-O ( ) Small-o ( ) Big- ( ) Small- ( ) Big- ( ) Notes: ( ) ( ) ( ) ( )
More informationChapter 22 Elementary Graph Algorithms
Chapter 22 Elementary Graph Algorithms Graph Representations Graph G = (V,E) Directed Undirected Adjacency Lists Adjacency Matrix Graph Representations Adjacency List: Undirected Memory: Adjacency: Graph
More informationGreedy Approach: Intro
Greedy Approach: Intro Applies to optimization problems only Problem solving consists of a series of actions/steps Each action must be 1. Feasible 2. Locally optimal 3. Irrevocable Motivation: If always
More informationChapter 22. Elementary Graph Algorithms
Graph Algorithms - Spring 2011 Set 7. Lecturer: Huilan Chang Reference: (1) Cormen, Leiserson, Rivest, and Stein, Introduction to Algorithms, 2nd Edition, The MIT Press. (2) Lecture notes from C. Y. Chen
More informationUNIT Name the different ways of representing a graph? a.adjacencymatrix b. Adjacency list
UNIT-4 Graph: Terminology, Representation, Traversals Applications - spanning trees, shortest path and Transitive closure, Topological sort. Sets: Representation - Operations on sets Applications. 1. Name
More informationGraph Algorithms. Chapter 22. CPTR 430 Algorithms Graph Algorithms 1
Graph Algorithms Chapter 22 CPTR 430 Algorithms Graph Algorithms Why Study Graph Algorithms? Mathematical graphs seem to be relatively specialized and abstract Why spend so much time and effort on algorithms
More informationComputer Science & Engineering 423/823 Design and Analysis of Algorithms
s of s Computer Science & Engineering 423/823 Design and Analysis of Lecture 03 (Chapter 22) Stephen Scott (Adapted from Vinodchandran N. Variyam) 1 / 29 Spring 2010 s of s s are abstract data types that
More informationMinimum Spanning Trees Ch 23 Traversing graphs
Next: Graph Algorithms Graphs Ch 22 Graph representations adjacency list adjacency matrix Minimum Spanning Trees Ch 23 Traversing graphs Breadth-First Search Depth-First Search 11/30/17 CSE 3101 1 Graphs
More informationCSI 604 Elementary Graph Algorithms
CSI 604 Elementary Graph Algorithms Ref: Chapter 22 of the text by Cormen et al. (Second edition) 1 / 25 Graphs: Basic Definitions Undirected Graph G(V, E): V is set of nodes (or vertices) and E is the
More informationMinimum Spanning Trees
Minimum Spanning Trees Problem A town has a set of houses and a set of roads. A road connects 2 and only 2 houses. A road connecting houses u and v has a repair cost w(u, v). Goal: Repair enough (and no
More informationGraph Traversal CSCI Algorithms I. Andrew Rosenberg
Graph Traversal CSCI 700 - Algorithms I Andrew Rosenberg Last Time Introduced Graphs Today Traversing a Graph A shortest path algorithm Example Graph We will use this graph as an example throughout today
More informationGraph implementations :
Graphs Graph implementations : The two standard ways of representing a graph G = (V, E) are adjacency-matrices and collections of adjacencylists. The adjacency-lists are ideal for sparse trees those where
More informationW4231: Analysis of Algorithms
W4231: Analysis of Algorithms 10/21/1999 Definitions for graphs Breadth First Search and Depth First Search Topological Sort. Graphs AgraphG is given by a set of vertices V and a set of edges E. Normally
More informationcsci 210: Data Structures Graph Traversals
csci 210: Data Structures Graph Traversals Graph traversal (BFS and DFS) G can be undirected or directed We think about coloring each vertex WHITE before we start GRAY after we visit a vertex but before
More informationGraphs. CSE 2320 Algorithms and Data Structures Alexandra Stefan and Vassilis Athitsos University of Texas at Arlington
Graphs CSE 2320 Algorithms and Data Structures Alexandra Stefan and Vassilis Athitsos University of Texas at Arlington 1 Representation Adjacency matrix??adjacency lists?? Review Graphs (from CSE 2315)
More informationMultiple Choice. Write your answer to the LEFT of each problem. 3 points each
CSE 0-00 Test Spring 0 Name Last 4 Digits of Student ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. Suppose f ( x) is a monotonically increasing function. Which of the
More informationCS200: Graphs. Prichard Ch. 14 Rosen Ch. 10. CS200 - Graphs 1
CS200: Graphs Prichard Ch. 14 Rosen Ch. 10 CS200 - Graphs 1 Graphs A collection of nodes and edges What can this represent? n A computer network n Abstraction of a map n Social network CS200 - Graphs 2
More informationCS200: Graphs. Rosen Ch , 9.6, Walls and Mirrors Ch. 14
CS200: Graphs Rosen Ch. 9.1-9.4, 9.6, 10.4-10.5 Walls and Mirrors Ch. 14 Trees as Graphs Tree: an undirected connected graph that has no cycles. A B C D E F G H I J K L M N O P Rooted Trees A rooted tree
More informationGraph: representation and traversal
Graph: representation and traversal CISC5835, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang Acknowledgement The set of slides have use materials from the following resources Slides for textbook
More informationCHAPTER 13 GRAPH ALGORITHMS
CHAPTER 13 GRAPH ALGORITHMS SFO LAX ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA AND MOUNT (WILEY 00) AND SLIDES FROM NANCY
More informationUNIT 5 GRAPH. Application of Graph Structure in real world:- Graph Terminologies:
UNIT 5 CSE 103 - Unit V- Graph GRAPH Graph is another important non-linear data structure. In tree Structure, there is a hierarchical relationship between, parent and children that is one-to-many relationship.
More informationGraph Representations and Traversal
COMPSCI 330: Design and Analysis of Algorithms 02/08/2017-02/20/2017 Graph Representations and Traversal Lecturer: Debmalya Panigrahi Scribe: Tianqi Song, Fred Zhang, Tianyu Wang 1 Overview This lecture
More informationCSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms. Lecturer: Shi Li
CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms Lecturer: Shi Li Department of Computer Science and Engineering University at Buffalo Main Goal of Algorithm Design Design fast
More informationUnit 2: Algorithmic Graph Theory
Unit 2: Algorithmic Graph Theory Course contents: Introduction to graph theory Basic graph algorithms Reading Chapter 3 Reference: Cormen, Leiserson, and Rivest, Introduction to Algorithms, 2 nd Ed., McGraw
More informationCS4800: Algorithms & Data Jonathan Ullman
CS4800: Algorithms & Data Jonathan Ullman Lecture 11: Graphs Graph Traversals: BFS Feb 16, 2018 What s Next What s Next Graph Algorithms: Graphs: Key Definitions, Properties, Representations Exploring
More informationIntroduction to Algorithms Third Edition
Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Clifford Stein Introduction to Algorithms Third Edition The MIT Press Cambridge, Massachusetts London, England Preface xiü I Foundations Introduction
More informationThe ADT priority queue Orders its items by a priority value The first item removed is the one having the highest priority value
The ADT priority queue Orders its items by a priority value The first item removed is the one having the highest priority value 1 Possible implementations Sorted linear implementations o Appropriate if
More informationGRAPHICAL ALGORITHMS. UNIT _II Lecture-12 Slides No. 3-7 Lecture Slides No Lecture Slides No
GRAPHICAL ALGORITHMS UNIT _II Lecture-12 Slides No. 3-7 Lecture-13-16 Slides No. 8-26 Lecture-17-19 Slides No. 27-42 Topics Covered Graphs & Trees ( Some Basic Terminologies) Spanning Trees (BFS & DFS)
More informationGraph. Vertex. edge. Directed Graph. Undirected Graph
Module : Graphs Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS E-mail: natarajan.meghanathan@jsums.edu Graph Graph is a data structure that is a collection
More informationBasic Graph Definitions
CMSC 341 Graphs Basic Graph Definitions A graph G = (V,E) consists of a finite set of vertices, V, and a finite set of edges, E. Each edge is a pair (v,w) where v, w V. V and E are sets, so each vertex
More informationChapter 9 Graph Algorithms
Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be if not careful with data structures 3 Definitions an undirected graph G = (V, E) is a
More informationEnd-Term Examination Second Semester [MCA] MAY-JUNE 2006
(Please write your Roll No. immediately) Roll No. Paper Code: MCA-102 End-Term Examination Second Semester [MCA] MAY-JUNE 2006 Subject: Data Structure Time: 3 Hours Maximum Marks: 60 Note: Question 1.
More informationR13. II B. Tech I Semester Supplementary Examinations, May/June DATA STRUCTURES (Com. to ECE, CSE, EIE, IT, ECC)
SET - 1 II B. Tech I Semester Supplementary Examinations, May/June - 2016 PART A 1. a) Write a procedure for the Tower of Hanoi problem? b) What you mean by enqueue and dequeue operations in a queue? c)
More informationCS Elementary Graph Algorithms
CS43-09 Elementary Graph Algorithms Outline Representation of Graphs Instructor: Fei Li Room 443 ST II Office hours: Tue. & Thur. 1:30pm - 2:30pm or by appointments lifei@cs.gmu.edu with subject: CS43
More informationCS Elementary Graph Algorithms
CS483-09 Elementary Graph Algorithms Instructor: Fei Li Room 443 ST II Office hours: Tue. & Thur. 1:30pm - 2:30pm or by appointments lifei@cs.gmu.edu with subject: CS483 http://www.cs.gmu.edu/ lifei/teaching/cs483_fall07/
More informationCSE 100: GRAPH ALGORITHMS
CSE 100: GRAPH ALGORITHMS Dijkstra s Algorithm: Questions Initialize the graph: Give all vertices a dist of INFINITY, set all done flags to false Start at s; give s dist = 0 and set prev field to -1 Enqueue
More informationReference Sheet for CO142.2 Discrete Mathematics II
Reference Sheet for CO14. Discrete Mathematics II Spring 017 1 Graphs Defintions 1. Graph: set of N nodes and A arcs such that each a A is associated with an unordered pair of nodes.. Simple graph: no
More informationCS 310 Advanced Data Structures and Algorithms
CS 0 Advanced Data Structures and Algorithms Weighted Graphs July 0, 07 Tong Wang UMass Boston CS 0 July 0, 07 / Weighted Graphs Each edge has a weight (cost) Edge-weighted graphs Mostly we consider only
More informationThomas H. Cormen Charles E. Leiserson Ronald L. Rivest. Introduction to Algorithms
Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Introduction to Algorithms Preface xiii 1 Introduction 1 1.1 Algorithms 1 1.2 Analyzing algorithms 6 1.3 Designing algorithms 1 1 1.4 Summary 1 6
More informationCSCE 750, Fall 2002 Notes 6 Page Graph Problems ffl explore all nodes (breadth first and depth first) ffl find the shortest path from a given s
CSCE 750, Fall 2002 Notes 6 Page 1 10 Graph Algorithms (These notes follow the development in Cormen, Leiserson, and Rivest.) 10.1 Definitions ffl graph, directed graph (digraph), nodes, edges, subgraph
More informationCopyright 2000, Kevin Wayne 1
Chapter 3 - Graphs Undirected Graphs Undirected graph. G = (V, E) V = nodes. E = edges between pairs of nodes. Captures pairwise relationship between objects. Graph size parameters: n = V, m = E. Directed
More informationLecture 9 Graph Traversal
Lecture 9 Graph Traversal Euiseong Seo (euiseong@skku.edu) SWE00: Principles in Programming Spring 0 Euiseong Seo (euiseong@skku.edu) Need for Graphs One of unifying themes of computer science Closely
More information22 Elementary Graph Algorithms. There are two standard ways to represent a
VI Graph Algorithms Elementary Graph Algorithms Minimum Spanning Trees Single-Source Shortest Paths All-Pairs Shortest Paths 22 Elementary Graph Algorithms There are two standard ways to represent a graph
More information( ) n 3. n 2 ( ) D. Ο
CSE 0 Name Test Summer 0 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to multiply two n n matrices is: A. Θ( n) B. Θ( max( m,n, p) ) C.
More information( ) 1 B. 1. Suppose f x
CSE Name Test Spring Last Digits of Student ID Multiple Choice. Write your answer to the LEFT of each problem. points each is a monotonically increasing function. Which of the following approximates the
More information- Logic and Algorithms - Graph Algorithms
Fundamentals of Computer Sience and Digital Communications - Logic and Algorithms - Graph Algorithms Johan Larsson Marco Loh 22..24 Overview What is a Graph? Representations of Graphs Breadth-first Search
More informationProblem 1. Which of the following is true of functions =100 +log and = + log? Problem 2. Which of the following is true of functions = 2 and =3?
Multiple-choice Problems: Problem 1. Which of the following is true of functions =100+log and =+log? a) = b) =Ω c) =Θ d) All of the above e) None of the above Problem 2. Which of the following is true
More informationCS 5220: Parallel Graph Algorithms. David Bindel
CS 5220: Parallel Graph Algorithms David Bindel 2017-11-14 1 Graphs Mathematically: G = (V, E) where E V V Convention: V = n and E = m May be directed or undirected May have weights w V : V R or w E :
More information9. The expected time for insertion sort for n keys is in which set? (All n! input permutations are equally likely.)
CSE 0 Name Test Spring 006 Last 4 Digits of Student ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. Suppose f ( x) is a monotonically increasing function. Which of the
More informationL22-23: Graph Algorithms
Indian Institute of Science Bangalore, India भ रत य व ज ञ न स स थ न ब गल र, भ रत Department of Computational and Data Sciences DS 0--0,0 L-: Graph Algorithms Yogesh Simmhan simmhan@cds.iisc.ac.in Slides
More informationn 2 ( ) ( ) + n is in Θ n logn
CSE Test Spring Name Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to multiply an m n matrix and a n p matrix is in: A. Θ( n) B. Θ( max(
More information