MTH118

19
MTH118 Sanchita Mal-Sarkar

description

MTH118. Sanchita Mal-Sarkar. Routing Problems. The fundamental questions: Is there any proper route for the particular problem? If there are many possible routes, which one is the best (cost, distance, or time)?. Routing Problems. Examples: Mail delivery Garbage collection - PowerPoint PPT Presentation

Transcript of MTH118

Page 1: MTH118

MTH118

Sanchita Mal-Sarkar

Page 2: MTH118

Routing Problems

The fundamental questions:

• Is there any proper route for the particular problem?

• If there are many possible routes, which one is the best (cost, distance, or time)?

Page 3: MTH118

Routing Problems

Examples:

• Mail delivery

• Garbage collection

• Newspaper delivery

• Internet access

Page 4: MTH118

Graphs

• Graph is a picture consisting of – Dots (called vertices)– Lines (called edges)

• Edges do not have to be straight lines

• Edges have to connect two vertices

• When an edge connects a vertex back with itself, then it is called a loop.

Page 5: MTH118

Examples of graphs

A B

C D

A

B

C

D Graph 1

Graph 2

Page 6: MTH118

Graph represents a relationship

Ron John

Bob Ruben

Edge represents “brother of ”

Page 7: MTH118

Adjacent vertices/edgesTwo vertices are adjacent if there is an edge joining them.Two edges are adjacent if they share a common vertex.

Vertices A and C are adjacent verticesAD and AC are adjacent edges

Page 8: MTH118

Degree of a vertex

deg(A) = 2, deg(B) = 1, deg(C) = 5, deg(D) = 5, deg(E) = 3

Page 9: MTH118

Paths

Vertex can appear on the path more than one.Edge cannot appear on the path more than once

A sequence of vertices so that each vertex in the sequence is adjacent to the next one

E, D, C, A. => A path from vertex E to vertex AE, D, C, D, A => Not a path because the edge DC

appears twice

Page 10: MTH118

CircuitsA path that starts and ends at the same vertex.

A, C, D, A => A circuit of length 3

Page 11: MTH118

Connected graphA graph is connected if it is possible to travel from any vertex to any other vertex along consecutive edges of the graphDisconnected => If it is not connected

Graph1, Graph4 => Connected Graph 2, Graph 3 => Disconnected

Page 12: MTH118

BridgeAbsence of the bridge (edge) will disconnect the graph

BD is a bridge

Page 13: MTH118

Euler PathsA path that travels through every edge of a graph.Edges can be traveled once since it is a pathTravel every edge 1) without lifting your pencil

2) without retracing any edge

R

A

L

D

No Euler paths

R

A

L

D

Several Euler pathsL,A, R, D, A, R, D, L, A

Page 14: MTH118

Euler circuitsA circuit that travels through every edge of a graphSame requirement as for an Euler path, as well asAdditional requirement: starting and ending vertex be the same.

A

B

C

D

E

F

Graph has Euler circuit

Page 15: MTH118

Euler Theorem 1• If a graph has many odd vertices, then it cannot have an

Euler circuit• If a graph is connected and every vertex is an even

vertex, then it has at least one Euler circuit (and usually more

A

B

C D

EGraph has no Euler circuit

Page 16: MTH118

Euler’s Theorem 2

• If a graph has more than two odd vertices, then it cannot have an Euler path.

• If a graph is connected and has exactly two odd vertices, then it has at least one Euler path (and usually more). Any such path must start at one of the odd vertices and end at the other one.

Page 17: MTH118

Euler Theorem 2

No Euler circuitBut, Euler path

No Euler circuitNo Euler path

Euler circuitEuler path

Page 18: MTH118

Euler’s Theorem 2

Euler circuitEuler path

No Euler circuitNo Euler path

No Euler circuitNo Euler path

No Euler circuitBut, Euler path

Page 19: MTH118

Euler’s Theorem 3• The sum of the degrees of all the vertices of a

graph equals twice the number of edges • A graph always has an even number of odd

vertices• A graph has seven vertices–two vertices of

degree 6, four vertices of degree 5, and one vertex of degree 2. The number of edges in the graph is  17.

• 2n = sum of the degree of all the vertices of a graph, n = no. of edges in the graph