Graphs1 Definitions Examples The Graph ADT LAX PVD LAX DFW FTL STL HNL.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

Chapter 8 Topics in Graph Theory
Lecture 5 Graph Theory. Graphs Graphs are the most useful model with computer science such as logical design, formal languages, communication network,
CSC401 – Analysis of Algorithms Lecture Notes 14 Graph Biconnectivity
CSC 213 – Large Scale Programming Lecture 27: Graph ADT.
CSC 213 ORD DFW SFO LAX Lecture 20: Graphs.
© 2004 Goodrich, Tamassia Graphs1 ORD DFW SFO LAX
B.Ramamurthy1 Graphs Chapter 12 B.Ramamurthy. 2 Introduction A structure that represents connectivity information. A tree is kind of graph. Applications.
1 Graphs ORD DFW SFO LAX Many slides taken from Goodrich, Tamassia 2004.
1 Graphs: Concepts, Representation, and Traversal CSC401 – Analysis of Algorithms Lecture Notes 13 Graphs: Concepts, Representation, and Traversal Objectives:
Graphs1 Part-H1 Graphs ORD DFW SFO LAX
Graphs G = (V,E) V is the vertex set. Vertices are also called nodes and points. E is the edge set. Each edge connects two different vertices. Edges are.
Graphs1 ORD DFW SFO LAX Graphs2 Outline and Reading Graphs (§6.1) Definition Applications Terminology Properties ADT Data structures.
Graphs1 ORD DFW SFO LAX Graphs2 Outline and Reading Graphs (§6.1) Definition Applications Terminology Properties ADT Data structures.
Chapter 11 Graphs and Trees This handout: Terminology of Graphs Eulerian Cycles.
GRAPH Learning Outcomes Students should be able to:
Graphs CS /02/05 Graphs Slide 2 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Definition.
Graph Theoretic Concepts. What is a graph? A set of vertices (or nodes) linked by edges Mathematically, we often write G = (V,E)  V: set of vertices,
Graphs – ADTs and Implementations ORD DFW SFO LAX
GRAPHS CSE, POSTECH. Chapter 16 covers the following topics Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component,
Graphs Chapter 12.
Graphs Part 1. Outline and Reading Graphs (§13.1) – Definition – Applications – Terminology – Properties – ADT Data structures for graphs (§13.2) – Edge.
7.1 and 7.2: Spanning Trees. A network is a graph that is connected –The network must be a sub-graph of the original graph (its edges must come from the.
1 CS104 : Discrete Structures Chapter V Graph Theory.
Module #19: Graph Theory: part II Rosen 5 th ed., chs. 8-9.
Graphs CSE 2011 Winter June Graphs A graph is a pair (V, E), where  V is a set of nodes, called vertices  E is a collection of pairs.
Spring 2007Graphs1 ORD DFW SFO LAX
GRAPHS 1. Outline 2  Undirected Graphs and Directed Graphs  Depth-First Search  Breadth-First Search.
Graphs.  Definition A simple graph G= (V, E) consists of vertices, V, a nonempty set of vertices, and E, a set of unordered pairs of distinct elements.
Data Structures & Algorithms Graphs
COSC 2007 Data Structures II Chapter 14 Graphs I.
CISC 235: Topic 9 Introduction to Graphs. CISC 235 Topic 92 Outline Graph Definition Terminology Representations Traversals.
Graph theory and networks. Basic definitions  A graph consists of points called vertices (or nodes) and lines called edges (or arcs). Each edge joins.
Data Structures & Algorithms Graphs Richard Newman based on book by R. Sedgewick and slides by S. Sahni.
GRAPHS. Graph Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component, spanning tree Types of graphs: undirected,
Introduction to Programming
 Quotient graph  Definition 13: Suppose G(V,E) is a graph and R is a equivalence relation on the set V. We construct the quotient graph G R in the follow.
Basic properties Continuation
1 Graphs Terminology By: Sandeep Tuli Astt. Prof. CSE.
Introduction to Graph Theory
Chapter 9: Graphs.
Graphs and Paths : Chapter 15 Saurav Karmakar
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University Graphs Original Slides by Rada Mihalcea.
CHAPTER 13 GRAPH ALGORITHMS ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
Graphs ORD SFO LAX DFW Graphs 1 Graphs Graphs
BCA-II Data Structure Using C Submitted By: Veenu Saini
Data Structures & Algorithm Analysis lec(8):Graph T. Souad alonazi
Graphs 10/24/2017 6:47 AM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and.
Directed Graphs 12/7/2017 7:15 AM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
Graphs.
Graphs 5/14/ :46 PM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and.
Graphs 7/18/2018 7:39 AM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and.
Graphs ORD SFO LAX DFW Graphs Graphs
Graphs ORD SFO LAX DFW Graphs Graphs
Graphs Part 1.
Graphs ORD SFO LAX DFW Graphs Graphs
Graphs.
Graphs.
Graphs ORD SFO LAX DFW Graphs Graphs
Graphs CSE 2011 Winter November 2018.
What is a Graph? a b c d e V= {a,b,c,d,e} E= {(a,b),(a,c),(a,d),
Minimum Spanning Tree Section 7.3: Examples {1,2,3,4}
Graphs ORD SFO LAX DFW Graphs Graphs
Graphs ORD SFO LAX DFW Graphs Graphs
Graphs 4/29/15 01:28:20 PM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
Graphs ORD SFO LAX DFW /15/ :57 AM
Chapter 10 Graphs and Trees
GRAPHS.
Presentation transcript:

Graphs1 Definitions Examples The Graph ADT LAX PVD LAX DFW FTL STL HNL

Graphs2 What is a Graph? A graph 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: a b c d e V= {a,b,c,d,e} E= {(a,b),(a,c),(a,d), (b,e),(c,d),(c,e), (d,e)}

Graphs3 Applications electronic circuits find the path of least resistance to CS16 networks (roads, flights, communications) CS16 start LAX PVD LAX DFW FTL STL HNL

Graphs4 mo’ better examples A Spike Lee Joint Production scheduling (project planning) wake up eat work cs16 meditation more cs16 play make cookies for cs16 HTA sleep dream of cs16 cs16 program A typical student day battletris

5 Graph Terminology adjacent vertices: vertices connected by an edge degree (of a vertex): # of adjacent vertices NOTE: The sum of the degrees of all vertices is twice the number of edges. Why? Since adjacent vertices each count the adjoining edge, it will be counted twice path: sequence of vertices v 1,v 2,...v k such that consecutive vertices v i and v i+1 are adjacent a b c d e a b c d e a b e d cb e d c

Graphs6 More Graph Terminology simple path: no repeated vertices cycle: simple path, except that the last vertex is the same as the first vertex a b c d e b e c

Graphs7 Even More Terminology subgraph: subset of vertices and edges forming a graph connected component: maximal connected subgraph. E.g., the graph below has 3 connected components. connected not connected connected graph: any two vertices are connected by some path

Graphs8 ¡Caramba! Another Terminology Slide! (free) tree - connected graph without cycles forest - collection of trees

Graphs9 Connectivity Let n = #vertices, and m = #edges A complete graph: one in which all pairs of vertices are adjacent How many total edges in a complete graph? –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. Therefore, if a graph is not complete, m < n(n -1)/2

Graphs10 More Connectivity n = #vertices m = #edges For a tree m = n - 1 If m < n - 1, G is not connected

Graphs11 Spanning Tree A spanning tree of G is a subgraph which is a tree and which contains all vertices of G Failure on any edge disconnects system (least fault tolerant)

Graphs12 AT&T vs. RT&T (Roberto Tamassia & Telephone) Roberto wants to call the TA’s to suggest an extension for the next program... In the previous graph, one fault will disconnect part of graph!! A cycle would be more fault tolerant and only requires n edges

Graphs13 Euler and the Bridges of Koenigsberg Consider if you were a UPS driver, and you didn’t want to retrace your steps. In 1736, Euler proved that this is not possible

Graphs14 Graph Model(with parallel edges) 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

Graphs15 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() Notation: Graph G; Vertices v, w; Edge e; Object o -numVertices()Return the number of vertices of G. -numEdges()Return the number of edges of G. -vertices()Return an enumeration of the vertices of G. -edges()Return an enumeration of the edges of G.

Graphs16 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. -opposite(v, e)Return an endpoint of e distinct from v -degree(v)Return the degree of v. -inDegree(v)Return the in-degree of v. -outDegree(v)Return the out-degree of v.

Graphs17 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. -endVertices(e)Return an array of size 2 storing the end vertices of e. -origin(e)Return the end vertex from which e leaves. -destination(e)Return the end vertex at which e arrives. -isDirected(e) Return true iff e is directed.

18 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. -insertEdge(v, w, o)Insert and return an undirected edge between v and w, storing o at this position. -insertDirectedEdge(v, w, o)Insert and return a directed edge between v and w, storing o at this position. -insertVertex(o)Insert and return a new (isolated) vertex storing o at this position. -removeEdge(e)Remove edge e.