Transcript Basic Concepts of Discrete Probability
Graphs
Basic properties 1
Applications of Graph Theory
• • • • Car navigation systems Databases Build a bot to retrieve info from Internet Representing computer networks and streams of information 2
Intuitive Notion of Graph
• A graph is an abstract representation of a set of objects where some pairs of the objects are connected by links. The interconnected objects are represented by mathematical abstractions called
vertices
, and the links that connect some pairs of vertices are called
edges
.
3
Intuitive Notion of Graph
• • A graph is a bunch of vertices (or nodes) represented by circles which are connected by edges, represented by line segments In other words, graphs can be considered as relations on their vertices set 4
Definition of Graph
• • A graph (an undirected or simple graph) G = (V,E ) is a nonempty finite set V (a set of vertices or nodes) together with a set E of edges , where each edge is a subset of V with cardinality 2 (an unordered pair).
A simple graph is bidirectional (undirected) and has no loops (no “self-communication”).
5
Example
1 {1,2} {1,3} 3 2 {2,3} {3,4} {2,4} 4 • • V={1,2,3,4} E={(1,2),(1,3),(2,3),(2,4),(3,4)} 6
1
Example
{1,2} 2 {2,3} {1,3} {3,4} 3 {2,4} 4 • • • This graph may represent a computer network Vertices are labeled to associate with particular computers Each edge can be viewed as the set of its two endpoints 7
Edges
• For a set V with n elements, how many possible edges there?
• This is the number of pairs in V - the number of 2-element subsets of V:
C n
2
n
!
2!(
n
2)!
8
The number of graphs
• How many possible graphs are there for the same set of vertices V ?
• The number of subsets in the set of possible edges. There are n · (n -1) / 2 possible edges, therefore the number of graphs on V is 2 n(n -1)/2 9
Adjacent Vertices
• Vertices are adjacent if they are the endpoints of the same edge. This edge joins the adjacent vertices.
e
1 1 2
e
2
e
3
e
4 3 4 Q: Which vertices are adjacent to 1? How about adjacent to 2, 3, and 4?
10
Adjacent Vertices
1
e
2
e
1 3
e
3 2
e
4 4 1 is adjacent to 2 and 3 2 is adjacent to 1, 3, and 4 3 is adjacent to 1 and 2 4 is adjacent to 2 5 is not adjacent to any vertex 5 11
Incident Vertices and Edges
• A vertex is incident with an edge (and the edge is incident the edge.
with the vertex) if it is the endpoint of
e
1 1 2 5
e
2
e
3
e
4 3 4 • Which edges are incident to 1? How about incident to 2, 3, 4, and 5?
12
Incident Vertices and Edges
e
1 1 2 5
e
2
e
3
e
4 3 4 1 is incident with e 1
, e
2
e
1
, e
2 are incident with 1
e
1
, e
3
, e
4 are incident with 2 2 is incident with e 1
, e
3
, e
4 3 is incident with e 2
, e
3 4 is incident with e 4 5 is not incident with any edge 13
Degree of a Vertex
• The number of edges incident with a vertex is called the degree of this vertex: deg(A) is the degree of A.
e
1 1 2 5
e
2
e
3
e
4 3 4 • • deg(1)=2; deg(2)=3; deg(3)=2; deg(4)=1; deg(5)=0 Theorem . In a graph, the sum of degrees of the vertices equals twice the number of edges 14
Complete Graph
A simple graph is complete if every pair of distinct vertices share an edge. The notation
K n
denotes the complete graph on n vertices.
K
1
K
2
K
3
K
4
K
5 15
Adjacency Matrix
• • • For a digraph G = (V,E ) define a binary matrix
A G
by: Rows, Columns –one for each vertex in V Value at i th row and j th column is 1 if i th vertex connects to j th vertex (i j ) 0 otherwise 16
Adjacency Matrix - Example
e
1 1 2
e
2
e
3
e
4 3 4
A G
0 1 1 0 1 0 1 1 1 1 0 0 0 1 0 0 17
Adjacency Matrix
• Theorem . The sum of the entries in row
i
of the adjacency matrix of a graph is the degree of the
i
th vertex.
e
1 1 2
A G
0 1 1 0 1 0 1 1 1 1 0 0
e
2
e
3
e
4 0 1 0 0 deg(1) 3 2; deg(2) 3; deg(3) 4 18
Graph Isomorphism
• • A graph
G
1 is isomorphic to a graph
G
2 , when there is a one-to-one correspondence
f
between the vertices of
G
1 and
G
2 vertices A and B are adjacent in G 1 such that if and only if the vertices
f
(
A
) and
f
(
B
) are adjacent in
G
2 .
The function
f
with
G
2 .
is called an isomorphism of
G
1 19
Graph Isomorphism
20
Graph Isomorphism Invariant
• A property is said to be a graph isomorphism invariant if, whenever
G
1 and
G
2 are isomorphic graphs and
G
1 has this property, then so does
G
2 . The properties are: has n vertices has e edges has a vertex of degree k 21
Homework
• • Read Section 4.1
Problems (Exercises 4.1) 1, 3, 5, 7 22