graph theory chapter 6 from johnsonbaugh article(6.1, 6.2)

26
Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Upload: jonas-scott

Post on 20-Jan-2016

230 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Graph Theory

Chapter 6 from JohnsonbaughArticle(6.1, 6.2)

Page 2: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

History

• History• Konisgsberg problem• Wyoming Inspectores problem

Page 3: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Konigsberg bridge problem

Page 4: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Solution to Konisgbers problem

• Presented by Euler• Representation of problem as a graph• Presence of Euler Cycle…??

Page 5: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Some applications of Graph Theory

• Models for communications and electrical networks

• Models for computer architectures(Manufacturing)

• Network optimization models for operations analysis, including scheduling and job assignment

• Analysis of Finite State Machines• Parsing and code optimization in compilers

Page 6: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Application to Ad Hoc Networking

• Networks can be represented by graphs• The mobile nodes are vertices• The communication links are edges

Vertices

Edges

• Routing protocols often use shortest path algorithms

Page 7: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Elementary Concepts

• A graph G(V,E) is two sets of objectVertices (or nodes) , set VEdges, set E

• A graph is represented with dots or circles (vertices) joined by lines (edges)

• The magnitude of graph G is characterized by number of vertices |V| (called the order of G) and number of edges |E| (size of G)

• The running time of algorithms are measured in terms of the order and size

Page 8: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Graphs: Examples • a

• c• d

• b

Let V={a,b,c,d} and E={{a,b},{a,c},{b,c},{c,d}}

Page 9: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Graphs ↔ NetworksGraph

(Network)Vertexes(Nodes)

Edges(Arcs)

Flow

Communications

Telephones exchanges, computers, satellites

Cables, fiber optics, microwave relays

Voice, video, packets

Circuits Gates, registers, processors Wires Current

Mechanical Joints Rods, beams, springs

Heat, energy

Hydraulic Reservoirs, pumping stations, lakes Pipelines Fluid, oil

Financial Stocks, currency Transactions Money

Transportation Airports, rail yards, street intersections

Highways, railbeds, airway routes

Freight, vehicles, passengers

Page 10: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Undirected Graph

2

4

31

V = { 1, 2, 3, 4}, | V | = 4E = {(1,2), (2,3), (2,4), (4,1)}, | E |=4

An edge e E of an undirected graph is represented as an unordered pair (u,v)=(v,u), where u, v V. Also assume that u ≠ v

Page 11: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Directed GraphAn edge e E of a directed graph is represented as an ordered pair (u,v), where u, v V. Here u is the initial vertex and v is the terminal vertex. Also assume here that u ≠ v

2

4

31

V = { 1, 2, 3, 4}, | V | = 4E = {(1,2), (2,3), (2,4), (4,1), (4,2)}, | E |=5

Page 12: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Definitions…• Parallel edge• Loop• Isolated vertex• Simple graph

Page 13: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Degree of a VertexDegree of a vertex in an undirected graph is the number of edges incident on it. In a directed graph, the out degree of a vertex is the number of edges leaving it and the in degree is the number of edges entering it

2

4

31

2

4

31

The degree of vertex 2 is 3 The in degree of vertex 2 is 2 and the in degree of vertex 4 is 1

Page 14: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Weighted GraphA weighted graph is a graph for which each edge has an associated weight, usually given by a weight function w: E R

2

4

31

2

4

31

1.2

2.1

0.2

0.5 4

8

6

2

9

Page 15: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Walks and Paths3

23

4

1

1

V5V4

V3V2

V1V6

4

1

A path is a sequences of edges that begins at a vertex of a graph and travels along edges of the graph always connecting pairs of adjacent vertices.

A simple cycle is an walk (v1, v2,..., vL) where v1=vL with no other nodes repeated and L>=3, e.g. (V1, V2,V5, V4,V1)

A simple path is a walk with no repeated nodes, e.g. (V1, V4,V5, V2,V3)

A graph is called cyclic if it contains a cycle; otherwise it is called acyclic

Page 16: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Definitions..

• Cycle(circuit)• Simple cycle• Length of a path

Page 17: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Similarity Graph

• Example 6.1.7• The n-cube hyperbola

Page 18: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Complete Graphs

A

D

C

B

4 nodes and (4*3)/2 edges

V nodes and V*(V-1)/2 edges

C

AB

3 nodes and 3*2 edges

V nodes and V*(V-1) edges

A complete graph is an undirected/directed graph in which every pair of vertices is adjacent. If (u, v ) is an edge in a graph G, we say that vertex v is adjacent to vertex u.

Page 19: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Connected GraphsA

D E F

B C

A B

C D

An undirected graph is connected if you can get from any node to any other by following a sequence of edges OR any two nodes are connected by a path

A directed graph is strongly connected if there is a directed path from any node to any other node

Page 20: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

• Subgraph• components

Page 21: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Bipartite GraphA bipartite graph is an undirected graphG = (V,E) in which V can be partitioned into 2 sets V1 and V2 such that ( u,v) E implies eitheru V1 and v V2 OR v V1 and u V2.

u1

u2

u3

u4

v1

v2

v3

V1 V2

An example of bipartite graph application to telecommunication problems can be found in, C.A. Pomalaza-Ráez, “A Note on Efficient SS/TDMA Assignment Algorithms,” IEEE Transactions on Communications, September 1988, pp. 1078-1082.

For another example of bipartite graph applications see the slides in the Addendum section

Page 22: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Euler cycle and Konigsberg problem

• Returning to Konigsberg Bridge problem• There will be no euler cycle if there are an odd

number of edges incident on vertex A• Theorem:”If a graph has an Euler cycle, then G is

connected and every vertex has even degree.• Theorem:” If G is a connected graph and every

vertex has even degree, then G has an Euler cycle

Page 23: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

• Theorem:” If G is a graph with m edges and vertices{v1, v2,……, v3} then

In particular, the sum of the degrees of all the vertices in a graph is even.

Page 24: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Euler Cycle

• How to find an Euler Cycle…..• Euler Path: “An Euler Path in G is a simple

path containing every edge in G”

Page 25: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Some theorems and corollaries about graphs

• Corollary: “In any graph, there are an even number of vertices of odd degree”

• Theorem:” A graph has a path with no repeated edges from v to w( v is not equal to w) containing all the edges and vertices if and only if it is connected and v and w are the only vertices having odd degree.

• Theorem:” If graph G contains a cycle from v to v, G contains a simple cycle from v to v.

Page 26: Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)

Announcements!!!!

• Assignment: Calculate the running time for Bubble Sort Algorithm

• Home Work: (Exercise 6.1 and 6.2 relevent questions)

• Quiz(in Next Lecture from todays lecture topics)