Networks and Graphs
Network (graph) : G = (N, A) ( or G = (V, E) )
N ( or V) : set of nodes (vertex)
A ( or E) : set of arcs (link, edge)
N {v1,, vn }, A {e1,, em}, ei (vl , vk ) for some vl , vk N
( undirected, directed )
Definitions :
Path : P {vi , ei , vi , ei ,, vi , ei , vi }
1 1
2
2
k 1 k 1
k
vi ' s distinct, ei j {(vi j , vi j 1 ), (vi j 1 , vi j )}
Walk : path with node and edge repetition allowed
Trail : path with node repetition allowed, edges not
Cycle : C {vi , ei , vi , ei ,, vi , ei , vi }
1
1
2
2
k
k
k 1
{vi1 , ei1 , vi2 , ei2 ,, vik } is a path and vi1 vik 1
(directed cycle )
OR-1 2009
1
Definitions : Path and Cycle
Path between node 1 and node 7
2
5
Cycle
1
7
3
6
4
OR-1 2009
2
A graph G is called acyclic if there does not exist a cycle in G.
Subgraph of G
G’ = (N’,A’) is called a subgraph of G = (N, A) if N’ N, A’ A and the
end points of the arcs in A’ are in N’.
If N’ = N, then G’ is called a spanning subgraph of G.
If N’ N, and A’ = E(N’) A , then G’ is called a subgraph of
G induced by N’.
( E(N’) : set of edges with both end nodes in N’ )
G is called connected (both directed, undirected case allowed) if there
exists a path in G from node i to j for all pair of nodes i, j N.
Tree : connected acyclic graph
Spanning tree of G : spanning subgraph of G which is a tree
Forest : acyclic graph (note that a forest may not be connected, but tree
is connected)
OR-1 2009
3
Induced Subgraph
2
5
1
7
3
6
4
Induced subgraph by V’=(1,3,4,6)
OR-1 2009
4
Properties of a tree.
T = (N, A)
number of arcs = number of nodes – 1
for any u, v N , there exists a unique path connecting u, v.
eliminating an end node and the end arc incident to it results in a tree.
adding an arc creates a unique cycle
(adding an arc and then eliminating an arc in the cycle results in a new
tree)
OR-1 2009
5
Tree
Tree : Connected acyclic graph
2
5
1
Tree
7
3
cycle
6
4
Tree
OR-1 2009
6
Minimum Spanning Tree Problem
Given G = (V, E) undirected, connected graph and weight ce , e E,
find a spanning subgraph of G having minimum weight.
( application in communication network, road network)
Thm:
Let {(V1, E1 ),, (Vk , Ek )} be a forest spanning G. ( each (Vi , Ei ) is a
tree and V1 V2 Vk V , Vi V j i, j )
Let (u, v) be the shortest of all edges with only one endpoint in V1.
Then among all spanning trees containing all edges in E kj 1 E j ,
there is an optimal one containing (u, v).
Pf) Suppose there exists a better(cheaper) spanning tree (V’, E’) that
does not include (u, v) and E E '
Add (u, v) to E’ creates a unique cycle
OR-1 2009
7
(Note that there exists some edge (u’, v’) on the cycle different from (u,
v), with one endpoint of it is in V1. Otherwise contradiction to the
assumption that (V’, E’) is a spanning tree.)
Since (u, v) is a minimum weight edge out of V1 c(u ',v') c(u ,v)
Then, exclude (u’, v’) from the graph. creates a tree which is at
least as good as (V’, E’) and containing E and (u , v)
Contradiction to assumption that (V’, E’) is cheaper than any spanning
tree that contains (u, v) and E .
Note that we can take each node as the node set Vi , i = 1, …, k in the
theorem, which suggests an algorithm for the minimum spanning tree
problem.
We are free to choose the node set V1 .
Prim’s algorithm, Kruskal’s algorithm depending on which node set
we choose as V1 .
OR-1 2009
8
Proof of theorem
u
(V1,E1)
(V4,E4)
7
2
5
2
5
2
4
v
u’
5
1
v’
1
4
(V3,E3)
3
7
7
(V6,E6)
6
4
(V2,E2)
OR-1 2009
1
3
4
(V5,E5)
9
Prim’s algorithm :
Set V1 {v1}, E , V V \ {v1}
While V
Choose an edge with minimum weight among edges with one end
in V1 and another end in V , say (u , v), u V1 , v V
Let V1 V1 {v}, V V \ {v}
E E {(u , v)}
Kruskal’s algorithm :
Order edges of e1 , e2 ,, em so that ce1 ce2 cem
Initially, E , k 1.
If (V , E {ek }) is acyclic, E E {ek }.
If E V 1, stop.
OR-1 2009
Otherwise, E E.
Otherwise, k k 1, repeat theiteration.
10
Minimum Spanning Tree Prob.
(Prim’s algorithm)
7
2
5
2
4
5
1
1
3
3
1
4
7
7
6
4
OR-1 2009
5
2
4
11
Minimum Spanning Tree Prob.
(Kruskal’s algorithm)
7
2
5
2
4
5
1
1
3
1
4
3
7
7
6
4
OR-1 2009
5
2
4
12
A little bit of changes in the problem can make the problem difficult to
solve
(degree constrained minimum spanning tree problem, Steiner tree
problem ; no polynomial time algorithm is known. Probably not exist)
OR-1 2009
13
Maximum Flow Problem
Given a directed graph G = (V, A), capacity of arc ue 0, e A, 2 nodes
s, t V. Find a maximum flow that can be sent from node s to node t
while satisfying the capacity restrictions on the arcs.
Def: Given a directed graph G = (V, A), 2 nodes s, t V
Let (S,S* ) be a partition of V, where sS and tS* ( S* =V\S ).
An s-t cut is defined as the set of arcs +(S) = { (i, j) A: i S, j S*} The
capacity of an s-t cut is the sum of the capacities of its arcs.
(A cut also can be defined for undirected graphs.)
The minimum cut problem is to find an s-t cut of minimum capacity.
Main result : Maximum flow that can be sent from s to t is equal to the
capacity of a minimum s-t cut that separates s and t. ( can be shown using
an algorithm for the maximum flow problem)
OR-1 2009
14
Minimum Cost Flow Problem
Given a directed graph G = (V, A), cost for unit flow ce, capacity of arc
ue 0, e A. Supply (or demand) bi for i V (bi > 0: supply node,
bi < 0: demand node).
Find a minimum cost shipping plan of the commodity that satisfy the
supply and demand at each node and satisfies the capacity
restrictions on each arc. (We assume that sum of supplies = sum of
demands.)
The problem can be formulated as a LP with special structure. ( For
each column in the constraints, exactly one +1, one –1 appear and
other elements are all 0.)
Special algorithm exists which is an implementation of the simplex
method on the graph. Very efficient.
OR-1 2009
15
Formulation of the minimum cost flow problem
minimize
subject to
OR-1 2009
(i, j)A cijxij
{ j : (i, j) A} xij - { j : (j, i) A} xji = bi ,
(out flow - in flow = net flow at node i)
xij uij ,
(i, j)A
xij 0 ,
(i, j)A
i = 1, …, |N|
16
[0]
Ex)
2
(1, 5)
[1]
(1, 10)
[0]
4
(1, 1)
(1, 11)
(1, 3)
1
(1, 9)
(1, 6)
(1, 7)
3
[0]
(1, 2)
6
[-1]
[ bi ]
( uij, cij )
(1, 6)
5
[0]
Formulation:
min 5x12 + 7x13 + 10x24 + 1x25 + 3x32 + 6x34 + 2x35 + 11x45 + 9x46 + 6x56
s.t
x12 + x13
- x12
- x13
+ x24
+ x25 - x32
+ x32
- x24
- x25
+ x34 + x35
- x34
- x35
= 1 (1)
= 0 (2)
= 0 (3)
+ x45 + x46
= 0 (4)
– x45
+ x56 = 0 (5)
– x46
- x56 = -1 (6)
0 xij uij , for all (i, j) A
OR-1 2009
17
Remarks
Constraints called flow conservation constraints
Each column of the constraint matrix (not counting the upper bound
constraints) has one +1 and one -1.
Any basic feasible solution of the above problem (when solved using
simplex method for general LP) is integer valued as long as the right hand
side values are integral.
Min cost flow problem includes many classes of problems as special
cases.
OR-1 2009
18
Ex) maximum flow problem
Suppose want max flow from node 1 to node 6. Convert the problem
to the following form
(, -1)
[0]
2
(1, 0)
[0]
[0]
4
(1, 0)
(1, 0)
1
(1, 0)
(1, 0)
(1, 0)
(1, 0)
3
[0]
OR-1 2009
(1, 0)
(1, 0)
6
[0]
[ bi ]
( uij, cij )
(1, 0)
5
[0]
19
Ex) Shortest path problem
Shortest Path (minimum cost path) Problem
Given a directed graph G = (V, E), length (cost) of arc ce 0, e E,
2 nodes s, t V.
Find a path from s to t with minimum length.
Note
ce 0, e E is an important assumption. If ce 0, efficient algorithms
exist (e.g. Dijkstra’s alg). However, the problem becomes NP-hard if
negative arc costs allowed.
For undirected graph case, replace each edge with two directed arcs with
opposite direction. Use the same cost. Or algorithm for the directed case
can be easily modified for undirected case.
appears as subproblem in many applications (e.g., telecommunication
network routing problem)
OR-1 2009
20
[0]
2
(1, 5)
[1]
(1, 10)
[0]
4
(1, 1)
(1, 11)
(1, 3)
1
(1, 9)
(1, 6)
(1, 7)
3
[0]
(1, 2)
6
[-1]
[ bi ]
( uij, cij )
(1, 6)
5
[0]
Shortest path from node 1 to node 6.
Min cost network flow problem with integer restrictions added.
Using the integrality property of b.f.s. of the min cost flow problem, the
LP relaxation gives integer optimal solution (even without the upper
bound constraints present).
OR-1 2009
21
© Copyright 2026 Paperzz