Docsity

Paths and Connectivity, Lecture Notes - Computer Science, Study notes of Discrete Structures and Graph Theory

Partial preview of the text

Download Paths and Connectivity, Lecture Notes - Computer Science and more Study notes Discrete Structures and Graph Theory in PDF only on Docsity!

Paths and Connectivity

Zeph Grunschlag

Agenda

Paths

Connectivity

Paths

A path in a graph is a continuous way of getting from one vertex to another by using a sequence of edges.

EG: could get from 1 to 3 circuitously as follows:

1-e 1 2-e 1 1-e 3 3-e 4 2-e 6 2-e 5 2-e 4  3

1 2

3 4

e 1

e 3

e 2 e 4 e^5

e 6

e 7

Paths

A path in a graph is a continuous way of getting from one vertex to another by using a sequence of edges.

EG: could get from 1 to 3 circuitously as follows:

1- e 1 2-e 1 1-e 3 3-e 4 2-e 6 2-e 5 2-e 4  3

1 2

3 4

e 1

e 3

e 2

e 4 e^5

e 6

e 7

Paths

A path in a graph is a continuous way of getting from one vertex to another by using a sequence of edges.

EG: could get from 1 to 3 circuitously as follows:

1-e 1 2-e 1 1- e 3 3-e 4 2-e 6 2-e 5 2-e 4  3

1 2

3 4

e 1

e 3

e 2

e 4 e^5

e 6

e 7

Paths

A path in a graph is a continuous way of getting from one vertex to another by using a sequence of edges.

EG: could get from 1 to 3 circuitously as follows:

1-e 1 2-e 1 1-e 3 3- e 4 2-e 6 2-e 5 2-e 4  3

1 2

3 4

e 1

e 3

e 2

e 4 e^5

e 6

e 7

Paths

A path in a graph is a continuous way of getting from one vertex to another by using a sequence of edges.

EG: could get from 1 to 3 circuitously as follows:

1-e 1 2-e 1 1-e 3 3-e 4 2-e 6 2- e 5 2-e 4  3

1 2

3 4

e 1

e 3

e 2

e 4 e^5

e 6

e 7

Paths

A path in a graph is a continuous way of getting from one vertex to another by using a sequence of edges.

EG: could get from 1 to 3 circuitously as follows:

1-e 1 2-e 1 1-e 3 3-e 4 2-e 6 2-e 5 2- e 4  3

1 2

3 4

e 1

e 3

e 2

e 4 e^5

e 6

e 7

Paths

A: For simple graphs, any edge is unique

between vertices so listing the vertices

gives us the edge-sequence as well.

DEF: A simple path contains no

duplicate edges (though duplicate

vertices are allowed). A cycle (or circuit ) is a path which starts and ends

at the same vertex.

Note: Simple paths need not be in simple

graphs. E.g., may contain loops.

Paths

Q: Find a longest possible simple path in

the following graph:

1 2

3 4

e 1

e 3

e 2 e 4 e^5

e 6

e 7

Paths in Directed Graphs

One can define paths for directed graphs by insisting that the target of each edge in the path is the source of the next edge:

DEF: A path of length n in a directed graph is a

sequence of n edges e 1 , e 2 , … ,en such that

the target of ei is the source ei+1 for each i.

In a digraph, one may instead define a path

of length n as a sequence of n+1 vertices v 0 ,

v 1 , v 2 , … ,vn such that for each consecutive

pair vi , vi+1 there is an edge from vi to vi+.

Paths in Directed Graphs

Q: Consider digraph adjacency matrix:

  1. Find a path from 1 to 4.
  2. Is there a path from 4 to 1?





0 1 0 0

1 1 0 0

0 1 0 1

1 0 1 0

Paths in Directed Graphs

A:

  1. 1  3  2.
  2. There’s no path from 4 to 1. From 4

must go to 2, from 2 must stay at 2 or

return to 4. In other words 2 and 4 are

disconnected from 1.





0 1 0 0

1 1 0 0

0 1 0 1

1 0 1 0

Paths in Directed Graphs

A:

  1. 1  3  2 4.
  2. There’s no path from 4 to 1. From 4

must go to 2, from 2 must stay at 2 or

return to 4. In other words 2 and 4 are

disconnected from 1.





0 1 0 0

1 1 0 0

0 1 0 1

1 0 1 0