Chapter5 GFQR1045
Chapter5 GFQR1045
Traffic Flow
Improving Traffic Flow
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.
Definition
Example
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.
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.
Theorem
A multigraph G contains a spanning tree if and only if G is
connected.
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’.