Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

Chapter 8 Topics in Graph Theory
Chapter 9 Graphs.
Lecture 5 Graph Theory. Graphs Graphs are the most useful model with computer science such as logical design, formal languages, communication network,
22C:19 Discrete Math Graphs Fall 2010 Sukumar Ghosh.
Introduction to Graph Theory Instructor: Dr. Chaudhary Department of Computer Science Millersville University Reading Assignment Chapter 1.
22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
Graph-02.
Introduction to Graphs
1 Slides based on those of Kenneth H. Rosen Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus Graphs.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 CHAPTER 4 - PART 2 GRAPHS 1.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
Applied Discrete Mathematics Week 12: Trees
© 2006 Pearson Addison-Wesley. All rights reserved14 A-1 Chapter 14 Graphs.
Discrete Structures Chapter 7B Graphs Nurul Amelina Nasharuddin Multimedia Department.
Representing Graphs Wade Trappe. Lecture Overview Introduction Some Terminology –Paths Adjacency Matrix.
Chapter 4 Graphs.
Discrete Mathematics Lecture 9 Alexander Bukharovich New York University.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
GRAPH Learning Outcomes Students should be able to:
Graphs Chapter 10.
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,
Graph Theory Topics to be covered:
Can you connect the dots as shown without taking your pen off the page or drawing the same line twice.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 2): Graphs  Graph Terminology (9.2)
Euler and Hamilton Paths. Euler Paths and Circuits The Seven bridges of Königsberg a b c d A B C D.
CSNB143 – Discrete Structure Topic 9 – Graph. Learning Outcomes Student should be able to identify graphs and its components. Students should know how.
1 CS104 : Discrete Structures Chapter V Graph Theory.
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.
Week 11 - Monday.  What did we talk about last time?  Binomial theorem and Pascal's triangle  Conditional probability  Bayes’ theorem.
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
COSC 2007 Data Structures II Chapter 14 Graphs I.
1 Graphs Theory UNIT IV. 2Contents  Basic terminology,  Multi graphs and weighted graphs  Paths and circuits  Shortest path in weighted graph  Hamiltonian.
Introduction to Graph Theory
Graph Theory and Applications
Graph Theory. A branch of math in which graphs are used to solve a problem. It is unlike a Cartesian graph that we used throughout our younger years of.
Lecture 10: Graph-Path-Circuit
Introduction to Graphs. This Lecture In this part we will study some basic graph theory. Graph is a useful concept to model many problems in computer.
Graph theory and networks. Basic definitions  A graph consists of points called vertices (or nodes) and lines called edges (or arcs). Each edge joins.
1 Directed Graphs Chapter 8. 2 Objectives You will be able to: Say what a directed graph is. Describe two ways to represent a directed graph: Adjacency.
Lecture 52 Section 11.2 Wed, Apr 26, 2006
Basic properties Continuation
Graphs Basic properties.
Chapter 11 - Graph CSNB 143 Discrete Mathematical Structures.
Chapter 9: Graphs.
Great Theoretical Ideas in Computer Science for Some.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
CS 261 – Nov. 17 Graph properties – Bipartiteness – Isomorphic to another graph – Pseudograph, multigraph, subgraph Path Cycle – Hamiltonian – Euler.
Graphs Rosen, Chapter 8. NOT ONE OF THESE! One of these!
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Paths and circuits.
(CSC 102) Lecture 30 Discrete Structures. Graphs.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
1 Lecture 5 (part 2) Graphs II (a) Circuits; (b) Representation Reading: Epp Chp 11.2, 11.3
رياضيات متقطعة لعلوم الحاسب MATH 226. Chapter 10.
Chapter Chapter Summary Graphs and Graph Models Graph Terminology and Special Types of Graphs Representing Graphs and Graph Isomorphism Connectivity.
An Introduction to Graph Theory
Graphs: Definitions and Basic Properties
Chapter 9 (Part 2): Graphs
Lecture 19: CONNECTIVITY Sections
Graphs Hubert Chan (Chapter 9) [O1 Abstract Concepts]
Graph theory Definitions Trees, cycles, directed graphs.
Can you draw this picture without lifting up your pen/pencil?
Introduction to Graph Theory Euler and Hamilton Paths and Circuits
Graphs Chapter 13.
Decision Maths Graphs.
Discrete Mathematics Lecture 12: Graph Theory
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Euler and Hamilton Paths
Agenda Review Lecture Content: Shortest Path Algorithm
Presentation transcript:

Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1

What is a graph? 2

3

4

Graphs – Are they really important?? Yes! Used in virtually EVERY discipline! Common examples Airline routes – draw lines between cities Computer networks – lines for direct connection Workforce – People & Jobs assigned Travel – Cities & highways 5

What is a graph? Non-technical definition: Set of objects in which some pairs are related DEFN: Graph Collection of Vertices (V) & Edges (E). Vertices are simple objects & an Edge is a connection between 2 Vertices Non-empty, finite set of vertices (V) & set of edges (e) of 2-element subsets (pairs) of V Note: Graph Theory terminology is not always consistent among books/authors 6

What is a graph? Author’s restrictions No edge from vertex to itself Only one edge between 2 specific vertices Makes graphs simpler But is BIG restriction Other Examples??? 7

Graph Terminology Vertices are generally named – a, b, c… Edges usually named by 2 vertices – (a,b) Edges may be labeled – usually a value Value = distance, cost, etc. Adjacent, Joined: 2 vertices are adjacent/joined if they are connected by an edge Incident: a vertex & edge are incident if the edge connects to the vertex 8

Example Vertex Edge Label Value Adjacent Incident 9

More Terms Degree of Vertex: Number of edges incident to the vertex Degree of Graph: Maximum of degrees of vertices Complete Graph: Every vertex is adjacent to every other vertex an edge exists between each pair of vertices 10

Interpretation of a Graph NOTE: The shape of a graph is not “important” it is the relationship that is significant. A single graph can be drawn multiple ways but still represents the same relationships. PROBLEM: Given a graph, can it be drawn without any of the edges crossing? 11

Number of Vertices How many edges are in a complete graph of N vertices? Can we solve inductively? Can we develop the table? VerticesEdges N??? 12

Theorem 4.1 In a graph the sum of the degrees of the vertices equals twice the number of edges. Why? Because each 1 edge is incident on 2 vertices. 13

Graph Representation: Adjacency Matrix Given a graph with N vertices, form an NXN matrix with rows & columns labeled to represent the vertices. Place a 1 in location (i, j) if there is an edge between Vertices i and j, and place a 0 otherwise. V1V2V3V4 V10110 V21001 V31001 V

Graph Representation: Adjacency List List (array) containing each vertex, attached to a (linked) list of each vertex adjacent to it 15 V1V2V3 V2 V4 V3V1V3 V4V2V3

Isomorphic Graphs Two graphs G1 & G2 are isomorphic if there exists a 1-to-1 correspondence f between the vertices of graphs such that if vertices u & v are adjacent in G1 then f (u) and f (v) are adjacent in G2 I.E. Graphs are the same except for labeling & arrangement 16

Isomorphic Graphs The following graphs are isomorphic Colors indicate the 1-to-1 correspondence 17

18 Determining Isomorphism How could we determine if 2 graphs G1 & G2 are isomorphic? This is a “hard” problem. (More later!) Can we determine if 2 Graphs G1 & G2 are NOT isomorphic?

19 Determining Isomorphism Invariant – a term that states some fact that does not vary State isomorphic graph invariants: What properties must be true of 2 graphs if they are isomorphic.

20 Determining Isomorphism Invariant – a term that states some fact that does not vary State isomorphic graph invariants: What properties must be true of 2 graphs if they are isomorphic? Equal number of vertices Equal number of edges Vertices have same degree

21 Homework Section 4.1 All

Paths & Circuits Multigraph: Graph which has parallel edges between vertices and/or loops Loop: Edge from a vertex to itself Degree is counted as 2 for a loop Parallel Edges: Multiple edges between 2 vertices Path: a path from vertices U to V is a sequence of vertices & edges from U to V Simple Path: no repeated edge or vertex Length of Path (from U to V): number of edges in the path from U to V

23 Example Multigraph Loop Degree (of node with loop) Parallel Edges Path Length of Pat

24 More Terminology Connected: a graph in which there is a path between each pair of vertices Cycle: a path of length >0 which begins & ends at the same vertex all edges & non-ending vertices are distinct

25 Euler Paths & Circuits Euler Path: a path including every edge exactly once & different first & last vertices Euler Circuit: a path including every edge exactly once & the same first & last vertices See examples on pages

26 Existence of Euler Circuit Graph must be connected Each vertex reached must be exited – thus must have degree 2 (in & out) If a vertex is visited multiple times must have even number of vertices Example 4.20 – page 168 Euler Circuit Algorithm (pg )

27 Euler Circuit Algorithm - Overview Select any vertex – U Randomly select unused edges to construct circuit from U to U If unselected edges remain, Select a vertex with unselected edge & construct a circuit Repeat until all edges are included Note: not a unique solution

28 Euler Circuit - Implementation How is graph represented? How do you mark edges as selected? How do you know if unselected edges remain? Sets… E is set of edges P is path

29 Theorem 4.5 Necessary & sufficient conditions for Euler circuit - path Suppose a multigraph G is connected. G has an Euler circuit iff every vertex has even degree. G has an Euler path iff every vertex has even degree except for 2 distinct vertices which have odd degree (Path begins at one odd vertex & ends at the other)

30 Complexity of Euler Circuit Algorithm for a connected graph Let “selecting an edge” be a basic operation. Since e edges, complexity is O(e) For graph with n vertices, what is max e for any given vertex? e <= ½ n (n-1) = ½ (n 2 – n)  O(n 2 ) What about a multigraph?

31 Hamiltonial Cycles & Paths Hamiltonian Path: Path containing each vertex of a graph exactly once Hamiltonian Cycle: Cycle containing each vertex of a graph exactly once Figures 4.1 (154) & 4.22 (172)

32 Existence of Hamiltonian Cyles & Paths Unsolved Problem: necessary & sufficient conditions for Hamiltonian Cycle & Path Hard to find even if know of existence Theorem 4.6 S’pose G is a graph with n >2 vertices. If each pair of non-adjacent vertices U & V satisfy deg(U) + deg(V) >= n then G has a Hamiltonian Cycle.

33 Extension of Theorem 4.6 Existence of Hamiltonial Cycle S’pose graph G has n vertices and every vertex has degree >= n/2. G has a Hamiltonial Cycle. WHY??? But still have no algorithm for finding it.

34 More on Theorem 4.6 Failing Theorem 5.6 does not mean a Hamiltonian Cycle does not exist. None of non-adjacent vertices have degree n/2, but Hamiltonian Cycle exists

35 Homework Section 4.2 Page Problems 1 – 29, 35 – 38, 60 Rest of chapter in separate file