* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Linear Programming (Optimization)
Piggybacking (Internet access) wikipedia , lookup
Distributed operating system wikipedia , lookup
Network tap wikipedia , lookup
Recursive InterNetwork Architecture (RINA) wikipedia , lookup
Airborne Networking wikipedia , lookup
List of wireless community networks by region wikipedia , lookup
IEEE 802.1aq wikipedia , lookup
Chapter 2
Paths, Trees, and Cycles
1
1.2 Notation and Definitions
Directed Graphs and Networks:
G = (N, A), A: set of ordered pair of distinct nodes
Undirected Graphs and Networks:
G = (N, A) ( G = (V, E) ), A: set of unordered pair of distinct nodes
Tails and Heads:
directed arc (i, j) : i is the tail and j is the head of arc (i, j)
Degrees:
indegree of node i: number of incoming arcs of that node
outdegree of node i: number of outgoing arcs of that node
degree of node i: sum of the indegree and outdegree of node I
Network Theory and Applications 2010
2
Adjacency List:
arc adjacency list A(i) of a node i: set of arcs emanating from that node, A(i)
= {(i, j)A: jN}
node adjacency list A(i) of a node i: set of nodes adjacent to that node, A(i) =
{ jN: (i, j)A}
Property 2.1 iN |A(i)| = m.
Multiarcs and Loops:
multiarcs: two or more arcs with the same tail and head nodes.
loop: arc whose tail node is the same as its head node.
(in most cases, no multiarcs or loops)
Network Theory and Applications 2010
3
Subgraph:
G’ = (N’, A’) is a subgraph of G = (N, A) of N’N, A’A.
G’ = (N’, A’) is a subgraph of G induced by N’ if A’ contains each arc of A
with both ends in N’ (induced subgraph)
spanning subgraph if N’ = N, A’A.
Walk: subgraph of G consisting of a sequence of nodes and arcs i1 – a1 – i2 –
a2 - … - ir-1 – ar-1 – ir satisfying ak = (ik, ik+1)A or (ik+1, ik)A, for 1 k r-1.
(node, arc repetition allowed)
directed walk: oriented version of a walk, (ik, ik+1)A
( trail: walk without arc repetition)
Path: walk without any repetition of nodes (and arcs) (elementary path)
Forward arcs, backward arcs
directed path: directed walk without any repetition of nodes.
( can store a path using predecessor index pred(j) for every j in the path.
Network Theory and Applications 2010
4
Cycle: path with i1 = ir+1
Directed cycle: directed path with arc (ir, i1)
Acyclic network: contains no directed cycle (for undirected network, contains
no cycle. Forest)
Connectivity:
nodes i, j connected if there exists a path from i to j.
A graph is connected if every pair of its nodes are connected. Otherwise,
disconnected
components: maximal connected subgraphs of a disconnected graph
Strongly connected if the graph contains at least one directed path from every
node to every other node.
Network Theory and Applications 2010
5
Cut:
A cut is a set of arcs (i, j)A such that iS, jS or jS, iS, SN. A cut is
represented by [S, S]. ( S = N-S )
(sometimes we consider directed case, iS, jS)
s-t cut: a cut with node sS, tS
Tree: connected graph that contains no cycle (compare with forest)
Property 2.2
a. A tree on n nodes contains exactly n-1 arcs
b. Has at least two leaf nodes (node with degree 1)
c. There exists a unique path between any two nodes
Forest: A graph that contains no cycle (compare with tree)
Network Theory and Applications 2010
6
Subtree: connected subgraph of a tree
Rooted tree: a tree with a specially designated node, called root.
predecessor-successor (or parent-child) relationships
descendants, ancestor
Directed out-tree rooted at node s: the unique path from node s to every other
node is a directed path. (also called arborescence)
Directed in-tree rooted at node s: the unique path from any node to node s is a
directed path.
Spanning tree: A tree T is a spanning tree of G if T is a spanning subgraph of
G.
Network Theory and Applications 2010
7
Fundamental cycles: adding an arc to a tree T creates a unique cycle
(fundamental cycle). Deleting an arc in a fundamental cycle makes a
spanning tree.
Fundamental cuts: deleting an arc in a tree T creates two subtrees T1 and T2.
Arcs whose endpoints belong to the different subtrees constitute a cut
(fundamental cut of G with respect to the tree T).
Bipartite graph: G = (N, A) such that we can partition the nodes into two sets
N1 and N2 so that for each arc (i, j) in A either (i) iN1, jN2, or (ii) iN2,
jN1.
Property 2.3: G is a bipartite graph if and only if every cycle in G contains an
even number of arcs (even cycle).
Definitions for undirected graph similar to the directed graph.
Network Theory and Applications 2010
8
2.3 Network Representations
Performance of the algorithms on networks critically affected by the data
structures used and operations on intermediate results.
Node-Arc Incidence Matrix:
coefficient matrix of the MCF formulation
For arc (i, j) (variable xij), corresponding column has one +1 for i-th position,
one -1 for j-th position, and 0 elsewhere.
(use two, +1’s for undirected graph)
Node-Node Adjacency Matrix:
Hij =1, if (i, j)A
Symmetric for undirected graph, then maintain only upper triangular part
Appropriate for dense graph
Network Theory and Applications 2010
9
Adjacency lists: arc, node adjacency list, use linked list
i
(cij, uij)
i
j
(15, 40)
2
(25, 30)
4
(45, 10)
(15, 30)
(35, 50)
1
(45, 60)
(35, 50)
3
5
(25, 20)
1
j
cij
uij
2 25 30
3 35 50 0
2
4 15 40 0
3
2 45 10 0
4
3 15 30
5 45 60 0
3 25 20
4 35 50 0
5
Adjacency List
Network Theory and Applications 2010
10
Sometimes need to consider the case (i, j)A (j, i)A. Then maintain
additional field for pointer mate ( (i, j) (j, i) )
Adjacency list is compact. Can add, delete arcs easily. The programming
language needs to support pointers.
Network Theory and Applications 2010
11
Forward and Reverse Star Representations:
Forward Star
Store the arcs in a single array instead of linked list
Assign unique sequence number to each arc
• Start with arcs emanating from node 1, then node 2, …
• Arcs emanating from the same node are numbered in an arbitrary fashion.
For each node i, maintain point(i) to point the index of the first outgoing arc from
node i.
If no outgoing arc, set point(i) = point(i+1).
Reverse star stores incoming arcs.
Network Theory and Applications 2010
12
point
i
(cij, uij)
j
(15, 40)
2
(25, 30)
4
(45, 10)
(15, 30)
(35, 50)
1
(45, 60)
(35, 50)
3
5
Tail
head cost capacity
1
1
1
1
2
25
30
2
3
2
1
3
35
50
3
4
3
2
4
15
40
4
5
4
3
2
45
10
5
7
5
4
3
15
30
6
9
6
4
5
45
60
7
5
3
25
20
8
5
4
35
50
(25, 20)
Forward Star Representation
Network Theory and Applications 2010
13
cost capacity tail head
i
(cij, uij)
j
45
10
3
2
1
1
1
25
30
1
2
2
1
2
35
50
1
3
3
3
3
15
30
4
3
4
6
4
25
20
5
3
5
8
5
35
50
5
4
6
9
6
15
40
2
4
7
45
60
4
5
8
(15, 40)
2
(25, 30)
4
(45, 10)
(15, 30)
(35, 50)
1
(45, 60)
(35, 50)
3
5
rpoint
(25, 20)
Reverse Star Representation
Network Theory and Applications 2010
14
point
Tail
head cost capacity
trace
rpoint
1
1
1
1
2
25
30
4
1
1
1
2
3
2
1
3
35
50
1
2
1
2
3
4
3
2
4
15
40
2
3
3
3
4
5
4
3
2
45
10
5
4
6
4
5
7
5
4
3
15
30
7
5
8
5
6
9
6
4
5
45
60
8
6
9
7
5
3
25
20
3
7
8
5
4
35
50
6
6
8
Compact forward and reverse star
Network Theory and Applications 2010
15
2.4 Network Transformations
Undirected Arcs to Directed Arcs :
cij 0, lij = 0 case
undirected case has constraints xij +xji uij. One of xij, xji is 0 in an optimal
solution
i
(cij, uij)
(cij, uij)
j
i
j
(cij, uij)
Network Theory and Applications 2010
16
Removing Nonzero Lower Bounds:
nonzero lower bound lij replace xij by x’ij + lij
lij x’ij + lij uij 0 x’ij uij - lij
In the mass balance eq., results in decresing b(i) by lij and increasing b(j) by lij.
b(j)
b(i)
i
(lij, uij)
j
xij
Network Theory and Applications 2010
b(i) - lij
i
(0, uij – lij )
b(j) + lij
j
x'ij = xij - lij
17
Arc Reversal (removing negative costs):
Let uij be the capacity of upper bound if uncapacitated.
Replace xij by uij – xji (
(First send uij units of flow on (i, j), then use arc (j, i) with cost –cij. The flow
xji measures the amount of flow we ‘remove’ from the ‘full capacity’ flow of
uij )
b(j)
b(i)
i
(cij, uij)
j
xij
Network Theory and Applications 2010
b(j) + uij
b(i) - uij
(-cij , uij )
i
j
xji
18
Removing Arc Capacities:
Introduce an additional node so that the capacity constraint on arc (i, j)
becomes the mass balance constraint of the new node.
Use slack variable: xij + sij = uij -xij - sij = -uij (2.2)
Use (2.2) as the mass balance constraint of an additional node k.
3 appearances of xij , 1 appearance of sij subtract (2.2) from the mass
balance constraint of node j (solutions not changed).
b(j)
b(i)
i
(cij, uij)
j
b(i)
xij
Network Theory and Applications 2010
(cij, )
i
- uij
(0, )
j
k
xij
b(j)+uij
sij
19
Node Splitting (when nodes have capacities and costs):
1. If b(i) > 0, then b(i’’) = b(i) and b(i’) = 0
2. If b(i) < 0, then b(i’’) = 0 and b(i’) = b(i)
3. If b(i) = 0, then b(i’) = b(i’’) = 0
When node i incurs cost ci and capacity ui set ci, ui as cost and capacity
of arc (i’’, i’).
b(j)
b(i)
i
(cij, uij)
j
b(i)
i'
b(j)
(cij, uij)
(0, )
i’’
Network Theory and Applications 2010
j'
(0, )
j’’
20
Working with Reduced Costs:
frequently use node potential (i) for node i to modify cost cij
reduced cost cij of arc (i, j) defined as cij = cij - (i) + (j)
define z() = (i, j)A cij xij
Recall reduced cost for variable xj in LP : cj – y’Aj, where Aj is j-th column of
A and y is vector of dual variables.
For MCF, the reduced cost for variable xij is cij – yi + yj .
at node k: outflow cost change is - (k) outflow
inflow cost change is + (k) inflow
total cost change: - (k) (outflow – inflow) = - (k) b(k)
For all nodes, cost change is - b.
Hence z() = z(0) - b, or z(0) – z() = b, which is a constant. A flow which
minimizes z() also minimizes z(0) and conversely.
Network Theory and Applications 2010
21
Property 2.4. MCF with cij or cij have the same optimal solutions. Moreover,
z() = z(0) - b.
Reduced cost along a directed cycle and a path
Let W be a directed cycle in G. Then
(i, j)W cij = (i, j)W (cij - (i) + (j))
= (i, j)W cij + (i, j)W ((j) - (i))
= (i, j)W cij.
Let P be a directed path from node k to node l. Then
(i, j)P cij = (i, j)P (cij - (i) + (j))
= (i, j)P cij - (i, j)P ((i) - (j))
= (i, j)W cij - (k) + (l).
Network Theory and Applications 2010
22
Working with Residual Networks:
In network flow algorithms, frequently use incremental flow about some given
feasible flow x0 residual network
i
(cij, uij)
j
x0ij
(cij , uij – x0ij)
i
j
(-cij , x0ij)
• If both (i, j) and (j, i) exist, have parallel arcs in residual network.
For notational convenience, assume G has (i, j) or (j, i), but not both. (can use
transformation to make any graph satisfy this property.)
• In practice, network representation can handle parallel arcs.
• For max flow problem, costs are 0, hence can merge parallel arcs as one arc.
Network Theory and Applications 2010
23
For every feasible flow x in G, define flow x’ in the residual network G(x0).
x’ij – x’ji = xij – x0ij ,
x’ij x’ji = 0
If xij x0ij , we set x’ij = (xij – x0ij) and x’ji = 0.
If xij < x0ij , we set x’ij = 0
and x’ji = (x0ij – xij ).
The cost of flow on arc (i, j) in G(x0) is
c’ij x’ij + c’ji x’ji = c’ij(x’ij – x’ji) = cijxij – cijx0ij
c’x’ = cx – cx0.
Network Theory and Applications 2010
24
Note that for MCF problem, the flow in G(x0) is a circulation.
Let x and x0 be feasible flows for MCF. Then xij = (xij’ – xji’) + xij0.
x and x0 satisfy (outflow for x) – (inflow for x) = b(i) for all iN.
(outflow for x0) – (inflow for x0) = b(i) for all iN.
Subtracting both sides, get (outflow for x-x0) - (inflow for x-x0) = 0
From xij - xij0 = (xij’ – xji’), (out – in for (xij - xij0))
= (out – in for (xij’ – xji’)) = 0 for each node i.
Hence the flow in G(x0) is a circulation.
Network Theory and Applications 2010
25