0% found this document useful (0 votes)
22 views31 pages

Chapter5 GFQR1045

Uploaded by

hamoeren
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views31 pages

Chapter5 GFQR1045

Uploaded by

hamoeren
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Chapter 5

Traffic Flow
Improving Traffic Flow

Suppose the following graph represents certain sections of the


street systems in Kowloon City.

The vertices represent the road junctions, and the edges


represent roads.

Each road is two-way in the sense that, for example, one can go
from A to B and also from B to A etc.
Improving Traffic Flow
• The problem is to improve the traffic flow, due to possibly
increase of vehicles, peak hours, or many cars parking on the
left-hand side of the road.

• Improving traffic flow can help reduce the waste of energy and
air pollution.

• One possible solution is to make the streets one-way, instead of


two-way. We need to ensure that every place, or every road
junction, can be reached after making the streets one-way,
which is the so-called one-way street problem.

In this chapter we see how graphs can be used to solve this


problem.
Connectivity of Multigraphs
Definition
Let G be a multigraph.
• Two vertices u and v are said to be connected if there exists a
path from u to v (or from v to u).
• G is said to be connected if every pair of vertices is
connected.
• If G is not connected, then it is said to be disconnected.
Example
Bridges

Definition

Let G be a connected multigraph. An edge e of G is called a


bridge if G\e, which is the multigraph obtained by removing
the edge e from G, is disconnected.

Example

There is NO bridge in the following graph.


Example of Bridges
In the following graph,

the edges BD, AH, FG and AG are the only bridges.


Bridges
The following theorem gives a characterization of bridges.
Theorem A
Let G be a connected multigraph. An edge e of G is a bridge if
and only if e is not contained in any cycle in G.

Note that
• we use ⇔ to denote “if and only if” and it means implication
goes both ways.
• Statement P ⇔ statement Q means P implies Q and Q implies
P.
• E.g. you are 18+ citizen ⇔ you are eligible to vote.
• Not ⇔, e.g. you are 18+ ⇒ you are 15+. This implication is
NOT reversible.
Bridges
The following arguments tell you why the theorem holds.

➢ An edge e of G is a bridge ⇒ e is not contained in any cycle in G.


• Suppose e=AB is a bridge in G
• Then G\e is disconnected by definition
• This implies there is no path joining A and B in G\e
• Therefore e is not contained in any cycle in G

➢ An edge e of G is a bridge ⇐ e is not contained in any cycle in G.


• Suppose e=AB is an edge not contained in any cycle
• If e is NOT a bridge, then G\e is connected
• Since A and B are vertices of G\e that are joined by a path P in G\e
• Thus the path P and e form a cycle in G, contradiction.
Orientation of Multigraphs
Once an edge is assigned a direction, for example

we are allowed to go from A to B, but we are NOT allowed to


go from B to A.
Definition
Let G be a multigraph.
• An orientation of G is an assignment of exactly one direction
to each edge of G.
• An orientation of G is said to be strong if every pair of
vertices of G are mutually reachable via directed paths.

Two vertices A and B are mutually reachable means we can go


from A to B and also from B to A via (possibly different)
directed paths.
Example of Strong Orientation
Consider the following graph G.

The assignment of arrows on the edges as shown below form a


strong orientation of G.
Example of Strong Orientation
How can we check that the following arrows form a strong
orientation?

We can draw the above graph as follows. Then it is easy to see


that any pair of vertices are mutually reachable.
Example of Strong Orientation
However, the following arrows on the edges only form an
orientation of G, but not a strong orientation of G.

For example, there is no path from C to B, and from D to A, B, E


and F respectively.
Improving Traffic Flow via Graphs
Thus our solution for improving traffic flow, namely, turning all
two-way streets into one-way streets and ensuring every place is
still reachable, becomes the following problem.
Under what condition(s) can a connected multigraph G have a
strong orientation?
Robbin’s Theorem
A connected multigraph has a strong orientation if and only if it
contains no bridges.

By Theorem A (pg. 7) and Robbin’s theorem we have a good way to


determine which multigraph has a strong orientation, i.e.
• a connected multigraph has a strong orientation if each edge
belongs to a cycle, or
• a connected multigraph does not have a strong orientation if it
contains a bridge.
Example of Determining the Existence of
Strong Orientation

• The graph on the right has a strong orientation since each


edge belongs to a cycle.

• The graph on the left does NOT have a strong orientation


since there is a bridge.
Spanning Trees
Although Robbin’s Theorem tells us a connected multigraph
has a strong orientation if and only if it has no bridges, it does
NOT tell us how to find a strong orientation if it exists.

To find a strong orientation we make use of a special kind of


graphs, called spanning tree.

Definition
Let G be a multigraph.
• A subgraph H of G is said to be spanning if all vertices of G
are also vertices of H.
• A graph is called a tree if it is connected and does not contain
any cycle.
• A subgraph H of G is called a spanning tree of G if H is
spanning and is a tree.
Examples of Spanning Subgraphs and Trees
Equivalently, a spanning subgraph of G is obtained by keeping
all the vertices of G and removing some of the edges of G.

• Let G be the graph on the left. The graph on the right is a


subgraph of G but NOT a spanning subgraph of G.
Examples of Spanning Subgraphs and Trees
Let G be the graph on the left. The graph on the right is a
spanning subgraph of G but NOT a tree.
Examples of Spanning Subgraphs and Trees
Let G be the graph on the left. The graph on the right is a tree
and a subgraph of G, but NOT a spanning subgraph of G.
Examples of Spanning Tree
Let G be the graph on the left. The graph on the right is a
spanning tree of G.
Trees
Theorem
A connected multigraph G with n vertices and m edges is a
tree if and only if m = n− 1.

• The above theorem says a connected multigraph is a tree


when the number of edges is one less than the number of
vertices.
• This theorem gives an easy way to check whether a graph
is a tree or not.
• For example, the graph on the right of page 18 has 6
vertices and 5 edges. Thus it is a tree. The graph on the
right of page 19 has 7 vertices and 6 edges, so it is also a
tree.
Spanning Trees
After all these examples, you may wonder when does a
spanning tree exist? If it exists, how to find them?
• The answer to the first question is given by the following
theorem.

Theorem
A multigraph G contains a spanning tree if and only if G is
connected.

• Henceforth we only consider finding spanning trees in


connected multigraphs.
• The answer to the second question is given by the depth-
first search (DFS) algorithm.
DFS Algorithm
The DFS algorithm produces a spanning tree of connected multigraphs
and a labelling of the vertices.

Let G be a connected graph and the DFS algorithm is given as follows.


1. Pick any vertex v1 of G, and label it by 1.
2. If there are unlabelled vertices of G that are adjacent to v1 (labelled
as 1 in the previous step), pick anyone of them, say v2 , and label it
by 2. Record the edge v1 v2 .
3. Apply Step 2 to v2 , and so on.
4. Suppose Step 2 is applied to vj and all vertices adjacent to vj are
labelled, apply Step 2 to vj−1 . If all vertices adjacent to vj−1 are
labelled, apply Step 2 to vj−2 , and so on.
5. If all vertices of G are labelled, stop.

The collection of edges given by the DFS algorithm is a spanning tree


of G. The resulting labelling of the vertices is called a DFS labelling.
Example of Finding Spanning Tree Using
DFS Algorithm
We find a spanning tree of the following connected graph G.

For the first step, let choose the vertex on the top left-hand
corner, and label it by “1”.
Example of Finding Spanning Tree Using
DFS Algorithm
There are two vertices adjacent to ‘1’ that are unlabelled. Pick
anyone of them, say the right one, and label it by ‘2’.

There are two vertices adjacent to ‘2’ that are unlabelled. Pick
anyone of them, say the bottom one, and label it by ‘3’.
Example of Finding Spanning Tree Using
DFS Algorithm
There are two vertices adjacent to ‘3’ that are unlabelled. Pick
anyone of them, say the left one, and label it by ‘4’.

Since there are no unlabelled vertices adjacent to ‘4’, go back


to the previously labelled vertex ’3’, and there is only
unlabelled vertex adjacent to ‘3’ (the right one). Label it by
‘5’.
Example of Finding Spanning Tree Using
DFS Algorithm
Finally there is only one unlabelled vertex adjacent to ‘5’.
Label it by ‘6’.

The collection of red edges is a spanning tree of the graph G.


Finding Strong Orientation
• Now we can finally solve the one-way street problem. Recall
from Robbin’s theorem that a connected multigraph has a
strong orientation if and only if it does not contain any bridge.
• Suppose we have a connected bridgeless multigraph. Then
finding a strong orientation is relatively easy with the use of
spanning tree.

Let G be a connected bridgeless multigraph.


1. Find a spanning tree of G, say T, and the resulting DFS
labelling using the DFS algorithm.
2. For each edge in T, orient it from the smaller label to the
larger label.
3. For each edge in G but not in T, orient it from the larger label
to the smaller label.

The resulting orientation of G is a strong orientation.


Example of Finding Strong Orientation
We find a strong orientation of the following connected
bridgeless graph G.

First of all we find a spanning tree of G by the DFS


algorithm.
Example of Finding Strong Orientation
One spanning tree of G is given by all the vertices and
the collection of red edges.

Then a strong orientation of G is given by


Example of Finding Strong Orientation
Another spanning tree of G is given by all the vertices
and the collection of red edges.

Then a strong orientation of G is given by


Example of Finding Strong Orientation

In particular, the previous graph can be drawn as

You might also like