Title: Graph Theory
1Graph Theory
The objectives of this topic are to introduce to
students graph theory, and discuss its
applications to communication network design
problems. After studying this topic, the students
should
- know the basic terms and definitions of graph
theory - know some important graph theory theorems,
results, and some algorithms about trees,
shortest path problems, and flow problems - be able to apply graph theory to the design of
communication networks.
2Undirected graph
- The following is an undirected graph
An example of a graph
3Undirected graph (cont.)
- A graph is defined in terms of vertices (single
vertex) and edges. Two vertices are connected to
each other by an edge. - A graph is G(X,E) where G is a graph, X is the
set of vertices, E is the set of edges connecting
the vertices, hence each of element of E is an
unordered pair of two elements from X.
4Undirected graph (cont.)
- referring to the previous example, G(X,E) where
X1,2,3,4,5 and E (1,3), (1,4), (2,3),
(3,5)1, (3,5)2 , note that in this example (1,3)
is same as (3,1) for an undirected graph, to
denote different edges d and f, subscripts are
used as for (3,5)1, (3,5)2 - Any situation (system) that contains a set of
elements (the vertices) and the relationship
between pairs of elements (the edges) can be
described by an undirected graph.
5Parallel edges and simple graph
- Two edges connecting the same vertices are called
parallel edges. A graph without parallel edges is
called a simple graph.
Cardinality
- If there are m vertices and n edges, this is
denoted by Xm and En, where S is the
cardinality of a set S, which denotes the number
of elements in it.
6Complete graph
- If for every pair of vertices in a simple graph,
there is an edge connecting them, the graph is a
complete graph and the number of edges is - In general for any simple graph, we have
7Isomorphism
- A graph may be drawn in different ways by moving
the vertices and stretching the edges, but these
different drawings refer to the same graph. - A graph G? (X?, E?) is isomorphic to a graph
G(X,E) if X?X, E?E and it has identical
relationship between the vertices and edges to G.
8Isomorphism (cont.)
b
4
1
e
a
d
c
2
3
5
f
b
1
4
e
a
d
c
2
3
5
f
9Directed graph
- In situations where the sense of direction is
important when describing the relationship
between two elements, a directed graph (digraph)
may be used, the definition for a digraph is
similar to that for an undirected graph, but each
edge is represented as an ordered pair (an arc,
an edge with an arrow) , as shown in the
example.
an arc
a node
a
1
2
b
e
d
c
f
3
4
An example of a directed graph
10Directed graph (cont.)
- A digraph is denoted as G(X,A), where X is the
set of nodes, and A is the set of arcs each arc
is an ordered pair of the nodes. - In the above example, X1,2,3,4 and A (1,2),
(2,1), (2,3), (2,4), (3,1), (4,3) . - Unless specified otherwise, the following terms
and definitions apply to both undirected and
directed graphs.
11Subgraph
- A graph g is a subgraph of G if all its vertices
and edges are in G.
An example
Subgraphs of G
12Network
- A network is a graph where each edge (or arc) is
associated with a number (value). An example is
as follows
-3
- The actual meanings of the numbers depend on the
application. In general they may be positive or
negative. - A network is also called a weighted graph.
13Loop
- A loop is an edge with identical end points, as
shown
a loop
1
2
3
14Planar graph
- A planar graph is a graph which can be drawn with
no two edges crossing each other. An example of a
planar graph is as follows
15A non-planar graph example
1
2
5
3
4
an example of a non-planar graph
16Geometric dual graph
- For any planar graph G, there exists a geometric
dual graph G, which is constructed by placing a
vertex in every region (separated by un-crossed
edges) of G and connecting the new vertices by
drawing an edge across every original edge. An
example is as follows
1
region 1
1
2
1
2
region 2
2
3
4
3
4
The dual of a dual is always the original graph.
17Incidence and degree
- An edge e is said to be incident to a vertex x if
x is an endpoint of e. - Two edges are said to be adjacent if they are
incident to the same vertex. - Two vertices are said to be adjacent (neighbors)
to one another if there is an edge joining them.
- The degree of a vertex is the number of edges
incident to it. In the case of a directed graph,
the in-degree of a node is the number of arcs
directed toward it, and the out-degree of a node
is the number of arcs directed from it.
18Examples
e1
e2
e3
1
2
3
4
graph 1
e4
e1
e3
e5
1
2
3
4
graph 2
e4
e2
e6
5
- In graph 1 e1 is incident to vertex 1 and vertex
2 e2 and e3 are adjacent vertex 2 and vertex 3
are adjacent to one another the degree of vertex
2 is 3. - In graph 2 the in-degree of node 3 is 2 the
out-degree of node 2 is 1.
19Path
- Consider any sequence x1, x2, , xk, xk1 of
vertices (nodes). A path is any sequence of edges
(arcs) e1, e2, , ek such that the endpoints of
ei are xi and xi1 for i1, 2, , k vertex x1 is
called the initial vertex, vertex xk1 is the
terminal vertex. - The length of a path is the number of edges
(arcs) in the path.
20Examples
e1
e2
e3
1
2
3
4
graph 1
a path
e4
a directed path
e3
e1
e5
1
2
3
4
graph 2
a path
e4
e2
e6
5
- In graph 1 above e1,e2, e3 form a path from
vertex 1 to vertex 4 with length equal to 3. - In graph 2 the arcs e1, e3, e5 form a directed
path from vertex 1 to vertex 4. The directions of
the arcs do not matter a path may be formed, for
example, ase1, e2, e4, e5.
21Simple path
- A path is called simple if no more than two edges
are incident to any node in the path.
Flash movie examplea non-simple path
- For a simple graph, there is no need to list out
the edges, it is sufficient to list out the
vertices x1, x2, , xk, xk1
22Cycle
- A cycle is a path whose initial vertex and
terminal vertex are identical, and all the edges
are distinct. - A cycle is said to simple if an intermediate
vertex (not the initial vertex nor the terminal
vertex) appears no more than once.
Flash movie examplea non-simple cycle
Flash movie examplenot a cycle
23Connectivity
- A graph is connected if there is a path joining
every pair of distinct vertices otherwise it is
called disconnected.
24Components of a graph
- The sets of nodes in a graph with paths to one
another are (connected) components. The edges
between these nodes are also part of the
components.
A graph of two components
25Bridge
- If the deletion of an edge e yields a
disconnected subgraph, the edge e is called a
bridge.
Tree
- A graph is called a tree if it is connected and
it contains no cycle. - There is a unique path between two vertices in a
tree.
26Spanning tree
- A spanning tree of a graph G is a subgraph of G
that is a tree and that includes all vertices of
G. - Every connected graph possesses (at least) one
spanning tree. - If there are m vertices in a spanning tree, there
are m-1 edges.
Example in flash movie Not a spanning tree
27Algorithm for finding spanning tree
- Given a connected graph G(N,A)
- Step 1 Let Nn and A (an empty set) where
n is an arbitrary node/vertex in G. - Step 2 if NN, then stop (G(N,A) is the
spanning tree) else go to step 3. - Step 3 Let (i,j) in A be an arc/edge with i in
N, j in N-N. Update N and A byGo to step 2.
Example in flash movie
28Minimum weight spanning trees (MST)
- For a graph G(V,E) with V vertices and E
edges, and a weight wjk for each edge (j,k), a
minimum weight spanning tree (MST for short) is a
spanning tree with minimum sum of edge weights. - Any subtree(i.e., a subgraph that is a tree) of
an MST is called a fragment.
29Prim algorithm for finding MST
- Begin with any vertex. Select the edge of least
weight that is incident on this vertex. - At any intermediate iteration, a subtree is
formed. Select the edge of least weight that
connects some vertex in the subtree to a vertex
not in the subtree. - If the subtree spans all vertices, stop.
Otherwise return to step 2.
Example in flash movie
30Prim algorithm for finding MST reformulated
- Given a connected graph G(N,A) with weight wjk
for each edge (j,k) - Step 1 Let Nn and A (an empty set) where
n is an arbitrary node/vertex in G. - Step 2 if NN, then stop (G(N,A) is the
spanning tree) else go to step 3. - Step 3 Let (i,j) in A be the arc/edge with i in
N, j in N-N with minimum wij for all i and j.
Update N and A byGo to step 2.
Example in flash movie
31Kruskal algorithm for finding MST
- Kruskal algorithm proceeds by building up
simultaneously several fragments that eventually
join into an MST. - It starts with each node/vertex being a single
node/vertex fragment. - It then successively combines two of the
fragments by using the arc/edge that has the
minimum weight (over all arcs/edges that do not
form a cycle when added to the current set of
fragments).
Example in flash movie