Graph Theory: Applications and Algorithms

Similar documents
An Introduction to Graph Theory

Graphs. Pseudograph: multiple edges and loops allowed

6.2. Paths and Cycles

Graphs. Introduction To Graphs: Exercises. Definitions:

Chapter 1 Graph Theory

Graph Theory. Part of Texas Counties.

Discrete Mathematics (2009 Spring) Graphs (Chapter 9, 5 hours)

GRAPHS, GRAPH MODELS, GRAPH TERMINOLOGY, AND SPECIAL TYPES OF GRAPHS

CS 441 Discrete Mathematics for CS Lecture 26. Graphs. CS 441 Discrete mathematics for CS. Final exam

Introduction III. Graphs. Motivations I. Introduction IV

CS 311 Discrete Math for Computer Science Dr. William C. Bulko. Graphs

Math/Stat 2300 Modeling using Graph Theory (March 23/25) from text A First Course in Mathematical Modeling, Giordano, Fox, Horton, Weir, 2009.

Trees Rooted Trees Spanning trees and Shortest Paths. 12. Graphs and Trees 2. Aaron Tan November 2017

v V Question: How many edges are there in a graph with 10 vertices each of degree 6?

Basics of Graph Theory

Dijkstra s Algorithm. Dijkstra s algorithm is a natural, greedy approach towards

The University of Sydney MATH 2009

Mathematics and Statistics, Part A: Graph Theory Problem Sheet 1, lectures 1-4

Adjacent: 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.

Graph Theory S 1 I 2 I 1 S 2 I 1 I 2

Graph and Digraph Glossary

Discrete Mathematics, Spring 2004 Homework 8 Sample Solutions

Elements of Graph Theory

The University of Sydney MATH2969/2069. Graph Theory Tutorial 2 (Week 9) 2008

Topic 10 Part 2 [474 marks]

Ordinary Differential Equation (ODE)

Module 2: NETWORKS AND DECISION MATHEMATICS

Graph (1A) Young Won Lim 4/19/18

Further Mathematics 2016 Module 2: NETWORKS AND DECISION MATHEMATICS Chapter 9 Undirected Graphs and Networks

Math.3336: Discrete Mathematics. Chapter 10 Graph Theory

Solving problems on graph algorithms

Math 170- Graph Theory Notes

Let 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.

Discrete mathematics II. - Graphs

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points

Section 8.2 Graph Terminology. Undirected Graphs. Definition: Two vertices u, v in V are adjacent or neighbors if there is an edge e between u and v.

4 Basics of Trees. Petr Hliněný, FI MU Brno 1 FI: MA010: Trees and Forests

Trees and Tree Encodings

Discrete Mathematics for CS Spring 2008 David Wagner Note 13. An Introduction to Graphs

More NP-complete Problems. CS255 Chris Pollett May 3, 2006.

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.

r=1 The Binomial Theorem. 4 MA095/98G Revision

Algorithms. Graphs. Algorithms

Foundations of Discrete Mathematics

2. CONNECTIVITY Connectivity

INTRODUCTION TO GRAPH THEORY. 1. Definitions

MATH 363 Final Wednesday, April 28. Final exam. You may use lemmas and theorems that were proven in class and on assignments unless stated otherwise.

Outline. Introduction. Representations of Graphs Graph Traversals. Applications. Definitions and Basic Terminologies

Week 8: The fundamentals of graph theory; Planar Graphs 25 and 27 October, 2017

Module 1. Preliminaries. Contents

Hypercubes. (Chapter Nine)

DS UNIT 4. Matoshri College of Engineering and Research Center Nasik Department of Computer Engineering Discrete Structutre UNIT - IV

γ(ɛ) (a, b) (a, d) (d, a) (a, b) (c, d) (d, d) (e, e) (e, a) (e, e) (a) Draw a picture of G.

SDSU CS 662 Theory of Parallel Algorithms Networks part 2

Computational Discrete Mathematics

MAT 7003 : Mathematical Foundations. (for Software Engineering) J Paul Gibson, A207.

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

Ma/CS 6b Class 5: Graph Connectivity

Graph Overview (1A) Young Won Lim 5/9/18

CHAPTER 2. Graphs. 1. Introduction to Graphs and Graph Isomorphism

Algorithms: Graphs. Amotz Bar-Noy. Spring 2012 CUNY. Amotz Bar-Noy (CUNY) Graphs Spring / 95

14 More Graphs: Euler Tours and Hamilton Cycles

CS 341: Algorithms. Douglas R. Stinson. David R. Cheriton School of Computer Science University of Waterloo. February 26, 2019

Worksheet for the Final Exam - Part I. Graphs

Math 776 Graph Theory Lecture Note 1 Basic concepts

Graphs and Trees. An example. Graphs. Example 2

Graphs. The ultimate data structure. graphs 1

Symmetric Product Graphs

Math Summer 2012

Sparse Hypercube 3-Spanners

Definition: A graph G = (V, E) is called a tree if G is connected and acyclic. The following theorem captures many important facts about trees.

3 Euler Tours, Hamilton Cycles, and Their Applications

Homework Assignment #3 Graph

Fundamental Properties of Graphs

Varying Applications (examples)

4. (a) Draw the Petersen graph. (b) Use Kuratowski s teorem to prove that the Petersen graph is non-planar.

CS6702 GRAPH THEORY AND APPLICATIONS 2 MARKS QUESTIONS AND ANSWERS

The Fibonacci hypercube

Graphs and networks Mixed exercise

Elementary maths for GMT. Algorithm analysis Part II

Key Graph Theory Theorems

Two Characterizations of Hypercubes

Domination, Independence and Other Numbers Associated With the Intersection Graph of a Set of Half-planes

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note 8

Practice Final Exam 1

Exercises for Discrete Maths

Graphs (MTAT , 6 EAP) Lectures: Mon 14-16, hall 404 Exercises: Wed 14-16, hall 402

Chapter 3: Paths and Cycles

List Colouring Squares of Planar Graphs

Routing in Unidirectional (n, k)-star graphs

Introduction to Graph Theory

Algorithm Analysis Graph algorithm. Chung-Ang University, Jaesung Lee

(5.2) 151 Math Exercises. Graph Terminology and Special Types of Graphs. Malek Zein AL-Abidin

Assignments are handed in on Tuesdays in even weeks. Deadlines are:

Week 9: Planar and non-planar graphs. 1st and 3rd of November, 2017

Lecture 4: Bipartite graphs and planarity

Today. Types of graphs. Complete Graphs. Trees. Hypercubes.

CS6702 GRAPH THEORY AND APPLICATIONS QUESTION BANK

Chapter 2: Graph Theory

Lecture 1: Examples, connectedness, paths and cycles

Transcription:

Graph Theory: Applications and Algorithms CIS008-2 Logic and Foundations of Mathematics David Goodwin david.goodwin@perisic.com 11:00, Tuesday 21 st February 2012

Outline 1 n-cube 2 Gray Codes 3 Shortest-Path Algorithm 4 Mesh Model

Outline 1 n-cube 2 Gray Codes 3 Shortest-Path Algorithm 4 Mesh Model

The n-cube (Hypercube) Serial Computers execute one instruction at a time. Standard definition of an algorithm assumes one instruction is exectuted at a time, and is called a serial algorithm. Parallel computers execute several instructions at a time, and their associated algorithms are parallel algorithms. Graphs are convenient models for parallel computation, and one model for this is known as the n-cube or hypercube.

The n-cube (Hypercube) n-cube has 2 n processors, represented by vertices, labelled 0, 1,..., 2 n 1. Each processor has its own memory.

The n-cube (Hypercube) n-cube has 2 n processors, represented by vertices, labelled 0, 1,..., 2 n 1. Each processor has its own memory. An edge is drawn between two vertices if the binary representation of the labels differs in exactly one bit.

The n-cube (Hypercube) n-cube has 2 n processors, represented by vertices, labelled 0, 1,..., 2 n 1. Each processor has its own memory. An edge is drawn between two vertices if the binary representation of the labels differs in exactly one bit. During one time unit, all processors may execute an instructionsimultaneously, then communicate with an adjacent processor.

The n-cube (Hypercube) n-cube has 2 n processors, represented by vertices, labelled 0, 1,..., 2 n 1. Each processor has its own memory. An edge is drawn between two vertices if the binary representation of the labels differs in exactly one bit. During one time unit, all processors may execute an instructionsimultaneously, then communicate with an adjacent processor. To communicate with a non-adjacent processor, a message is sent that includes the route to and final destination of the recipient. It may take several time units to communicate with a non-adjacent processor.

The n-cube (Hypercube) The 1-cube has two vertices (processors), labelled 0 and 1, and one edge. We draw two (n 1)-Cubes, whose vertices are labelled in binary. We place an edge between vertices with identical labels. We then place an additional character at the beginning of each of the two graphs, 0 at the front of one, and 1 at the font of the other s labels. Here we obtain an n-cube from two (n 1)-Cubes. 0 1 Graph of 1-cube 0 1 0 1 Connecting two 1-cubes 10 11 00 01 Graph of 2-cube

Outline 1 n-cube 2 Gray Codes 3 Shortest-Path Algorithm 4 Mesh Model

Gray codes and Hamiltonian cycles in the n-cube Consider a ring model for parallel computation, represented as a graph is a simple cycle. Each processor can communicate directly with two other processors. The n-cube model has a greater degree of connectivity between vertices. If the n-cube contains a Hamiltonian cycle, we must have n 2, since the 1-Cube has no cycles. Ring model

Gray Codes The n-cube has a Hamiltonian cycles if and only if n 2 and there is a sequence, s 1, s 2,..., s 2 n where each s i is a string of n bits satisfying: Every n-bit string appears somewhere in the sequence. s i and s i+1 differ in exactly one bit. s 2 n and s 1 differ in exactly one bit. This type of sequence is called a Gray code, and corresponds to a Hamiltonain cycle. Gray codes have been studied extensively, an example being converting analog to digital signal. The Gray code for n = 1 is 0, 1 and corresponds to the path (0, 1, 0), which is not a cycle since the edge (0, 1) is repeated.

Constructing Gray codes Let G 1 denote the sequence 0, 1, we define G n by G n 1 by the following rules: 1 Let G R n 1 denote the sequence G n 1 in reverse. 2 Let G n 1 denote the sequence obtained by prefixing each member of G n 1 with 0. 3 Let G n 1 denote the sequence obtained by prefixing each member of G n 1 with 1. 4 Let G n be the sequence consisting of G n 1 followed by G n 1 Then G n is a Gray code for every positive integer n. Theorem The n-cube has a Hamiltonian cycle for every positive integer n 2.

Outline 1 n-cube 2 Gray Codes 3 Shortest-Path Algorithm 4 Mesh Model

Dijkstra s Shortest Path Algorithm The aim is to find the shortest path (having the minimum length) between any two vertices, a and z, of a connected, weighted graph, G. Dijkstra s Algorithm involves assigning lables to vertices. Let L(u) denote the label of vertex v. At any point, some vertices have temporary labels and the rest have permanent labels. Let t denote the set of vertices with temporary labels. Initially, all vertices have temporary labels. Each iteration of the algorithm changes the status of one label to permanent. The algorithm terminates when z recieves a permanent label, then L(z) gives the length of the shortest path from a to z.

Input: A connected, weighted graoh in which all weights are positive; vertices a and z. Output: L(z), the length of a shortest path from a to z. 1 dijkstra (w, a, z, L){ 2 L(a) = 0 3 for all vertices x a 4 L(x) = 5 T = set of all vertices 6 // T is the set of all vertices whose shortest distance has not been found 7 while(z T ){ 8 chose v T with minimum L(v) 9 T = T {v} 10 for each x T adjacent to v 11 L(x) = min{l(x), L(v) + w(v, x)} 12 } 13 }

Path length and the Adjacency matrix Theorem If A is the adjacency matrix of a simple graph, the ij th entry of A n is equal to the number of paths of length n from vertex i to vertex j, n = 1, 2,....

Outline 1 n-cube 2 Gray Codes 3 Shortest-Path Algorithm 4 Mesh Model

Isomorphisms of Graphs Graphs G 1 and G 2 are isomorphic if there is a one-to-one, onto function f from the vertices of G 1 to the vertices of G 2 and a one-to-one, onto function g from the edges of G 1 to the edges of G 2. So the edge e is incident on v and w in G 1 if and only if the edge g(e) is incident on f (v) and f (w) in G 2. The pair of functions g and f is called an isomorphism of G 1 onto G 2.

The Mesh Model for Parallel Computation 2-D mesh model described as a graph consisting a rectangular array of vertices connected by edges to their nearest neighbour. Let M be a mesh p vertices by q vertices, where p 2 i and q 2 j. As co-ordinates for the mesh, we use the Gray codes. The co-ordinates in the horizonatal direction are the first p member of an i-bit Gray code. The co-ordinates in the vertical direction are the first q member of an j-bit Gray code. Mesh Model EXERCISE Show that the mesh M, with p by q vertices (p 2 i and q 2 j ) has an isomorphism to a subgraph contained in the (i + j)-cube.