Algorithm Design and Analysis
Due Tuesday 25 October 2022
QQ1703105484
|
lars).
|
|
The purpose of this assignment is to develop useful graph tools for currency trading.
The assignment should include the following components, each with some suitable test examples:
|
|
|
|
The bridges can be found by first performing a depth first search of the undirected graph, labelling each vertex u with a counter d(u) as the vertex is discovered, and with a value m(u) as the search is finished with the
b |
f |
g |
k |
a |
c |
e |
j |
d |
h |
m |
i |
l |
vertex. The value m(u) is taken to be the smallest value between d(u), the values of m(v) found while visiting each adjacent currently black (child) vertex v, and the value of d(v) for any adjacent currently grey (already discovered) vertex v other than its parent u.
For example, if in the illustrated diagram a depth-first search starting at
a might visit the vertices in the following order:
v d(v) | a 0 | b 1 | c 2 | d 3 | e 4 | f 5 | g 6 | h 7 | i 8 | j 9 | k 10 | l 11 | m 12 |
and when finished with each vertex the following values of m(v) would be calculated:
v m(v) | a 0 | b 1 | c 1 | d 1 | e 4 | f 4 | g 4 | h 7 | i 8 | j 9 | k 9 | l 9 | m 9 |
An edge between u and v is a bridge if and only if it is included in the depth first tree from u to v and m(v) > d(u). (15 marks)
Demonstration of the programs with a 3-5 minute video. (5 marks)