© J. Christopher Beck 20081 Lecture 5: Graph Theory and Longest Paths.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

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.
Section 14.1 Intro to Graph Theory. Beginnings of Graph Theory Euler’s Konigsberg Bridge Problem (18 th c.)  Can one walk through town and cross all.
Introduction This chapter explores graphs and their applications in computer science This chapter explores graphs and their applications in computer science.
Data Structures Using C++
BY: MIKE BASHAM, Math in Scheduling. The Bridges of Konigsberg.
Management Science 461 Lecture 2b – Shortest Paths September 16, 2008.
Graph Theory. What is Graph Theory? This is the study of structures called ‘graphs’. These graphs are simply a collection of points called ‘vertices’
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
A Presentation By: Jillian Minuto Troy Norman Alan Leggett Group Advisor: Prof. G. Warrington Graph Theory.
Graphs Intro G.Kamberova, Algorithms Graphs Introduction Gerda Kamberova Department of Computer Science Hofstra University.
© J. Christopher Beck Lecture 4: Project Planning 1.
Representing Graphs Wade Trappe. Lecture Overview Introduction Some Terminology –Paths Adjacency Matrix.
Introduction to Networks HON207. Graph Theory In mathematics and computer science, graph theory is the study of graphs, mathematical structures used to.
W. D. Grover TRLabs & University of Alberta © Wayne D. Grover 2002, 2003 Graph theory and routing (initial background) E E Lecture 4.
Graphs. Graph A “graph” is a collection of “nodes” that are connected to each other Graph Theory: This novel way of solving problems was invented by a.
Euler and Hamilton Paths
Chapter 11 Graphs and Trees This handout: Terminology of Graphs Eulerian Cycles.
22C:19 Discrete Math Graphs Spring 2014 Sukumar Ghosh.
Graphs and Euler cycles Let Maths take you Further…
Eulerian Graphs CSE 331 Section 2 James Daly. Reminders Project 3 is out Covers graphs Due Friday.
Euler Paths and Circuits. The original problem A resident of Konigsberg wrote to Leonard Euler saying that a popular pastime for couples was to try.
The Bridge Obsession Problem By Vamshi Krishna Vedam.
Theory of Computing Lecture 10 MAS 714 Hartmut Klauck.
Chapter 2 Graph Algorithms.
Graph Theory Topics to be covered:
© Nuffield Foundation 2011 Nuffield Free-Standing Mathematics Activity Chinese postman problems What route can I take to avoid going along the same street.
Euler and Hamilton Paths
Chinese postman problem
Structures 7 Decision Maths: Graph Theory, Networks and Algorithms.
Can you connect the dots as shown without taking your pen off the page or drawing the same line twice.
Euler and Hamilton Paths. Euler Paths and Circuits The Seven bridges of Königsberg a b c d A B C D.
Data Structures & Algorithms Graphs
L – Modelling and Simulating Social Systems with MATLAB Lesson 6 – Graphs (Networks) Anders Johansson and Wenjian Yu (with S. Lozano.
Lecture 14: Graph Theory I Discrete Mathematical Structures: Theory and Applications.
CSS106 Introduction to Elementary Algorithms
Aim: What is an Euler Path and Circuit?
Topics Paths and Circuits (11.2) A B C D E F G.
1.5 Graph Theory. Graph Theory The Branch of mathematics in which graphs and networks are used to solve problems.
Discrete Mathematical Structures: 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.
Graphs and 2-Way Bounding Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois 1 /File:7_bridgesID.png.
Associated Matrices of Vertex Edge Graphs Euler Paths and Circuits Block Days April 30, May 1 and May
Graph theory and networks. Basic definitions  A graph consists of points called vertices (or nodes) and lines called edges (or arcs). Each edge joins.
Euler Paths and Circuits. The original problem A resident of Konigsberg wrote to Leonard Euler saying that a popular pastime for couples was to try.
Eulerian Paths and Cycles. What is a Eulerian Path Given an graph. Find a path which uses every edge exactly once. This path is called an Eulerian Path.
MAT 2720 Discrete Mathematics Section 8.2 Paths and Cycles
The Seven Bridges of Konigsberg (circa 1735) In Konigsberg, Germany, a river ran through the city such that in its centre was an island, and after passing.
Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler.
Chapter 6: Graphs 6.1 Euler Circuits
Review Euler Graph Theory: DEFINITION: A NETWORK IS A FIGURE MADE UP OF POINTS (VERTICES) CONNECTED BY NON-INTERSECTING CURVES (ARCS). DEFINITION: A VERTEX.
M Clements Formal Network Theory. Introduction Practical problem – The Seven Bridges of Königsberg Network graphs Nodes & edges Degrees Rules/ axioms.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
1) Find and label the degree of each vertex in the graph.
Graph Theory Euler Paths and Euler Circuits. Euler Paths & Circuits Euler Paths and Euler Circuits (Euler is pronounced the same as Oiler) An Euler path.
STARTER: CAN YOU FIND A WAY OF CROSSING ALL THE BRIDGES EXACTLY ONCE? Here’s what this question would look like drawn as a graph.
Data Structures Graphs - Terminology
Graph theory. Graph theory Leonard Euler (“Oiler”)
Graphs: As a mathematics branch
Discrete Maths 9. Graphs Objective
This unit is all about Puzzles Games Strategy.
Introduction to Graph Theory Euler and Hamilton Paths and Circuits
Modeling and Simulation NETW 707
Graphs Chapter 13.
Konigsberg- in days past.
Euler and Hamilton Paths
GRAPHS G=<V,E> Adjacent vertices Undirected graph
Chapter 10 Graphs and Trees
Presentation transcript:

© J. Christopher Beck Lecture 5: Graph Theory and Longest Paths

© J. Christopher Beck Outline What is Graph Theory? Graph Theory Basics Finding the Longest Path Why? (modeling) How

© J. Christopher Beck Readings Gibbons, Algorithmic Graph Theory, Cambridge University Press, 1985 Sedgewick, Algorithms in C++, 3 rd Edition, 2002 Wikipedia (“Graph Theory”), accessed August 12, 2008

© J. Christopher Beck The Bridges of Konigsberg Can you walk a route that crosses each bridge exactly once? Euler, 1736 Islands Bridges

© J. Christopher Beck The Bridges of Konigsberg Node or vertex Edge or arc

© J. Christopher Beck The Bridges of Konigsberg So, now the problem is: can you traverse every edge exactly once? Any ideas?

© J. Christopher Beck Graph Theory Nodes and edges form a graph, G(V,E), with V being the set of nodes, E being the set of edges Edges may be directed or un-directed Edges may have a weight Just a number associated with each edge

© J. Christopher Beck Graph Theory Graph theory is the secret to the universe A tremendous number of problems can be modeled and solved using graph theory OR, epidemiology, geometry, IT (the web is a graph), social networks, biological pathways, chemical reactions, …

© J. Christopher Beck CPM Can we pose this as a graph theory problem? Why would we want to?

© J. Christopher Beck CPM Model Job  Node Precedence  Directed Edge Processing time  Edge Weight (This is the job-on-arc format: P p. 52)

© J. Christopher Beck Our Small Example What are we missing?

© J. Christopher Beck Dummy Nodes Two dummy nodes (0 and n+1) 3

© J. Christopher Beck Makespan? How do we find the makespan? Critical Path?

© J. Christopher Beck Initialize Nodes & Queue class Node { public int label; public int numPredecessors; public int head; }; // initialize Nodes.label and numPredecessors // from input data. head = 0 Node node0 = initial dummy node Node nodeLast = final dummy node queue.push(node0);

© J. Christopher Beck Process Each Node while(!queue.empty()) { Node n = queue.pop(); for each e = out-going edge of n Node next = e.getOtherNode(n); if (n.head + e.weight > next.head) next.head = n.head + e.weight; --next.numPredecessors; if (next.numPredecessors == 0) queue.push(next); } After executing this, where is the makespan?

© J. Christopher Beck Critical Path How would you modify this algorithm to also allow you to find a critical path?

© J. Christopher Beck Add a Field class Node { public int label; public int numPredecessors; public int head; public Node criticalPredecessor; };

© J. Christopher Beck Add a Line while(!queue.empty()) { Node n = queue.pop(); for each e = out-going edge of n Node next = e.getOtherNode(n); if (n.head + e.weight > next.head) next.head = n.head + e.weight; next.criticalPredecessor = n; --next.numPredecessors; if (next.numPredecessors == 0) queue.push(next); } Then follow the criticalPredecessor links from nodeLast back to node0. Does this form of algorithm (i.e., use of criticalPredecessor) remind you of anything?

© J. Christopher Beck Example Jobs pjpj Model and solve using a graph

© J. Christopher Beck The Bridges of Konigsberg So, now the problem is: can you traverse every edge exactly once? Any ideas? Hint: The degree of a node is the number of its edges. Think about the degrees of the nodes in any path.