Basic Concepts of Graph Algorithmscseweb.ucsd.edu/~gill/AlgCombSite/Resources/_CreateSp6-7.pdf ·...

Post on 01-Jun-2020

3 views 0 download

Transcript of Basic Concepts of Graph Algorithmscseweb.ucsd.edu/~gill/AlgCombSite/Resources/_CreateSp6-7.pdf ·...

Basic Concepts of GraphAlgorithms

Combinatorics for Computer Science (Units 6 and 7)

S. Gill Williamson

c©S. Gill Williamson 2012

Preface

From 1970 to 1990 I ran a graduate seminar on algebraic and algorithmiccombinatorics in the Department of Mathematics, UCSD. From 1972 to1990 algorithmic combinatorics became the principal topic. The seminarnotes from 1970 to 1985 were combined and published as a book, Com-binatorics for Computer Science (CCS), published by Computer SciencePress. Each of the ”units of study” from the seminar became a chapterin this book.

Here, we isolate a combined Unit 6 and Unit 7, corresponding to Chap-ter 6 and Chapter 7 of CCS, and reconstruct the original very helpful unitspecific index associated with these two units. Theorems, figures, etc.,are numbered sequentially: DEFINITION 6.10 and EXERCISE 6.29 re-fer to numbered items 10 and 29 of Unit 6 (or Chapter 6 in CCS). Unit 6contains basic material at an introductory level. Unit 7 applies Unit 6to a more advanced topic (planarity testing).

These notes focus on the visualization of algorithms through the use ofgraphical and pictorial methods. This approach is both fun and pow-erful, preparing you to invent your own algorithms for a wide range ofproblems. For further references and ongoing research, search the Web,particularly Wikipedia and the mathematics arXiv (arXiv.org).

Also available in this series are Basic Concepts of Linear Order (Unit 1),Sorting and Listing (Unit 2 and Unit 3)), and Polya Counting Theory(Unit 4). Units 6 and 7 are essentially independent of earlier units.

The exercises in this material were designed for student presentation inthe seminar. In many cases, these presentations were done after we hadgone through the entire unit. A good strategy is to read and understandthese exercises and return to the ones that interest you after you haveread the unit.

S. Gill Williamson, 2012http://cseweb.ucsd.edu/~gill

iii

iv

Table of Contents

Unit 6: Basic Concepts of Graph algorithms ...............1

Unit 7: Depth First Search and Planarity ................... 66

Subject Index ............................................................ 97

v

vi

Unit 6

Basic Concepts of Graph Algorithms

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

3.

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

Unit 7

Depth First Search and Planarity

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

Index

procedureBREAK(H), 48–50CONSTRUCT T AND B, 70ESEQ(T), 6INVPRU(T), 8JOIN(H), 48–50MAXSON, 35MOVE(t, δ, α, β), 18NEXT(Ti), 23NEXTPERM(A,m), 20PATH(e), 78PRU(T), 7SLOPPY PLANARITY TEST,

60–62construct lineal span. tree,

28

acyclicno cycles, 5

adjacency table, 4, 30, 77adjacent to a

VERT(b), 30articulation points graph, 50, 51automorphism group

graph, 40

backedges vs. chords, 68bicomponent tree, 54–60bicomponents

complexity issues, 73computing, 72, 73

biconnectedarticulation points, 51

biconnected graph, 47BIJ(A,B)

bijections A to B, 39–42bijections

BIJ(A,B), 39–42binary Gray code, 21breadth first, edges BRE(T), 13breadth first, vertices BRV(T),

13bridge SEG(e), 80bridge carrier, 80bridge graph, 58–62bridges

cycle, 52, 53subgraph, 53

canonical diagramstrees, 43

carrier of bridge, 80in cycle, 53, 54

componentsconnected, 5

connected graph, 5has lineal spanning tree, 25lineal spanning tree, 24

connected graphs on VCON(V), 36

connected graphs, four vertices,37

consistent embedding, 80contents, vcycle

bridges of, 52, 53carrier of bridge, 53, 54length n, 5

cycle bicomponent, 53cycle equivalent edges, 50

97

cycle tree, 56, 57

data structureterminal, 33

depth firstedges, DFE(T), 11, 66, 67vertices, DFV(T), 11, 66, 67

depth first sequencesdefinition, 11

direct access modeldata structure, 28, 29

directed graph, 2doubly linked list

pointers, 30

edgedirected, 6incident on vertex, 6loop, 4natural directed, 9sequence, ESEQ(T), 6stack in tree, STACK(e), 12

edge action EPER(V)on PER(P2(V)), 39–42

edge set, 2edges

backedges, 68breadth first BRE(T), 13chords, 68cycle equivalent, 50postorder POSE(T), 12, 69–

71preorder PREE(T), 12, 69–

71, 74embedding, 2

consistent, 80preorder vertices, 75, 76properly ordered, 76

EPER(V)action on GRAPHS(V), 39–

42

graph

2-connected or biconnected,47

articulation points, 50, 51automorphism

stabilizer, 40bridge graph, 58–62chain of edges, 10connected, 5defined as triple, 2directed, 2, 4directed path, 10embedding of, 58–60intuitive idea, 1ordered, 4, 66planar, 58–60planar embedding, 58–60rank, nullity, 47, 48rooted lineal spanning tree,

25rooted lineal subtree, 25tree definition, 5undirected UND(G), 10

graphsisomorphism of, 38–42

greedy algorithm, 50

Hopcroft , 96hypergraph, 3

incidence function, 2inversion enumerator

polynomial, 36inversions

definition, 35isomorphic graphs, 39–42isomorphism of graphs, 38

Kuratowski subgraphs, 63

lineal spanning tree, 24, 68, 69algorithm for, 27chord, backedge, 34complexity, 28–34connected graph, 25

98

first proof of, 26inversions in, 35second proof of, 27

lineal subtree, 25connected graph, 24, 68ordered, 24, 68

loop, 2, 4LOW1, LOW2 values, 72, 73

multigraph, 3multiset, 3

notationn = {1, . . . , n}, 6

ordered rooted tree, 42, 66orderly algorithm, 38, 43

basic mapping B, 44computing B−1, 44example, 45–47exercises, 46, 47

partitionset unordered Π(n, k), 17

pathlength n, 4

path directed, 10path tree, 78

example, 79PER(A)

permutations of A, 39–42PER(V)

permutations of vertices, 39–42

planarbipartite BRGR(C), 59–62

planar bipartite if e ≤ 2v − 4,62, 63

planar embeddingEuler e−v+r = 2, 63

planar embedding graph, 58–60planar graph, 58–60planar if e ≤ 3v−6, 62, 63planar not consistent, 81

planarity testoutline, 59–62

planarity testingMAX−MIN CHAIN, 94directly linked test, 91example, 82–91non-bichromatic SEGGR, 95relevant SEGGR(e,H), 92,

93pointers, 30–33polynomial

inversion enumerator, 36postorder edges, POSE(T), 12postorder vertices, POSV(T), 12Pruffer sequence of T, 7preface, iiipreorder edges, PREE(T), 12preorder vertices, PREV(T), 12principal subtree, 66

definition, 11

rank of Gedges in spanning forest, 47

segment graphbichromatic, 82planarity condition, 82

spanningforest, 24, 68subgraph, 24, 68tree, 24, 68tree - lineal, 24, 68tree - rooted, 24, 68

spanning forestchords, 24, 68rank of G, 47

spanning subgraph, 47stability subgroup

graph, 40stack

STACK(e′), 24stack in tree, edge, STACK(e),

13

99

stack in tree, vertex, STACK(x),13

subgraph

bridges of, 53

spanning, 47

subset action

of PER(A), 39–42

subsets of A: P(A)

size 2: P2(A), 39–42

subtree

lineal, 25

Tarjan, 96

Towers of Hanoi, 13–16

tree

breadth first order, 12

definition, 5

distance between vertices, 9

lineal spanning, 24, 68

natural directed, 9, 66

of cycles, 56, 57

of paths, 77–79

ordered rooted, 42, 66

ordered rooted ORTR, 9, 66

rooted RTR, 9, 66

subtree, 24, 68

unique path to root, 9

trees

all TR(V), 7

ancestor of y, 22, 68

canonical diagrams, 43

descendant of x, 22, 68

edge

initial vertex IN(e), 22

terminal vertex TM(e), 22

father of vertex, 22

lexicographic order, 9

lineal descendants, 22, 68

notation, 21

son of vertex, 22

trees rooted at v

TR(V, v), 36

vector notation← L, L →, x → L, etc.,

22vertex

adjacent, 4, 5, 66degree of, 6pendant, leaf, terminal, 6sequence, 4stack in tree, STACK(x), 12

vertex set, 2vertices

breadth first BRV(T), 13internal of tree INT(T), 8path equivalence, 5pendant of tree, PEND(T),

6postorder POSV(T), 12, 69–

71preorder PREV(T), 12, 69–

71, 74–76

100