A Fast Algorithm To Determine Minimality of Strongly Connected Digraphs Under the direction of Dr....

Preview:

Citation preview

 A Fast Algorithm To

DetermineMinimality of Strongly

Connected Digraphs

Under the direction of Dr. Robinson

By Jianping Zhu

Why MSD AlgorithmThis algorithm can be used to facilitate the process of generating MSDs. An O(n2) time algorithm is utilized by Kiran Bhogadi to check whether a candidate digraph is an MSD and we think the performance of his algorithm can potentially be improved for large digraphs by utilizing our algorithm

Strong DigraphA Strong Digraph is one in which every vertex is reachable from every other vertex.

e

f d

c

h

g

b

a

Minimal Strong DigraphA Minimal Strong Digraph (MSD) is a strong digraph which is no longer strong if any of its edges is removed

g e

f

h

d

a

cb

Depth First Search

h8/5 d

5/6

f6/4

b3/2

c2/7

g4/1

e7/3

a1/8Forward edge Back

edge

Cross Edge

Tree edge

Detecting reducibility of graph edges

Detecting reducibility of non-tree edges Forward edges

Cross edges Back edges

Detecting reducibility of tree edges

Forward edgesTheorem 1. Each forward edge e = (v, w) is reducible

v

w

e

Cross edges (1)e = ( v, z ) is a cross edge and w is the nearest common ancestor of vertices v and z in the DFS-tree of G.

Theorem 2: If edge e1 = (v, w) is in E then

e is reducible.

zv

w

e1

e

Cross edges (2-a)Theorem 3: If edge e1is not in E,

let G1 = G e + e1.

Then:

1. The edge e is reducible in G if and only if the edge e1 is reducible in the digraph G1.

2. Let e2 be an edge of G other than e which is

not a tree edge. Then e2 is reducible in G if and

only if e2 is reducible in G1.

Cross edges(2-b)

v

w w

G G1 G2

z

w

v z z ve

e1

Back edges (1)Theorem 4. Let {(v, w1) … (v, ws)} be the set

of back edges emanating from vertex v in such a way that w1<w2< …<ws . Then all

edges (v, w2) … (v, ws) are reducible.

w3

w2

w1

v

ws

Back edges (2-a)Theorem 5. Let e = (v, w) be a back edge in G, x be a descendant of v with v x and z be a vertex such that there is an edge from x to z.

1. If e1 = (z, w) is an edge in G1, then e is reducible .

2. If e1 is not an edge in G, then e is reducible in G if

and only if e1 is reducible in the digraph G2 = G e +

e1

3. Let e2 = (a, b) be an edge in G with e e2 e1 and

e2 is a non-tree edge. Then e2 is reducible in G if and

only if e2 is reducible in G2.

w

z

v

x

e

Back edges(2-b)

e1

G2

z

w

v

x

w

z

v

x

G G1G3

e1

w

z

v

x

e

w

z

v

x

e

Algorithm 1

Algorithm 1:Input A strongly connected digraph G(V, E)Output true: the input digraph may be an MSD (need to check if there are reducible tree edges) false: the input digraph is not an MSD1. do depth first search to get the partitions of edges TREE, BACK, CROSS, FORWARD, The depth first search tree DFS-Tree.2. for v V backpoint(v) v endfor

3. if the set FORWARD is not empty return false; endif 4. for e = (v, w) BACK backpoint(v) min (backpoint(v), w); if there exists an e = (v, w) B with w backpoint(v)

return false;

endif endfor

Algorithm 1 (cont) 5. for e = (v, w) CROSS do

let n be the nearest common ancestor of v and w if (w < backpoint(v)) add (v, n) to G; delete (v, backpoint(v)) from G; backpoint(v) w; else return false endif endfor 6. //R-test (root of DFS-tree) R-test(v) for w with (v, w) T do R-test(w) if w is not a leaf; z min (backpoint(w),(v, w) TREE); if (v z) if ( backpoint(v) < backpoint(z)) backpoint(z) backpint(v); else if (v backpoint(v)) return false else backpoint(v) z; endif endif 7. return false  

Algorithm 2Algorithm 2:1.   reverse G to get GR, run Algorithm 1 on GR if (Algorithm 1 returns false) return false;else

let TR be the DFS tree associated with GR

let TS be the reverse graph of TR

endif 2. run Algorithm 1 on G if ( Algorithm 1 return false) return false else let T be the DFS tree associated with G for edges (w, z) which are in both T and TS if ((w,z) is not a dominating edge for z and (w, z) is not a reverse dominating edge for w ) return false endif endfor endif

Detecting reducibility of tree edges

z

w

r

x

w

z

r

x

Ts T

Timing TestsWe tested the running time for randomly generated digraph up to 1000 vertices. We generated 20 digraphs for each number of vertices from 4 starter digraphs. We tested running time on the 20 digraphs and then took average.

Running time of MSD algorithm

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

0 500 1000 1500

Number of vertices

Tim

e i

n s

eco

nd

s

Series1

Running time of NCA algorithm

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0 500 1000 1500

Number of vertiece

Tim

e in

se

co

nd

s

Series1

Running time of the finding immediate dominators algorithm

0

0.005

0.01

0.015

0.02

0.025

0.03

0.035

0.04

0.045

0.05

0 500 1000 1500

Number of vertices

Tim

e i

n s

eco

nd

s

Series1

Thanks

Recommended