70
2005/11/04 中中中中中中中中中中中 Graph Searching and Graph Searching and Related Problems Related Problems 中中中中中 中中中中中 中中中中中中中 中中中中中中中 中中中 中中中

Graph Searching and Related Problems

Embed Size (px)

DESCRIPTION

Graph Searching and Related Problems. 中央研究院 資訊科學研究所 高明達. Graph Searching Problems. Input: A graph is looked as a system of contaminated tunnels. Goal: To find a strategy using the least number of searchers to clear the entire graph. Graph Searching Problems. Operations - PowerPoint PPT Presentation

Citation preview

Page 1: Graph Searching and Related Problems

2005/11/04 中山大學資訊工程研究所

Graph Searching and Graph Searching and Related ProblemsRelated Problems

中央研究院中央研究院資訊科學研究所資訊科學研究所

高明達高明達

Page 2: Graph Searching and Related Problems

Graph Searching ProblemsGraph Searching Problems

Input:Input:

A graph is looked as a system of A graph is looked as a system of contaminatedcontaminated tunnels. tunnels.

Goal:Goal:

To find a To find a strategystrategy using the least using the least number of number of searcherssearchers to clear the to clear the entire graph. entire graph.

Page 3: Graph Searching and Related Problems

Graph Searching ProblemsGraph Searching Problems

• Operations• Place Remove Move

• Clearing rules• move along an edge

• guard the two endpoints of an edge

• Recontamination

a cleared edge connects a contaminated edge by a path with no searcher

• Versions:

OperationsRule

Edge placemove

remove

move

Node placeguard

remove

Mixed placeboth

remove

move

Page 4: Graph Searching and Related Problems

Searching StrategySearching Strategy

Node search number =3

Edge search number = 2

There exists an optimal search strategy without recontamination.

Page 5: Graph Searching and Related Problems

Equivalent ProblemsEquivalent Problems

Node searching problem is Node searching problem is equivalent to equivalent to • Interval thickness problemInterval thickness problem• Gate matrix layout problem Gate matrix layout problem • Vertex separation problem Vertex separation problem • Narrowness problemNarrowness problem• Path-width problemPath-width problem

Page 6: Graph Searching and Related Problems

Interval Thickness ProblemInterval Thickness Problem

Given a graph G=(V, E), find an Given a graph G=(V, E), find an interval graph G’= (V, E’), E interval graph G’= (V, E’), E E’, E’, such that the maximum clique of G’ such that the maximum clique of G’ is minimum. is minimum.

ABCDEF

A

C

B

D

E F

Page 7: Graph Searching and Related Problems

Gate Matrix Layout ProblemGate Matrix Layout Problem

Given a gate matrix, each column Given a gate matrix, each column represents a gate and each row represents a gate and each row represents a net, the problem is to represents a net, the problem is to permute the columns such that the permute the columns such that the nets can be arranged in minimal nets can be arranged in minimal number of tracks. number of tracks.

Page 8: Graph Searching and Related Problems

11000000N

01011000N

00101000N

00100100N

00010110N

00000011N

GGGGGGGG

F

E

D

C

B

A

87654321A

B

C

D

E

F

11000000N

01101000N

00110000N

00010100N

00001110N

00000011N

GGGGGGGG

F

E

D

C

B

A

87465321

A

B

C

D

E

F

Page 9: Graph Searching and Related Problems

A

C

B

D

E F

incompatible graph

ABCDEF

G2 G5

G3

G6

G4

G7

G1G2 G3G5 G6G4 G7G8

11000000N

01011000N

00101000N

00100100N

00010110N

00000011N

GGGGGGGG

F

E

D

C

B

A

87654321

Page 10: Graph Searching and Related Problems

Vertex Separation ProblemVertex Separation Problem

GG=(=(VV, , EE)) Linear layout: Linear layout: LL: : VV {1, 2, …, | {1, 2, …, |VV|}|} VVLL((ii) = ) = {{uu||LL((uu) ) ii, , ww, , LL((ww)>)>ii, (, (uu, , ww))EE}.}. vsvsLL((GG)) = = maxmaxii {|{|VVLL((ii)|})|}

vsvs((GG) = min) = minLL vsvsLL((GG))

Page 11: Graph Searching and Related Problems

b

a

e

d

h

c

f g

a b e d c f g h

V(1) = {a}V(2) = {a, b}V(3) = {a, b, e}V(4) = {a, e, d}V(5) = {d, e}V(6) = {e, f}V(7) = {e, f}V(8) = {}

c a d b e f h g

V(1) = {c}V(2) = {a}V(3) = {d}V(4) = {d}V(5) = {d, e}V(6) = {e, f}V(7) = {e, f}V(8) = {}

a b e d c f g h

c a d b e f h g

Page 12: Graph Searching and Related Problems

Narrowness ProblemNarrowness Problem

Inner

Memory

Outer

MemoryShack

Limited

in-sequence out-sequence

Short term memory constraint: A vertex can be moved from the shack to OM only if all of the vertices connected to it by an arc are also in the shack or already in OM.

Page 13: Graph Searching and Related Problems

Narrowness ProblemNarrowness Problem

e

a

c

d

h

b

f g

In-sequenceb a d e c f h g

b a e d ch fgOut-sequence

In-sequencea b c e d f h g

b ae d ch fgOut-sequence

Page 14: Graph Searching and Related Problems

Path-width ProblemPath-width ProblemPath decompositionPath decomposition of of GG=(=(VV, , EE):): XX={={XX11, , XX22, …, , …, XXnn}, }, XXi i VV, , 1 1 i i n.n. ((aa,, b b))E, E, i i such that {such that {aa,, b b} } XXii.. i < j < k, Xi < j < k, Xii XXk k XXjj..Path-widthPath-width of of G = G = minminXX maxmaxii {{|X|Xii|-|-1}1}

A

C

B

D

E F

X ={{A, B}, {B, C, E}, {C, D, E}, {E, F}}

Page 15: Graph Searching and Related Problems

Tree-width ProblemTree-width ProblemTree decompositionTree decomposition of of GG=(=(VV, , EE):): XX={={XX11, , XX22, …, , …, XXnn}, }, XXi i VV, , 1 1 i i n.n. ((aa,, b b))E, E, i i such that {such that {aa,, b b} } XXii.. XXii, , XXjj,, XXkk,, XXjj is on the path from is on the path from XXii to to XXkk,, XXii

XXk k XXjj..

Tree-widthTree-width of of G = G = minminXX maxmaxii {{|X|Xii|-|-1}1}Tree decomposition is equivalent to the emTree decomposition is equivalent to the em

bedding into a chordal graph. bedding into a chordal graph.

Page 16: Graph Searching and Related Problems

A computing paradigm based on tree deA computing paradigm based on tree decomposition using dynamic programmicomposition using dynamic programming. ng. • Maximum independent set problemMaximum independent set problem• Maximum clique problemMaximum clique problem• Pathwidth problemPathwidth problem• Minimum fill-in problemMinimum fill-in problem• Minimum dominating set problemMinimum dominating set problem• Hamiltonian cycle problemHamiltonian cycle problem• Minimum coloring problemMinimum coloring problem• Minimum edge coloring problemMinimum edge coloring problem• …………………………………………

Page 17: Graph Searching and Related Problems

Maximum Independent SetMaximum Independent Set

X1 X2 X3

X5

X7

X6

X4

I: an independent set of [X7]

{Xi}= subgraph induced by Xi and its descendents.

Ii = I [Xi], i = 5. 6.

{Ii} the MIS containing Ii in {Xi}.

{I} = I {I5} {I6}

Page 18: Graph Searching and Related Problems

Bounded treewidth graphs have Bounded treewidth graphs have linear tilinear timeme algorithm for the decision problem o algorithm for the decision problem of pathwidth problem. f pathwidth problem.

Tree Tree serial-parallel graphsserial-parallel graphs cactus graphscactus graphs partial 2-treepartial 2-tree

Page 19: Graph Searching and Related Problems

Previous ResultsClasses of graphsClasses of graphs ComplexityComplexity

GeneralGeneral NP-completeNP-complete

General, degree General, degree 3 3 NP-completeNP-complete

Planar, degree Planar, degree 3 3 NP-completeNP-complete

chordalchordal NP-completeNP-complete

Chordal dominoChordal domino NP-completeNP-complete

Chordal bipartiteChordal bipartite NP-completeNP-complete

starlikestarlike NP-completeNP-complete

bipartitebipartite NP-completeNP-complete

Bipartite distance-hereditaryBipartite distance-hereditary NP-completeNP-complete

Circle Circle NP-completeNP-complete

Page 20: Graph Searching and Related Problems

Previous Results

Classes of graphsClasses of graphs ComplexityComplexity

k-starlikek-starlike P P OO((mnmnkk))Split Split P P OO((mnmn))Co-chordalCo-chordal PP

Trapezoid Trapezoid PP

Interval Interval P P OO((mm++nn))Permutation Permutation P P OO((nknk))Partial k-treePartial k-tree P P OO((nn))UnicyclicUnicyclic P P O(O(nn))CographCograph PP

TreeTree P P O(O(nn))Block Block P O(bc+c2+n)

Page 21: Graph Searching and Related Problems

Previous Results on TreesPrevious Results on Trees

Search number: O(Search number: O(nn)) Search strategy:O(Search strategy:O(nn log lognn) ) O(O(nn)) Node search: Node search:

• R. H. Moehring 1990, R. H. Moehring 1990, P. Scheffler 1990, P. Scheffler 1990, J. Ellis, I. Sudborough, J. Turner 1994J. Ellis, I. Sudborough, J. Turner 1994

Page 22: Graph Searching and Related Problems

BranchBranch

t v TTtvtv

Page 23: Graph Searching and Related Problems

Three-Branch LemmaThree-Branch Lemma [Pa76,Sc90, EST94, TUK95][Pa76,Sc90, EST94, TUK95] For any tree For any tree TT, , ((TT) ) kk+1+1, k ≧ 2 if and , k ≧ 2 if and

only if there exists a vertex only if there exists a vertex tt with at le with at least three branches ast three branches TTtutu, , TTtvtv,, T Ttwtw such tha such that t ((TTtutu)≧)≧kk, , ((TTtvtv)≧)≧kk, , ((TTtwtw)≧)≧kk. .

kkk

k +1

Page 24: Graph Searching and Related Problems

σ = 3σ = 3

Node Search ExampleNode Search Example

Node search number = 3

σ = 2

Page 25: Graph Searching and Related Problems

AvenueAvenue

[MHGJP88] A path [MHGJP88] A path PP is an is an avenueavenue of of TT if if the following conditions hold:the following conditions hold:• For every path branch For every path branch T T ’ at ’ at PP, , ((T T ’) = ’) = ((TT),),• For every non-path branch For every non-path branch T T ’ at ’ at PP, , ((T T ’) < ’) <

((TT).).

[MHGJP88] [MHGJP88] For any tree For any tree TT, , TT has an has an avenue.avenue. If the length of the avenue is at If the length of the avenue is at least two, then the avenue is least two, then the avenue is uniqueunique..

Page 26: Graph Searching and Related Problems

AvenueAvenue

(T) = k

<k<k

<k

=kk=

Page 27: Graph Searching and Related Problems

Example (Node)Example (Node)

Avenue branchNon-avenue branch

Page 28: Graph Searching and Related Problems

Extended AvenueExtended Avenue

A path A path PP is an is an extended avenueextended avenue of of TT if the following conditions hold:if the following conditions hold:• For every path branch For every path branch T T ’ at ’ at PP, , ((T T ’) ’)

((TT),),• For every non-path branch For every non-path branch T T ’ at ’ at PP, , ((T T ’) ’)

< < ((TT).). An extended avenue must contain An extended avenue must contain

the avenue of the tree. the avenue of the tree.

Page 29: Graph Searching and Related Problems

Extended AvenueExtended Avenue

Page 30: Graph Searching and Related Problems

Avenue SystemAvenue System

If If TT is a basis, then is a basis, then

If If TT is is notnot a basis: a basis:

where where PP is the set of nonpath branch is the set of nonpath branches of P.es of P.

}.{))((

};{)(

TTF

TT

))),'(((}{))((

));'((}{)(

'

'

TFTTF

TPT

P

P

T

T

Page 31: Graph Searching and Related Problems

Avenue System (Node)Avenue System (Node)

Page 32: Graph Searching and Related Problems

Searching Strategy (Node)Searching Strategy (Node)

Page 33: Graph Searching and Related Problems

Avenue Tree Avenue Tree

Page 34: Graph Searching and Related Problems

Avenue TreeAvenue Tree

Let Let P P AA((TT) and ) and TTPP denote the denote the branch in branch in FF((AA((TT)) with P as its main )) with P as its main avenue. avenue.

AA((TT) is the set of nodes of the logical ) is the set of nodes of the logical avenue tree. avenue tree.

PP is the parent of is the parent of QQ if and only if if and only if TTPP is is a non-path branch of a non-path branch of QQ. .

Page 35: Graph Searching and Related Problems

Avenue Tree ConstructionAvenue Tree Construction

Look tree Look tree TT as a rooted tree. as a rooted tree. Labeling algorithmLabeling algorithm Avenue tree constructionAvenue tree construction

Page 36: Graph Searching and Related Problems

Labeling AlgorithmLabeling Algorithm

A vertex A vertex uu is is kk-critical-critical if the subtree rooted if the subtree rooted at at uu is of is of ((TTuu)=)=kk and there exists and there exists exactlyexactly twtwo children o children vv and and ww of of uu such that such that ((TTvv)=)=kk an and d ((TTww)=)=kk..

k k<k <k

vw

u

Page 37: Graph Searching and Related Problems

Labeling AlgorithmLabeling Algorithm

Label Label

pp aaaaaa ...,),,...,,( 2121

puuu ,...,, 21 Critical verticesCritical vertices

up= u

u2 u1 u3

Page 38: Graph Searching and Related Problems

Labeling Algorithm (case 1)Labeling Algorithm (case 1)

If more than

2 children of = k

Then

= (k+1)’

(k+1)’

k k k

Page 39: Graph Searching and Related Problems

Labeling Algorithm (case 2)Labeling Algorithm (case 2)

If exactly

2 children of = k and one of them contains a k-critical vertex

Then

= (k+1)’

k’k

(k+1)’

kk

k

< k

Page 40: Graph Searching and Related Problems

Labeling Algorithm (case 3)Labeling Algorithm (case 3)

If exactly

2 children of = k and none of them contain a k-critical vertex

Then

= k

k’ k’

k

< k< k

Page 41: Graph Searching and Related Problems

Labeling Algorithm (case 4)Labeling Algorithm (case 4)

If exactly

1 children of = k and it contains a k-critical vertex x and (Tu[x]) =k

Then

= (k+1)’

k

(k+1)’

x: k-critical

: Tu[x]

x

kk

k

< k < k

Page 42: Graph Searching and Related Problems

Labeling Algorithm (case 5)Labeling Algorithm (case 5)

If exactly

1 children of = k and it contains a k-critical vertex x and (Tu[x]) < k

Then

= k

k

k

x: k-critical

: Tu[x]

x

kk

k

< k < k

Page 43: Graph Searching and Related Problems

Labeling Algorithm (case 6)Labeling Algorithm (case 6)

If exactly

1 children of = k and it contains no k-critical vertex Then

= k’

k’

k’

< k < k

Page 44: Graph Searching and Related Problems

Running ExampleRunning Example

(8) (4)

(4,2‘)

(8,7,6‘)

(7)

(8,2‘)(7,5,3,2‘)

(4)

(4‘) (4‘)

critical vertex

(3) (5)

Page 45: Graph Searching and Related Problems

Avenue Tree Construction Avenue Tree Construction

Pointer Assignment (before)

(8) (4)

(4,2‘)

(8,7,6‘)

(7)

(8,2‘)

(5)

( 7,5,3,2‘)

(3)

Page 46: Graph Searching and Related Problems

Avenue Tree Construction Avenue Tree Construction

Pointer Assignment (after)

(8) (4)

(4,2‘)

(8,7,6‘)

(7)

(8,2‘)

(5)

( 7,5,3,2‘)

(3)

Page 47: Graph Searching and Related Problems

Notation Notation Let Let uu be the root with children be the root with children vv11, …, , …, vvkk.. = (= (aa11, …, , …, aapp) : the label of ) : the label of uu. . ii : the label of : the label of vvii for for ii = 1, …, = 1, …,kk..ii’: the elements of ’: the elements of ii which is greater than which is greater than aa

pp..bbii : : bbii is the maximal element in is the maximal element in ii no greater t no greater t

han han aapp..uuii: the vertex corresponding to : the vertex corresponding to bbii..ThenThen

.)( '1 pi

ki a

Page 48: Graph Searching and Related Problems

Pointer AssignmentPointer Assignment

aa11 a a22 …… a …… ap-1 p-1 aapp

ww11 w w2 2 …… w…… wp-1 p-1 wwpp

u1 b1

u2 b2

: :

: :

uk bk

Page 49: Graph Searching and Related Problems

Main TheoremMain Theorem

An optimal searching strategy on trees An optimal searching strategy on trees can be constructed in linear time. can be constructed in linear time.

Page 50: Graph Searching and Related Problems

Block Graphs A block graph is a graph in which every

block is a clique.

Block-cut-vertex tree

Page 51: Graph Searching and Related Problems

Recursive CharacterizationFor any block graph G and an integer k 2,

ns(G) k+1 if and only if G has either (1) a vertex x at which there exists at least three branches having search numbers at least k; or (2) a block K on which ns({G}u,v) k for any (u,v) E(K).

k k k

k+1

u

v

Page 52: Graph Searching and Related Problems

G :{G}u,v : Ku v

enclosure subgraph

Page 53: Graph Searching and Related Problems

Recursive Char. (cont.)

For any block graph G and an integer k 2, ns(G) = k if and only if G has

(1) for any vertex x at which there exists at most two branches having maximum search numbers k; and

(2) for any block K there exists (u,v) E(K) such that ns({G}u,v) < k.

Page 54: Graph Searching and Related Problems

Avenue of Length 1A vertex having all branches with search number smaller than ns(G) is called a hub of G.

A block graph may have more than one hub. ns(G) = 4

Page 55: Graph Searching and Related Problems

critical edges

v3

Avenue of Length > 1

v1 v4v2

critical vertices outlet vertices

For any critical edge (u,v) of a block graph G, ns({G}u,v) < ns(G).

ns(G) = 4

Page 56: Graph Searching and Related Problems

G may has more than one avenue, but the set of critical blocks is unique.

Avenue of Length > 1

critical blocks

v3v1 v4v2

ns(G) = 4

Page 57: Graph Searching and Related Problems

Avenue of Length > 1

v3v1 v4v2

ns(G) = 4

Page 58: Graph Searching and Related Problems

Block-cut-vertex tree

Vertex Merge

Block merge

Page 59: Graph Searching and Related Problems

MergeMergeVertex merge is similar to the case in trees.Vertex merge is similar to the case in trees.

Block merge is new. Block merge is new.

Page 60: Graph Searching and Related Problems

Greedy Strategy

K

u

v1 v2

v3 v4

vr

G1G2

Gr

G3G4

L R

3

1

4

2

r

Page 61: Graph Searching and Related Problems

Patterns of Greedy Strategies1. Centralized : L and > R

2. Balanced : L = R

3. Skewed : L > and L > R

L R

L R

L R

ns(G) = .

ns(G) = L.

ns(G) = L or L-1.

Page 62: Graph Searching and Related Problems

Unicyclic GraphsUnicyclic Graphs

Page 63: Graph Searching and Related Problems

Concluding RemarkConcluding Remark Based on concept of Based on concept of avenueavenue we get linea we get linea

r time algorithms and polynomial time ar time algorithms and polynomial time algorithm for node search problem on lgorithm for node search problem on tretrees, unicyclices, unicyclic graphsgraphs and and block graphsblock graphs, re, respectively.spectively.

How to extend the concept of avenue How to extend the concept of avenue to the general case to obtain a linear to the general case to obtain a linear time algorithm. time algorithm.

Cactus graphs Cactus graphs Block graphs Block graphs

Page 64: Graph Searching and Related Problems

2005/11/04 中山大學資訊工程研究所

ENDEND

Page 65: Graph Searching and Related Problems
Page 66: Graph Searching and Related Problems
Page 67: Graph Searching and Related Problems
Page 68: Graph Searching and Related Problems

ABCDEA

C

B D E

A

C

B D E

Page 69: Graph Searching and Related Problems

Narrowness ProblemNarrowness Problem

b

a

e

d

hc

f

g

a b d

a b e df c g h

b d g

d g e

dg

f

gc

gh a

b

b a e f d c gh

a d

d e

df

dg

gc

gh

Page 70: Graph Searching and Related Problems

d

c

b

ae f

d

h

gc

b

a

e

f

hg

a b c c d gb c d d g hc d e f

d

cb

a

e

f

hg