2
3.1 The figure below gives the
pre
and
post
numbers of the vertices in parentheses. The tree and back
edges are marked as indicated.
A
B
C
D
E
F
G
H
I
(1,12)
(2,11)
(3,10)
(4,9)
(7,8)
(15,16)
(14,17)
(13,18)
(5,6)
Tree Edge
Back Edge
3.2 The figure below shows
pre
and
post
numbers for the vertices in parentheses.
Different edges are
marked as indicated.
A
B
C
D
E
F
G
H
(1,16)
(2,11)
(4,5)
(7,8)
(3,10)
(13,16)
(12,15)
(6,9)
Tree Edge
Cross Edge
Back Edge
Forward Edge
A
B
C
D
E
F
G
H
(1,16)
(2,15)
(3,14)
(4,13)
(5,12)
(6,11)
(7,10)
(8,9)
(a)
(b)
3.3
(a) The figure below shows the
pre
and
post
times in parentheses.
(1,14)
(15,16)
(2,13)
(3,10)
(11,12)
(4,9)
(5,6)
(7,8)
A
B
C
D
E
F
G
H
(b) The vertices
A, B
are sources and
G, H
are sinks.
(c) Since the algorithm outputs vertices in decreasing order of
post
numbers, the ordering given is
B, A, C, E, D, F, H, G
.
(d) Any ordering of the graph must be of the form
{
A, B
}
, C,
{
D, E
}
, F,
{
G, H
}
, where
{
A, B
}
indi-
cates
A
and
B
may be in any order within these two places. Hence the total number of orderings
is 2
3
= 8.
3.4
(i) The strongly connected component found first is
{
C, D, F, G, H, I, J
}
followed by
{
A, B, E
}
.
{
C, D, F, G, H, I, J
}
is a source SCC, while
{
A, B, E
}
is a sink SCC. The metagraph is shown
in the figure below. It is easy to see that adding 1 edge from any vertex in the sink SCC to a
vertex in the source SCC makes the graph strongly connected.
(ii) The strongly connected components are found in the order
{
D, F, G, H, I
}
,
{
C
}
,
{
A, B, E
}
.
{
A, B, E
}
is a source SCC, while
{
D, F, G, H, I
}
is a sink.
Also, in this case adding one edge
from any vertex in the sink SCC to any vertex in the source SCC makes the metagraph strongly
connected and hence the given graph also becomes strongly connected.