Winter 2016 COMP-250: Introduction to Computer Science. Lecture 16, March 10, 2016
|
|
- Roderick Baldwin
- 6 years ago
- Views:
Transcription
1 Winter : Introduction to Computer Science Lecture 16, March 10, 2016
2 GRAPHS Definitions Examples The Graph ADT PVD HNL LAX DFW STL FTL
3 What is a Graph? Agraph G = (V,E) is composed of: V: set of vertices E: set of edges connecting the vertices in V An edge e = (u,v) is a pair of vertices Example: V= {a,b,c,d,e} a c b E= {(a,b),(a,c),(a,d), (b,e),(c,d),(c,e), (d,e)} d e
4 electronic circuits Applications CS start find the path of least resistance to CS16 250
5 Applications electronic networks (roads, circuitsflights, communications) CS16 PVD HNL start LAX STL DFW find the path of least resistance to CS16 FTL
6 scheduling (project planning) wake up cs16 meditation A typical student day eat work more cs16 play make cookies for cs16 HTA cs16 program sleep battletris FACEBOOK dream of cs16
7 scheduling (project planning) wake up cs16 meditation A typical student day eat work more cs16 play make cookies for cs16 HTA Hawaii Tourism Authority? cs16 program sleep battletris FACEBOOK dream of cs16
8 scheduling (project planning) wake up cs16 meditation A typical student day eat work more cs16 play make cookies for cs16 HTA Hawaii Tourism Authority? Hunter and Trappers Association? cs16 program sleep battletris FACEBOOK dream of cs16
9 scheduling (project planning) wake up cs16 meditation A typical student day eat work more cs16 play make cookies for cs16 HTA Hawaii Tourism Authority? Hunter and Trappers Association? History Teachers' Association? cs16 program sleep battletris FACEBOOK dream of cs16
10 scheduling (project planning) wake up cs16 meditation A typical student day eat work more cs16 play make cookies for cs16 HTA Hawaii Tourism Authority? Hunter and Trappers Association? History Teachers' Association? Hierarchical Task Analysis! cs16 program sleep battletris FACEBOOK dream of cs16
11 Graph electronic circuits Applications Nodes Edges transportation street intersections highways CS16 communication computers fiber optic cables World Wide Web web pages hyperlinks social people relationships start food web species predator-prey software systems functions function calls scheduling tasks precedence constraints find the path of least resistance to CS16 circuits gates wires
12 Graph Terminology adjacent vertices: connected by an edge degree (of a vertex): # of adjacent vertices 3 2 Σ deg(v) = 2(# edges) v V Since adjacent vertices each count the adjoining edge, it will be counted twice
13 Graph Terminology adjacent path: sequence vertices: of connected vertices v 1 by,v 2 an,.. edge.v k such that degree consecutive (of a vertices vertex): v i # and of adjacent v i+1 are adjacent. vertices a b a Σ b deg(v) = 2(# edges) 3 2 v V c 3 d e 3 a b e d c 3 Since adjacent c vertices each count the adjoining edge, it will d be counted twice e b e d c
14 More Graph Terminology simple path: no repeated vertices a b c b e c d e
15 More Graph Terminology simple cycle: path: simpleno path, repeated except vertices that the last vertex is the same as the first vertex a b a b c c b e c a c d a d d e e
16 Even More Terminology connected graph: any two vertices are connected by some path connected not connected
17 More Graph Terminology simple subgraph: path: subset no repeated of vertices vertices and edges forming a graph connected a component: maximal b connected subgraph. E.g., the graph below has 3 connected components. b e c c d e
18 Yet another Terminology Slide! (free) tree - connected graph without cycles forest - collection of trees tree tree forest tree tree
19 Let n = #vertices m = #edges Connectivity - complete graph - all pairs of vertices are adjacent m= (1/2)Σdeg(v) = (1/2)Σ(n - 1) = n(n-1)/2 v V v V Each of the n vertices is incident to n - 1 edges, however, we would have counted each edge twice!!! Therefore, intuitively, m = n(n-1)/2. n = 5 m = (5 4)/2 = 10
20 n = #vertices m = #edges For a tree m = n - 1 More Connectivity n = 5 m = 4 If m < n - 1, G is not connected n = 5 m = 3
21 Spanning Tree Aspanning tree of G is a subgraph which - is a tree - contains all vertices of G G spanning tree of G Failure on any edge disconnects system (least fault tolerant)
22 Roberto wants to call the TA s to suggest an extension for the next program... TA But Plant-Ops accidentally cuts a phone cable!!! TA TA TA TA One fault will disconnect part of graph!! One fault will disconnect part of graph!! A cycle would be more fault tolerant and only A requires cycle would n edges be more fault tolerant and only requires n edges
23 Koenigsberg Gilligan s Isle? C Pregal River A D B Can one walk across each bridge exactly once and return at the starting point? Consider if you were a UPS driver, and you didn t Consider want to retrace if you your were steps. UPS driver, and you didn t want to retrace your steps. In 1736, Euler proved that this is not possible
24 Graph Model(with parallel edges) C A D B Eulerian Tour: path that traverses every edge exactly once and returns to the first vertex Euler s Theorem: A graph has a Eulerian Tour if and only if all vertices have even degree
25 The Graph ADT The Graph ADT is a positional container whose positions are the vertices and the edges of the graph. - size() Return the number of vertices plus the number of edges of G. - isempty() - elements() - positions() - swap() - replaceelement()
26 The Graph ADT (contd.) Notation: - directededges() Graph G; Vertices v, w; Edge e; Object o - numvertices() Return an enumeration of all directed edges Return inthe G. number of vertices of G. - undirectededges() numedges() Return an the enumeration number of edges of allof G. - vertices() undirected Return an enumeration edges in G. of the vertices incidentedges(v) of G. - edges() Return Return an an enumeration enumeration of of the all edges edges of G.
27 The Graph ADT (contd.) - directededges() Return an enumeration of all directed edges in G. - undirectededges() Return an enumeration of all undirected edges in G. - incidentedges(v) Return an enumeration of all edges incident on v. - inincidentedges(v) Return an enumeration of all the incoming edges to v. - outincidentedges(v) Return an enumeration of all the outgoing edges from v.
28 The Graph ADT (contd.) - directededges() opposite(v, e) Return an enumeration endpoint of e of distinct all directed from v - degree(v) edges in G. - undirectededges() Return the degree of v. - indegree(v) Return an enumeration of all undirected Return the in-degree edges G. of v. - incidentedges(v) outdegree(v) Return an the enumeration out-degree of of v. all edges
29 More Methods... - adjacentvertices(v) Return an enumeration of the vertices adjacent to v. - inadjacentvertices(v) Return an enumeration of the vertices adjacent to v along incoming edges. - outadjacentvertices(v) Return an enumeration of the vertices adjacent to v along outgoing edges. - areadjacent(v,w) Return whether vertices v and w are adjacent.
30 More Methods... - adjacentvertices(v) endvertices(e) Return an enumeration array of size 2 of storing the vertices the adjacent end vertices to v. of e. - inadjacentvertices(v) origin(e) Return an the enumeration end vertex from of the which vertices e adjacent leaves. to v along incoming edges. - outadjacentvertices(v) destination(e) Return an the enumeration end vertex at of which the verticese adjacent arrives. to v along outgoing edges. - isdirected(e) Return true iff e is directed.
31 Update Methods - makeundirected(e) Set e to be an undirected edge. - reversedirection(e) Switch the origin and destination vertices of e. - setdirectionfrom(e, v) Sets the direction of e away from v, one of its end vertices. - setdirectionto(e, v) Sets the direction of e toward v, one of its end vertices.
32 Update Methods - makeundirected(e) insertedge(v, w, o) Set Insert e to and be return an undirected an undirected edge. edge - reversedirection(e) between v and w, storing o at this Switch position. the origin and destination - insertdirectededge(v, vertices of e. w, o) - setdirectionfrom(e, Insert and v) return a directed edge Sets between the direction v and w, storing of e away o at from thisv, one of position. its end vertices. - setdirectionto(e, insertvertex(o) v) Sets Insert the and direction return a of new e toward (isolated) v, one of its vertex end storing vertices. o at this position. - removeedge(e) Remove edge e.
33 DATA STRUCTURES FOR GRAPHS Edge list Adjacency lists Adjacency matrix E NW 35 DL 247 AA 49 DL 335 AA 1387 AA 523 AA 411 UA 120 AA 903 UA 877 TW 45 BOS LAX DFW JFK MIA ORD SFO V
34 To start with, we store the vertices and the edges into two containers, and each edge object has references to the vertices it connects. Data Structures for Graphs SFO LAX UA 120 AA 49 UA 877 DFW AA 411 TW 45 ORD DL 335 AA 1387 AA 523 JFK AA 903 MIA NW 35 BOS DL 247 Additional structures can be used to perform efficiently the methods of the Graph ADT
35 The edge list structure simply stores the vertices and the edges into unsorted sequences. Easy to implement. Finding the edges incident on a given vertex is inefficient since it requires examining the entire edge sequence Edge List E NW 35 DL 247 AA 49 DL 335 AA 1387 AA 523 AA 411 UA 120 AA 903 UA 877 TW 45 BOS LAX DFW JFK MIA ORD SFO V
36 Performance of the Edge List Structure Operation size, isempty, replaceelement, swap numvertices, numedges vertices edges, directededges, undirectededges elements, positions endvertices, opposite, origin, destination, isdirected incidentedges, inincidentedges, outincidentedges, adjacentvertices, inadjacentvertices, outadjacentvertices, areadjacent, degree, indegree, outdegree insertvertex, insertedge, insertdirected- Edge, removeedge, makeundirected, reversedirection, setdirectionfrom, setdirectionto removevertex Time O(1) O(1) O(n) O(m) O(n+m) O(1) O(m) O(1) O(m)
37 adjacency list of a vertex v: sequence of vertices adjacent to v Adjacency List (traditional) represent the graph by the adjacency lists of all the vertices a b c d a d b a c c e c d a d e a e b e e b c d Space = Θ(N + Σdeg(v)) = Θ(N + M)
38 The adjacency list structure extends the edge list structure by adding incidence containers to each vertex. The space requirement is O(n + m). NW 35 DL 247 AA 49 DL 335 AA 1387 AA 523 AA 411 UA 120 AA 903 UA 877 TW 45 Adjacency List (modern) BOS LAX DFW JFK MIA ORD SFO in out in out in out in out in out in out in out NW 35 AA 49 UA 120 AA1387 DL335 NW 35 AA1387 DL 247 AA523 UA 120 UA 877 TW 45 DL 247 AA 411 UA 877 AA 49 AA 903 AA 903 AA 411 DL 335 AA 523 TW 45
39 Performance of the Adjacency List Structure Operation size, isempty, replaceelement, swap numvertices, numedges vertices edges, directededges, undirectededges elements, positions endvertices, opposite, origin, destination, isdirected, degree, indegree, out- Degree incidentedges(v), inincidentedges(v), outincidentedges(v), adjacentvertices(v), inadjacentvertices(v), outadjacentvertices(v) areadjacent(u, v) insertvertex, insertedge, insertdirected- Edge, removeedge, makeundirected, reversedirection, removevertex(v) Time O(1) O(1) O(n) O(m) O(n+m) O(1) O(deg(v)) O(min(deg(u), deg(v))) O(1) O(deg(v))
40 Adjacency Matrix (traditional) a d c F T T T F T F F F T T F F T T T F T F T F T T T F matrix M with entries for all pairs of vertices b e a b c d e M[i,j] = true means that there is an edge (i,j) in the graph. M[i,j] = false means that there is no edge (i,j) in the graph. a b c d e There is an entry for every possible edge, therefore: Space = Θ(N 2 )
41 The adjacency matrix structures augments the edge list structure with a matrix where each row and column corresponds to a vertex. BOS DFW JFK LAX MIA ORD SFO The space requirement is O(n 2 + m) Adjacency Matrix (modern) Ø Ø NW 35 Ø 1 Ø Ø Ø AA 49 2 Ø AA 1387 DL 247 Ø Ø Ø AA 903 Ø DL Ø Ø Ø Ø Ø UA Ø AA Ø UA 877 Ø AA 411 Ø Ø Ø TW 45 Ø Ø Ø Ø Ø Ø Ø Ø Ø 6 Ø Ø Ø Ø Ø Ø Ø
42 Performance of the Adjacency Matrix Structure Operation size, isempty, replaceelement, swap numvertices, numedges vertices edges, directededges, undirectededges elements, positions endvertices, opposite, origin, destination, isdirected, degree, indegree, outdegree incidentedges, inincidentedges, outincidentedges, adjacentvertices, inadjacentvertices, outadjacentvertices, areadjacent insertedge, insertdirectededge, removeedge, makeundirected, reversedirection, setdirectionfrom, setdirectionto Time O(1) O(1) O(n) O(m) O(n+m) O(1) O(n) O(1) O(1) insertvertex, removevertex O(n 2 )
43 Winter : Introduction to Computer Science Lecture 16, March 10, 2016
Graphs ADTs and Implementations
Graphs ADTs and Implementations SFO 337 1843 802 ORD LAX 1233 DFW - 1 - Applications of Graphs Ø Electronic circuits cslab1a cslab1b q Printed circuit board math.brown.edu q Integrated circuit Ø Transportation
More informationCHAPTER 14 GRAPH ALGORITHMS ORD SFO LAX DFW
SFO ORD CHAPTER 14 GRAPH ALGORITHMS LAX DFW ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN JAVA, GOODRICH, TAMASSIA AND GOLDWASSER (WILEY 2016) GRAPH
More informationCOMP 250 Study Notes. 1 Grade School Algorithms. 2 Common run times. Kareem Halabi. December 16, Subtraction. 2.1 O(n) 1.
COMP 250 Study Notes Kareem Halabi December 16, 2016 Algorithm Definition (informal): the specification of a sequence of instructions to be carried out by a processor Algorithm Definition (formal): A well-ordered
More informationGraphs 3/25/14 15:37 SFO LAX Goodrich, Tamassia, Goldwasser Graphs 2
Presentation for use with the textbook Data Structures and Algorithms in Java, 6 th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Graphs SFO 337 LAX 1843 1743 1233 802 DFW
More informationCHAPTER 13 GRAPH ALGORITHMS
CHPTER 13 GRPH LGORITHMS SFO LX ORD DFW 1 CKNOWLEDGEMENT: THESE SLIDES RE DPTED FROM SLIDES PROVIDED WITH DT STRUCTURES ND LGORITHMS IN C++, GOODRICH, TMSSI ND MOUNT (WILEY 2004) ND SLIDES FROM JORY DENNY
More informationCHAPTER 13 GRAPH ALGORITHMS ORD SFO LAX DFW
SFO ORD CHAPTER 13 GRAPH ALGORITHMS LAX DFW ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA AND MOUNT (WILEY 2004) AND SLIDES
More informationGraphs. CS16: Introduction to Data Structures & Algorithms Spring 2018
Graphs CS16: Introduction to Data Structures & Algorithms Spring 2018 Outline What is a Graph Terminology Properties Graph Types Representations Performance BFS/DFS Applications 2 What is a Graph A graph
More informationChapter 3. Graphs CLRS Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 3 Graphs CLRS 12-13 Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 3.1 Basic Definitions and Applications Undirected Graphs Undirected graph. G = (V, E) V
More informationGraphs ORD SFO LAX DFW. Data structures and Algorithms
SFO 143 ORD 337 1743 02 Graphs LAX 1233 DFW Data structures and Algorithms Acknowledgement: These slides are adapted from slides provided with Data Structures and Algorithms in C++ Goodrich, Tamassia and
More informationDirected Graphs BOS Goodrich, Tamassia Directed Graphs 1 ORD JFK SFO DFW LAX MIA
Directed Graphs BOS ORD JFK SFO LAX DFW MIA 2010 Goodrich, Tamassia Directed Graphs 1 Digraphs A digraph is a graph whose edges are all directed Short for directed graph Applications one-way streets flights
More informationGraph Terminology and Representations
Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015 Graph Terminology and Representations 1 Graphs A graph is a pair (V, E), where
More informationChapter 3. Graphs. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 3 Graphs Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 3.1 Basic Definitions and Applications Undirected Graphs Undirected graph. G = (V, E) V = nodes. E
More informationGraphs ORD SFO LAX DFW. Graphs 1
Graphs ORD 1843 SFO 802 1743 337 1233 LAX DFW Graphs 1 Outline and Reading Graphs ( 12.1) Definition Applications Terminology Properties ADT Data structures for graphs ( 12.2) Edge list structure Adjacency
More informationOutline. Introduction. Representations of Graphs Graph Traversals. Applications. Definitions and Basic Terminologies
Graph Chapter 9 Outline Introduction Definitions and Basic Terminologies Representations of Graphs Graph Traversals Breadth first traversal Depth first traversal Applications Single source shortest path
More information3.1 Basic Definitions and Applications
Chapter 3 Graphs Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 3.1 Basic Definitions and Applications Undirected Graphs Undirected graph. G = (V, E) V = nodes. E
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 information3.1 Basic Definitions and Applications. Chapter 3. Graphs. Undirected Graphs. Some Graph Applications
Chapter 3 31 Basic Definitions and Applications Graphs Slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley All rights reserved 1 Undirected Graphs Some Graph Applications Undirected graph G = (V,
More informationL20-21: Graph Data Structure
Indian Institute of Science Bangalore, India भ रत य व ज ञ न स स थ न ब गल र, भ रत Department of Computational and Data Sciences DS86 06-0-6,8 L0-: Graph Data Structure Yogesh Simmhan s immhan@cds.iisc.ac.in
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 informationLecture 16: Directed Graphs
Lecture 16: Directed Graphs ORD JFK BOS SFO LAX DFW MIA Courtesy of Goodrich, Tamassia and Olga Veksler Instructor: Yuzhen Xie Outline Directed Graphs Properties Algorithms for Directed Graphs DFS and
More informationDiscrete Mathematics and Probability Theory Fall 2013 Vazirani Note 7
CS 70 Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 7 An Introduction to Graphs A few centuries ago, residents of the city of Königsberg, Prussia were interested in a certain problem.
More informationTheory of Computing. Lecture 10 MAS 714 Hartmut Klauck
Theory of Computing Lecture 10 MAS 714 Hartmut Klauck Seven Bridges of Königsberg Can one take a walk that crosses each bridge exactly once? Seven Bridges of Königsberg Model as a graph Is there a path
More informationGraph Algorithms shortest paths, minimum spanning trees, etc.
Graph Algorithms shortest paths, minimum spanning trees, etc. SFO ORD LAX DFW Graphs 1 Outline and Reading Graphs ( 1.1) Definition Applications Terminology Properties ADT Data structures for graphs (
More informationLecture 5: Graphs & their Representation
Lecture 5: Graphs & their Representation Why Do We Need Graphs Graph Algorithms: Many problems can be formulated as problems on graphs and can be solved with graph algorithms. To learn those graph algorithms,
More informationGraphs Weighted Graphs. Reading: 12.5, 12.6, 12.7
Graphs Weighted Graphs Reading: 1.5, 1.6, 1. Weighted Graphs, a.k.a. Networks In a weighted graph, each edge has an associated numerical value, called the weight or cost of the edge Edge weights may represent,
More informationGraph Theory. ICT Theory Excerpt from various sources by Robert Pergl
Graph Theory ICT Theory Excerpt from various sources by Robert Pergl What can graphs model? Cost of wiring electronic components together. Shortest route between two cities. Finding the shortest distance
More informationDiscrete Mathematics for CS Spring 2008 David Wagner Note 13. An Introduction to Graphs
CS 70 Discrete Mathematics for CS Spring 2008 David Wagner Note 13 An Introduction to Graphs Formulating a simple, precise specification of a computational problem is often a prerequisite to writing a
More informationDiscrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note 8
CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note 8 An Introduction to Graphs Formulating a simple, precise specification of a computational problem is often a prerequisite
More informationGraph Algorithms shortest paths, minimum spanning trees, etc.
SFO ORD LAX Graph Algorithms shortest paths, minimum spanning trees, etc. DFW Nancy Amato Parasol Lab, Dept. CSE, Texas A&M University Acknowledgement: These slides are adapted from slides provided with
More informationCSE 417: Algorithms and Computational Complexity. 3.1 Basic Definitions and Applications. Goals. Chapter 3. Winter 2012 Graphs and Graph Algorithms
Chapter 3 CSE 417: Algorithms and Computational Complexity Graphs Reading: 3.1-3.6 Winter 2012 Graphs and Graph Algorithms Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
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 informationCopyright 2000, Kevin Wayne 1
Linear Time: O(n) CS 580: Algorithm Design and Analysis 2.4 A Survey of Common Running Times Merge. Combine two sorted lists A = a 1,a 2,,a n with B = b 1,b 2,,b n into sorted whole. Jeremiah Blocki Purdue
More informationLecture 5: Graphs. Rajat Mittal. IIT Kanpur
Lecture : Graphs Rajat Mittal IIT Kanpur Combinatorial graphs provide a natural way to model connections between different objects. They are very useful in depicting communication networks, social networks
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 informationEECS 1028 M: Discrete Mathematics for Engineers
EECS 1028 M: Discrete Mathematics for Engineers Suprakash Datta Office: LAS 3043 Course page: http://www.eecs.yorku.ca/course/1028 Also on Moodle S. Datta (York Univ.) EECS 1028 W 18 1 / 15 Graphs: Motivations
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 informationGraphs (MTAT , 6 EAP) Lectures: Mon 14-16, hall 404 Exercises: Wed 14-16, hall 402
Graphs (MTAT.05.080, 6 EAP) Lectures: Mon 14-16, hall 404 Exercises: Wed 14-16, hall 402 homepage: http://courses.cs.ut.ee/2012/graafid (contains slides) For grade: Homework + three tests (during or after
More informationLet G = (V, E) be a graph. If u, v V, then u is adjacent to v if {u, v} E. We also use the notation u v to denote that u is adjacent to v.
Graph Adjacent Endpoint of an edge Incident Neighbors of a vertex Degree of a vertex Theorem Graph relation Order of a graph Size of a graph Maximum and minimum degree Let G = (V, E) be a graph. If u,
More informationData Structures Lecture 14
Fall 2018 Fang Yu Software Security Lab. ept. Management Information Systems, National hengchi University ata Structures Lecture 14 Graphs efinition, Implementation and Traversal Graphs Formally speaking,
More informationGraphs. Introduction To Graphs: Exercises. Definitions:
Graphs Eng.Jehad Aldahdooh Introduction To Graphs: Definitions: A graph G = (V, E) consists of V, a nonempty set of vertices (or nodes) and E, a set of edges. Each edge has either one or two vertices associated
More informationIntroduction to Graphs
Introduction to Graphs Historical Motivation Seven Bridges of Königsberg Königsberg (now Kaliningrad, Russia) around 1735 Problem: Find a walk through the city that would cross each bridge once and only
More informationCrossing bridges. Crossing bridges Great Ideas in Theoretical Computer Science. Lecture 12: Graphs I: The Basics. Königsberg (Prussia)
15-251 Great Ideas in Theoretical Computer Science Lecture 12: Graphs I: The Basics February 22nd, 2018 Crossing bridges Königsberg (Prussia) Now Kaliningrad (Russia) Is there a way to walk through the
More informationAdvanced Algorithms and Computational Models (module A) Lecture no Giacomo Fiumara / 27
Advanced Algorithms and Computational Models (module A) Lecture no. 10 24-10-2014 Giacomo Fiumara giacomo.fiumara@unime.it 2014-2015 1 / 27 Adjacency List For each vertex is maintained a separate list
More informationAlgorithms. Graphs. Algorithms
Algorithms Graphs Algorithms Graphs Definition: A graph is a collection of edges and vertices. Each edge connects two vertices. Algorithms 1 Graphs Vertices: Nodes, points, computers, users, items,...
More informationLogic: The Big Picture. Axiomatizing Arithmetic. Tautologies and Valid Arguments. Graphs and Trees
Axiomatizing Arithmetic Logic: The Big Picture Suppose we restrict the domain to the natural numbers, and allow only the standard symbols of arithmetic (+,, =, >, 0, 1). Typical true formulas include:
More informationIS 709/809: Computational Methods in IS Research. Graph Algorithms: Introduction
IS 709/809: Computational Methods in IS Research Graph Algorithms: Introduction Nirmalya Roy Department of Information Systems University of Maryland Baltimore County www.umbc.edu Motivation Several real-life
More informationUndirected Graphs. V = { 1, 2, 3, 4, 5, 6, 7, 8 } E = { 1-2, 1-3, 2-3, 2-4, 2-5, 3-5, 3-7, 3-8, 4-5, 5-6 } n = 8 m = 11
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. V = {
More informationAlgorithms: Graphs. Amotz Bar-Noy. Spring 2012 CUNY. Amotz Bar-Noy (CUNY) Graphs Spring / 95
Algorithms: Graphs Amotz Bar-Noy CUNY Spring 2012 Amotz Bar-Noy (CUNY) Graphs Spring 2012 1 / 95 Graphs Definition: A graph is a collection of edges and vertices. Each edge connects two vertices. Amotz
More informationBIL694-Lecture 1: Introduction to Graphs
BIL694-Lecture 1: Introduction to Graphs Lecturer: Lale Özkahya Resources for the presentation: http://www.math.ucsd.edu/ gptesler/184a/calendar.html http://www.inf.ed.ac.uk/teaching/courses/dmmr/ Outline
More informationLecture 14: Graph Representation, DFS and Applications
Lecture 14: Graph Representation, FS and pplications SFO OR LX FW ourtesy to Goodrich, Tamassia and Olga Veksler Instructor: Yuzhen Xie Outline Graph Representation dge List djacency List djacency Matrix
More informationCMSC 380. Graph Terminology and Representation
CMSC 380 Graph Terminology and Representation GRAPH BASICS 2 Basic Graph Definitions n A graph G = (V,E) consists of a finite set of vertices, V, and a finite set of edges, E. n Each edge is a pair (v,w)
More informationCS 561, Lecture 9. Jared Saia University of New Mexico
CS 561, Lecture 9 Jared Saia University of New Mexico Today s Outline Minimum Spanning Trees Safe Edge Theorem Kruskal and Prim s algorithms Graph Representation 1 Graph Definition A graph is a pair of
More information1 Digraphs. Definition 1
1 Digraphs Definition 1 Adigraphordirected graphgisatriplecomprisedofavertex set V(G), edge set E(G), and a function assigning each edge an ordered pair of vertices (tail, head); these vertices together
More informationDFS on Directed Graphs BOS. Outline and Reading ( 6.4) Digraphs. Reachability ( 6.4.1) Directed Acyclic Graphs (DAG s) ( 6.4.4)
S on irected Graphs OS OR JK SO LX W MI irected Graphs S 1.3 1 Outline and Reading ( 6.4) Reachability ( 6.4.1) irected S Strong connectivity irected cyclic Graphs (G s) ( 6.4.4) Topological Sorting irected
More informationGraphs and Genetics. Outline. Computational Biology IST. Ana Teresa Freitas 2015/2016. Slides source: AED (MEEC/IST); Jones and Pevzner (book)
raphs and enetics Computational Biology IST Ana Teresa Freitas / Slides source: AED (MEEC/IST); Jones and Pevzner (book) Outline l Motivacion l Introduction to raph Theory l Eulerian & Hamiltonian Cycle
More informationK 4 C 5. Figure 4.5: Some well known family of graphs
08 CHAPTER. TOPICS IN CLASSICAL GRAPH THEORY K, K K K, K K, K K, K C C C C 6 6 P P P P P. Graph Operations Figure.: Some well known family of graphs A graph Y = (V,E ) is said to be a subgraph of a graph
More informationAlgorithms: Lecture 7. Chalmers University of Technology
Algorithms: Lecture 7 Chalmers University of Technology Today s Lecture Divide & Conquer Counting Inversions Closest Pair of Points Multiplication of large integers Intro to the forthcoming problems Graphs:
More informationSome Graph Theory for Network Analysis. CS 249B: Science of Networks Week 01: Thursday, 01/31/08 Daniel Bilar Wellesley College Spring 2008
Some Graph Theory for Network Analysis CS 9B: Science of Networks Week 0: Thursday, 0//08 Daniel Bilar Wellesley College Spring 008 Goals this lecture Introduce you to some jargon what we call things in
More informationCharacterizing Graphs (3) Characterizing Graphs (1) Characterizing Graphs (2) Characterizing Graphs (4)
S-72.2420/T-79.5203 Basic Concepts 1 S-72.2420/T-79.5203 Basic Concepts 3 Characterizing Graphs (1) Characterizing Graphs (3) Characterizing a class G by a condition P means proving the equivalence G G
More informationGraphs Definitions. Gunnar Gotshalks. GraphDefinitions 1
Graphs Definitions GraphDefinitions 1 Examples of Graphs Street maps» Vertices are the intersections» Edges are the streets Power line network» Vertices are the houses & power stations» Edges are the power
More informationLecture 5: Graphs. Graphs! Euler Definitions: model. Fact! Euler Again!! Planar graphs. Euler Again!!!!
Lecture 5: Graphs. Graphs! Euler Definitions: model. Fact! Euler Again!! Planar graphs. Euler Again!!!! Konigsberg bridges problem. Can you make a tour visiting each bridge exactly once? Konigsberg bridges
More informationIntroduction III. Graphs. Motivations I. Introduction IV
Introduction I Graphs Computer Science & Engineering 235: Discrete Mathematics Christopher M. Bourke cbourke@cse.unl.edu Graph theory was introduced in the 18th century by Leonhard Euler via the Königsberg
More information8.2 Paths and Cycles
8.2 Paths and Cycles Degree a b c d e f Definition The degree of a vertex is the number of edges incident to it. A loop contributes 2 to the degree of the vertex. (G) is the maximum degree of G. δ(g) is
More informationVarying Applications (examples)
Graph Theory Varying Applications (examples) Computer networks Distinguish between two chemical compounds with the same molecular formula but different structures Solve shortest path problems between cities
More informationCSE 101, Winter Discussion Section Week 1. January 8 - January 15
CSE 101, Winter 2018 Discussion Section Week 1 January 8 - January 15 Important Annotations were added (post-lecture) to the tablet slides, to fill in a few gaps (Lecture 1) Look through Additional Resources
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 informationDataStruct 13. Graph Algorithms
2013-2 DataStruct 13. Graph Algorithms Michael T. Goodrich, et. al, Data Structures and Algorithms in C++, 2 nd Ed., John Wiley & Sons, Inc., 2011. December 10, 2013 Advanced Networking Technology Lab.
More informationGraphs ORD SFO LAX DFW Goodrich, Tamassia Graphs 1
Graphs SFO 33 143 ORD 02 LAX 1233 DFW 2004 Goodrich, Tamassia Graphs 1 What is a Graph? (in computer science, it s not a data plot) General structure for representing positions with an arbitrary connectivity
More informationDesign and Analysis of Algorithms
CSE, Winter 8 Design and Analysis of Algorithms Lecture : Graphs, DFS (Undirected, Directed), DAGs Class URL: http://vlsicad.ucsd.edu/courses/cse-w8/ Graphs Internet topology Graphs Gene-gene interactions
More informationMaterial handling and Transportation in Logistics. Paolo Detti Dipartimento di Ingegneria dell Informazione e Scienze Matematiche Università di Siena
Material handling and Transportation in Logistics Paolo Detti Dipartimento di Ingegneria dell Informazione e Scienze Matematiche Università di Siena Introduction to Graph Theory Graph Theory As Mathematical
More informationPaths. Path is a sequence of edges that begins at a vertex of a graph and travels from vertex to vertex along edges of the graph.
Paths Path is a sequence of edges that begins at a vertex of a graph and travels from vertex to vertex along edges of the graph. Formal Definition of a Path (Undirected) Let n be a nonnegative integer
More informationIntroduction to Graph Theory
Introduction to Graph Theory Tandy Warnow January 20, 2017 Graphs Tandy Warnow Graphs A graph G = (V, E) is an object that contains a vertex set V and an edge set E. We also write V (G) to denote the vertex
More informationCSE 21 Spring 2016 Homework 5. Instructions
CSE 21 Spring 2016 Homework 5 Instructions Homework should be done in groups of one to three people. You are free to change group members at any time throughout the quarter. Problems should be solved together,
More informationAdjacent: Two distinct vertices u, v are adjacent if there is an edge with ends u, v. In this case we let uv denote such an edge.
1 Graph Basics What is a graph? Graph: a graph G consists of a set of vertices, denoted V (G), a set of edges, denoted E(G), and a relation called incidence so that each edge is incident with either one
More information0.0.1 Network Analysis
Graph Theory 0.0.1 Network Analysis Prototype Example: In Algonquian Park the rangers have set up snowmobile trails with various stops along the way. The system of trails is our Network. The main entrance
More informationChapter 8 Topics in Graph Theory
Chapter 8 Topics in Graph Theory Chapter 8: Topics in Graph Theory Section 8.1: Examples {1,2,3} Section 8.2: Examples {1,2,4} Section 8.3: Examples {1} 8.1 Graphs Graph A graph G consists of a finite
More informationShortest Paths D E. Shortest Paths 1
Shortest Paths A 2 7 2 B C D 2 E F Shortest Paths Outline and Reading Weighted graphs ( 7.) Shortest path problem Shortest path properties Dijkstra s algorithm ( 7..) Algorithm Edge relaxation The Bellman-Ford
More informationElements of Graph Theory
Elements of Graph Theory Quick review of Chapters 9.1 9.5, 9.7 (studied in Mt1348/2008) = all basic concepts must be known New topics we will mostly skip shortest paths (Chapter 9.6), as that was covered
More informationChapter 2 Graphs. 2.1 Definition of Graphs
Chapter 2 Graphs Abstract Graphs are discrete structures that consist of vertices and edges connecting some of these vertices. Graphs have many applications in Mathematics, Computer Science, Engineering,
More informationCS 225. April 16 Graph Traversal. Data Structures. Wade Fagen-Ulmschneider
CS 225 Data Structures April 16 Graph Traversal Wade Fagen-Ulmschneider Graph ADT Data: - Vertices - Edges - Some data structure maintaining the structure between vertices and edges. d V W f b e X Y g
More informationLesson 22: Basic Graph Concepts
Lesson 22: asic Graph oncepts msc 175 iscrete Mathematics 1. Introduction graph is a mathematical object that is used to model different relations between objects and processes: Linked list Flowchart of
More informationAlgorithm Design and Analysis
Algorithm Design and Analysis LECTURE 5 Exploring graphs Adam Smith 9/5/2008 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne Puzzles Suppose an undirected graph G is connected.
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 informationIntroduction to Graphs
Graphs Introduction to Graphs Graph Terminology Directed Graphs Special Graphs Graph Coloring Representing Graphs Connected Graphs Connected Component Reading (Epp s textbook) 10.1-10.3 1 Introduction
More informationChapter 9. Graph Theory
Chapter 9. Graph Theory Prof. Tesler Math 8A Fall 207 Prof. Tesler Ch. 9. Graph Theory Math 8A / Fall 207 / 50 Graphs PC Computer network PC2 Modem ISP Remote server PC Emily Dan Friends Irene Gina Harry
More informationLecture 3: Graphs and flows
Chapter 3 Lecture 3: Graphs and flows Graphs: a useful combinatorial structure. Definitions: graph, directed and undirected graph, edge as ordered pair, path, cycle, connected graph, strongly connected
More informationPaths, Circuits, and Connected Graphs
Paths, Circuits, and Connected Graphs Paths and Circuits Definition: Let G = (V, E) be an undirected graph, vertices u, v V A path of length n from u to v is a sequence of edges e i = {u i 1, u i} E for
More informationGraph Algorithms Using Depth First Search
Graph Algorithms Using Depth First Search Analysis of Algorithms Week 8, Lecture 1 Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Graph Algorithms Using Depth
More informationAlgorithm Design and Analysis
Algorithm Design and Analysis LECTURE 4 Graphs Definitions Traversals Adam Smith 9/8/10 Exercise How can you simulate an array with two unbounded stacks and a small amount of memory? (Hint: think of a
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 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 informationDiscrete Mathematics and Probability Theory Spring 2015 Vazirani Note 5
CS 70 Discrete Mathematics and Probability Theory Spring 2015 Vazirani Note 5 1 Graph Theory: An Introduction One of the fundamental ideas in computer science is the notion of abstraction: capturing the
More informationimplementing the breadth-first search algorithm implementing the depth-first search algorithm
Graph Traversals 1 Graph Traversals representing graphs adjacency matrices and adjacency lists 2 Implementing the Breadth-First and Depth-First Search Algorithms implementing the breadth-first search algorithm
More informationDiscrete mathematics II. - Graphs
Emil Vatai April 25, 2018 Basic definitions Definition of an undirected graph Definition (Undirected graph) An undirected graph or (just) a graph is a triplet G = (ϕ, E, V ), where V is the set of vertices,
More informationChapter 11: Graphs and Trees. March 23, 2008
Chapter 11: Graphs and Trees March 23, 2008 Outline 1 11.1 Graphs: An Introduction 2 11.2 Paths and Circuits 3 11.3 Matrix Representations of Graphs 4 11.5 Trees Graphs: Basic Definitions Informally, a
More informationNotes slides from before lecture. CSE 21, Winter 2017, Section A00. Lecture 9 Notes. Class URL:
Notes slides from before lecture CSE 21, Winter 2017, Section A00 Lecture 9 Notes Class URL: http://vlsicad.ucsd.edu/courses/cse21-w17/ Notes slides from before lecture Notes February 8 (1) HW4 is due
More informationCompatible circuits in eulerian digraphs
Compatible circuits in eulerian digraphs James Carraher University of Nebraska Lincoln s-jcarrah1@math.unl.edu Joint Work with Stephen Hartke March 2012 James Carraher (UNL) Compatible circuits in eulerian
More informationECE250: Algorithms and Data Structures Elementary Graph Algorithms Part A
ECE250: Algorithms and Data Structures Elementary Graph Algorithms Part A Ladan Tahvildari, PEng, SMIEEE Associate Professor Software Technologies Applied Research (STAR) Group Dept. of Elect. & Comp.
More informationWUCT121. Discrete Mathematics. Graphs
WUCT121 Discrete Mathematics Graphs WUCT121 Graphs 1 Section 1. Graphs 1.1. Introduction Graphs are used in many fields that require analysis of routes between locations. These areas include communications,
More informationMATH 363 Final Wednesday, April 28. Final exam. You may use lemmas and theorems that were proven in class and on assignments unless stated otherwise.
Final exam This is a closed book exam. No calculators are allowed. Unless stated otherwise, justify all your steps. You may use lemmas and theorems that were proven in class and on assignments unless stated
More information