Upload
albert-einstein
View
231
Download
0
Embed Size (px)
Citation preview
8/8/2019 vlsi cad basics
http://slidepdf.com/reader/full/vlsi-cad-basics 1/9
9/28/20
ECE-256alecture 2
256a 1
Malgorzata Marek-Sadowska
Electrical and Computer Engineering Department
Engineering I, room 4111
Reference materials
• C.L.Liu, “Introduction to Combinatorial Mathematics”, McGraw-Hill (1968)
• J.L.Gross and J.Yellen, “Graph Theory and its Applications,” Second Edition (DiscreteMathematics and Its Applications), Chapman & Hall/CRC, 2005.
• F. Buckley and M. Lewinter, “ A Friendly Introduction to Graph Theory, PrenticeHall”, 2002.
• J.M.Aldous, R.J.Wilson, “Graphs and Applications: An Introductory Approach” (withCD-ROM), Springer; 1st ed. 2000. Corr. 3rd printing edition (February 10, 2003)
256a 2
– ary hartrand, Introductory raph Theory, over ublications; Unabridged edition(December 1, 1984)
– R. J. Trudeau, Introduction to Graph Theory (Dover Books on Advanced Mathematics)Dover Publications; 2Rev Ed edition (February 9, 1994)
• And many more books on combinatorial mathematics and graph theory
Graph Theory
• Graph G(V,E) consists of 2 sets:
V= finite set of vertices {v}
E=set of edges {e}
256a 3
• n rec e grap
Each edge e ε E associated with an unordered pair
of vertices:
u e ve = (u,v)
Vertex adjacency: vertices u,v, are
adjacent if e=(u,v) ε E.
Sim le ra h: ra h w ith n o arallel e d es o r self l oo s
Some terminology
Incidence: edge is incident on its vertices.
A
B
C
D
e1 e2
e3
256a 4
.
Degree of vertex: d(v) = number of edges incident to v.
Path: sequence of edges {ei, ei+1, …}
Euler path: path which contains each edge once and only
once.
Path length: number of edges in the path.
B
Ce1 e2
E
F
A
B
C
D
e1 e2
e3
E
F
G1
e4
e5e6
e7
e8e9
In G1: {e1,e4,e9,e7,e5} –path of length 5.
Circuit – closed path.
Acyclic graph: graph with no cycles (ex. G2).
256a 5
A De3
G2
Euler circuit: circuit which contains each edge once and only once.
Example:{e10,e4,e1,e2,e9,e8,e7,
e6, e3, e12, e5,e11}
A
B
C
D
e1 e2
e3
E
F
G3
e4
e5
e7
e8e9
e10
e6e11
e12
A
B
C
D
E
F
G4
Connected graph: if for every u,v ε V there exists
A path from u to v.
Subgraph G’ of G:
G’(V’,E’): V’ V, E’ E, such that an edge {u,v} ε E’,
256a 6
only if (u,v) ε E. (G5 is a subgraph of G4)
Proper subgraph: E’ E, V’ V.
A
B
D
F
G5( G5 is also a proper subgraph of G4.
8/8/2019 vlsi cad basics
http://slidepdf.com/reader/full/vlsi-cad-basics 2/9
9/28/20
A
B
C
D
E
F
Spanning subgraph: subgraph with V=V’.
G6Component of G: maximal
connected subgraph of G. c2
256a 7
A
B
D
FC
I
H
c1
Maximal subgraph G’ of G w.r.t. some property P: if G’
has the property P, and G’ is not a proper subgraph of any
other subgraph of G having the property P.
Component of G: maximal
connected subgraph of G. c2
256a 8
A
B
D
FC
I
H
c1
A
B
C
D
E
F
Minimal subgraph G’ of G w.r.t. some
property: G’ has the property P, and
no subgraph of G having the property
P is a proper subgraph of G’.
GExample: The subgraph induced by the
red edges in G is a minimal spanning
subgraph of G.
256a 9
A
B
C
D
E
F
G1
Example: The subgraph induced by the
red edges in G1 is a minimal connected
spanning subgraph of G1.
Directed graph (digraph): D(V,E)
E=directed edges or arcs; e= (u,v) is an ordered pair of
vertices.
u v
Directed path: sequence of arcs { (u,v), (v,w)….}
256a 10
Directed circuit (cycle): closed directed path.
Acyclic digraph: digraph with no directed circuits.
In-degree:
}),(|{)();( E vwwvvd ∈=Γ −−
Out-degree:
}),(|{)();( E wvwvvd ∈=Γ ++
v
v
256a 11
For every graph:
)()(||
1
||
1
=
+
=
−=
v
iii
v
i
vd vd
Strongly connected:if there is a directed path u->v
and v->u for all vertices in D.
(All vertices are strongly connected)
256a 12
8/8/2019 vlsi cad basics
http://slidepdf.com/reader/full/vlsi-cad-basics 3/9
9/28/20
Strongly connected component:
maximal strongly connected subgraph.
Minimally connected:
IfD is stron l connected and removal
256a 13
of any edge destroys the “strongly
connected” property.
Cutset of a connected graph:
Minimal set of edges S in G whose removal
From G disconnects G, I.e. G-S is disconnected,
And has exactly 2 components.
256a 14
C1
C2
Cutset of minimum cardinality = min cutset.
Cut: set of edges having one end vertex in V1, and
the other in V2, and
V1 V2 = 0, V1 V2 = V∩ ∪
Min-cut = cut of minimum cardinality
v1 v2
256a 15
v3
v4 v5
v1 v2
v3
v4 v5
s s a cu , u no a cu-se
(not a minimal set of edges).
Resultant graph has 3 connected components,
not 2.
The first graph
The bridges of Konigsberg
A
C
DA
C
D
256a 16
B
Problem: Start at any of the four land areas, walk through each bridge
exactly once, and return to the starting point ( Euler circuit).
Special graphs
Complete graph2
)1(||
−=
nn E hasK
n
K6
Clique of G: set of vertices , such that
the induced subgraph of G on S is a complete
V S ⊆
256a 17
graph.
Clique problem: determine if a given
simple graph has a clique of size k.
Regular graph: k-regular, if all have d(v)=k.V v∈
5-regular, also K6
Note: Kn is (n-1) regular.
Bipartite graph: graph whose vertices can be
256a 18
vertices in the same set.
8/8/2019 vlsi cad basics
http://slidepdf.com/reader/full/vlsi-cad-basics 4/9
9/28/20
Complete bipartite graph: km,n
if |V1|=m, |V2|=n and there is an edge between every
pair if vertices , 11V v ∈
22V v ∈
256a 19
V1 V2 V1 V2
Complete bipartite
graph.
Bipartite graph.
K-partite graph: vertices V partitioned into k
subsets: s.t. each edge has one
vertex in some and the other in .k
V V V ,,21
iV j
V
3-partite graph.
256a 20
Isomorphism
Graphs represent structural relations between
vertices.
Two graphs G and H are isomorphic, if there is
- -
256a 21
of vertices and their sets of edges, such that the
corresponding edges of G,H are incident on the
corresponding vertices of G,H,
Basic graph theorems
The sum of the degrees = 2 x the number of edges.
The number of vertices of odd degree is even.
E vd n
ii
2)(1
=−
256a 22
A graph G has an Euler path if and only if it is connected
and has two or no vertices of odd degree.
A graph G has an Euler circuit if and only if it is connected
and all vertices or of even degree.
In an acyclic digraph D there is at least one vertex
u with and at least one vertex v with0)( =ud in
0)( =ud out
Directed Euler circuit
256a 23
A directed graph contains an Euler
circuit if and only if its underlying graph is
connected and, for all vertices v :
)()( vd vd inout =
1)()( += ad ad inout
Directed Euler Path
A directed graph contains an Euler path, iff its
underlying graph is connected and contains one
vertex , a, such that
and at most one vertex, b, such that
256a 24
1)()( += bd bd out in
while for all other vertices, v
)()( vd vd inout
=
8/8/2019 vlsi cad basics
http://slidepdf.com/reader/full/vlsi-cad-basics 5/9
9/28/20
Hamiltonian Circuit: a circuit in which
every vertex appears once and only once.
Dodecahedron
(Hamilton 1857)
256a 25
Hamiltonian path: a path in which every vertex
appears once and only once. No efficient
techniques exist for finding Hamiltonian
circuits in a graph.
Related problem:
Traveling Salesman Problem
Visit all cities exactly once and return to starting pointtraveling minimum distance.
256a 26
F n Ham ton an c rcu t o m n mum engt n a g ven
weighted graph.
Vertex: city to be visited
Edge: road between 2 cities
W(e): length of the road.
)(min: ewTSP
A necessary condition that a bipatrite graph has
a Hamiltonian circuit is that it has the same
number of vertices in each set.
A complete (directed) graph is one which has a
(directed) edge between every pair of vertices.
256a 27
Every complete directed graph has a Hamiltonian
path.
Trees
A tree is a connected graph with no circuits.
256a 28
A spanning tree of a graph is a tree which
contains all the vertices of the graph.
Minimum spanning tree theorem
If
• the vertices of a graph, G, are divided into
two disjoint sets, A and B; and
• e is the minimum length edge with one vertex
in A and another in B
256a 29
then there exists a minimum spanning tree,
T, which contains e.
A Be e is the min length edge.
Minimum spanning tree
Prim’s algorithm
1. Draw in shortest edge
2. Thereafter, draw in shortest edge which does
not complete a circuit.
256a 30
2
10
125
8
3
10
2
10
125
8
3
10
8/8/2019 vlsi cad basics
http://slidepdf.com/reader/full/vlsi-cad-basics 6/9
9/28/20
Shortest path in a directed graph
4
3
2
6
7 2 32
7
4S T
256a 31
2 26
6
35
Dijkstra’s Algorithm
1. Set L(S) = 0, rest L(v) =
2. Find unmarked vertex u such that L(u) = min.
If u = T, STOP.
3. For each e = (u,v), set
L(v)=min(L(v), L(u) + l(e))4. Mark u, go to 2.
∞
256a 32
4
3
2
2
6
7 2 32
7
26
6
35
4
S T
(2)
(3)
(4)
(5)
(6)
(7)
(8)
Shortest path in a directed graph
4
3
2
6
7 2 32
7
4
∞
∞∞
0
S T
256a 33
2 26
6
35
∞ ∞
Shortest path in a directed graph
4
3
2
6
7 2 32
7
4
∞
∞
0
4
3
256a 34
2 26
6
35
∞2
Shortest path in a directed graph
4
3
2
6
7 2 32
7
4
∞
∞
0
4
3
7
256a 35
2 26
6
35
28
Shortest path in a directed graph
4
3
2
6
7 2 32
7
4
∞
∞
0
4
3
7
256a 36
2 26
6
35
28
8/8/2019 vlsi cad basics
http://slidepdf.com/reader/full/vlsi-cad-basics 7/9
9/28/20
Shortest path in a directed graph
4
3
2
6
7 2 32
7
4
∞0
4
3
7
10
256a 37
2 26
6
35
28 7
Shortest path in a directed graph
4
3
2
6
7 2 32
7
4
∞0
4
3
7
10
6
256a 38
2 26
6
35
28 7
Shortest path in a directed graph
4
3
2
6
7 2 32
7
4
∞0
4
3
7
10
6
256a 39
2 26
6
35
28 7
Shortest path in a directed graph
4
3
2
6
7 2 32
7
4
0
4
3
7
10
6
13
9
256a 40
2 26
6
35
28 7
Shortest path in a directed graph
4
3
2
6
7 2 32
7
4
0
4
3
7
10
13
9
256a 41
2 26
6
35
28 7
Shortest path in a directed graph
4
3
2
6
7 2 32
7
4
0
4
3
7
10
13
9
256a 42
2 26
6
35
28 7
11
8/8/2019 vlsi cad basics
http://slidepdf.com/reader/full/vlsi-cad-basics 8/9
9/28/20
Shortest path in a directed graph
4
3
2
6
7 2 32
7
4
0
4
3
7
10
613
9
256a 43
2 26
6
35
28 7
11
4 2
6
7 2 32
7
Dijkstra’s Algorithm
S T(3)
(4) (7)
256a 44
2 26
6
35
4
(2) (6)
(8)
Critical Path Problem
In scheduling problem (PERT)
• V = events, E = tasks
• l(e) = time needed to complete task e,
• the shortest possible completion time is determined
by the longest (critical) path.
256a 45
2
3
6
10
73
4
Find the longest path in directed graph.
Critical path algorithm
1. Set L(v) –0, u = S
2. For each e = (u,v), set
L(v) = max(L(v), L(u)+l(e))
3. Repeat 2 for all visited vertices.
256a 46
2
3
6
10
73
4
(2)
(3) (12)
(9)
(16)S
T
Independent Sets
A set of vertices of any graph is an independent set if
and only if no vertices in the set are adjacent.
B C B C
256a 47
A
G
EF D A
EF D
HB CH G
A
G
EF D
H
An independent set is maximal if the addition
of any other vertex causes it to become
dependent.
The independence number, I(G) of a graph, G,
256a 48
Independent set.
8/8/2019 vlsi cad basics
http://slidepdf.com/reader/full/vlsi-cad-basics 9/9
9/28/20
C
A
EF D
An independent set is a dominating set if and
only if it is maximal.
B
256a 49
G H
Non-max independent sets: EH, BFG,AC.
Max independent sets: ACH, BDFG.
In any graph G: I(G)>=D(G).
0
0
0
0
256a 50
0
0
0
A maximal independent set on the chessboard
The covering problem
Given a binary matrix, find the smallest set of rows which
covers a 1 in each column.
1 1 0 1 1 0
1 1 1 0 0 0
256a 51
0 1 0 1 1 0
0 1 1 1 0 1
1 0 1 1 0 1
Covering set
ma es coverng
set.
A row (column) covers a second row (column) if
it has ones everywhere the second does.
1 0 1 1 0 covers 1 0 0 1 0
1 0
does not
256a 52
0
1
1
0
0
1
cover
If a column a covers column b, column a may be eliminated
A
B
C
D
E
U V W X Y Z
1 0 0 1 1 0
1 1 1 0 0 0
0 1 0 1 1 0
0 1 1 1 0 1
1 0 0 1 0 1
A
B
C
D
E
U W Y Z
1 0 1 0 1 0
1 1 0 0 0 0
0 0 1 0 1 0
0 1 0 1 0 1
1 0 0 1 0 1
256a 53
V covers W
X covers Y
A
B
C
D
U W Y Z
1 0 1 0 1 0
1 1 0 0 0 0
0 0 1 0 1 0
0 1 0 1 0 1
1 0 0 1 0 1
If row a covers row b, row b can be eliminated
A
B
D
E
W Y Z
0 1 0
1 0 0
1 0 1
0 0 1
U
Covers
Y
D covers B and E
256a 54
A covers C
W Y Z
A
D
0 1 0
1 0 1
Smallest covering set : rows A and D