N.V.Belous17.Transportation networks 2 The basic definitions A network is - a connected directed graph without loops. Denote network by G(X,U), where X – the set of vertices, U – the set of arcs. - there is only one vertex with zero number of arcs entering it. This vertex is called a source. - there is only one vertex z with zero number of arcs leaving it. This vertex is called a sink.
N.V.Belous17.Transportation networks 3 The basic definitions Each arc u U is supplied with the nonnegative real number C(u), called capacity of the arc. The vertex x i x 0 ; x i z is called internal vertices. A flow in the arc is a function.
N.V.Belous17.Transportation networks 4 Properties of the flow Properties of the flow : 1. 2., x x0 ; x z, where the set of arcs, entering the vertex x, the set of arcs, leaving the vertex x.
N.V.Belous17.Transportation networks 5 Properties of the flow A flow in the arc u can be considered as the velocity in which material is transported through the arc u, so material is not accumulated in vertices of the network. Therefore the amount of the material, that is transported from the source is equal to the sum amount of the material, that is transported into the sink. 3., where corresponds to the value of a flow in the network.
N.V.Belous17.Transportation networks 6 Cut of the flow Lets consider the task: A – an arbitrary set of vertices x 0 A and z A; – complement of set A, z A, but x 0 – the set of arcs, entering to the set A; – the set of arcs, leaving to the set A. The set is called a cut of a network. A cut contains arcs that terminate in the set and ordinate in the set A.
N.V.Belous17.Transportation networks 7 Properties of the flow Example a cut
N.V.Belous17.Transportation networks 8 Properties of the flow 4. The capacity of the cut is the sum of arcs capacities, belonging to this cut. 5.,where C(A) – capacity of the cut A. The value of a flow in the network is not grater than the capacity of any cut.
N.V.Belous17.Transportation networks 9 Maximal flow problem The Ford-and-Falkerson theorem Lets value of network flow and capacity of cut V such equality is true: then is the maximal flow that can be passed through the network and V has the minimal capacity from all the cuts in this network. Then V is called the minimal cut.
N.V.Belous17.Transportation networks 10 Ford-and-Falkerson algorithm An arc u is called saturated if An arc u is called empty if An arc u is called busy if The algorithm consists of two stages: Ι Find some complete flow ΙΙ Evaluation maximal flow by given labels to the network vertices
N.V.Belous17.Transportation networks 11 Ford-and-Falkerson algorithm Let be some flow distributed of an arcs of a network. Find the complete flow when every path from x 0 to z contains at least one saturated arc.
N.V.Belous17.Transportation networks 12 Stage ΙFord-and-Falkerson algorithm Stage Ι Ford-and-Falkerson algorithm Step 1. Let is difference between the capacity of each arc and the flow in this arc. =1. Arcs (x 1, x 4 ) and (x 4,z) are saturated. Step 2. =1. Arc (x 1, x 2 ) is saturated.
N.V.Belous17.Transportation networks 13 Stage ΙFord-and-Falkerson algorithm Stage Ι Ford-and-Falkerson algorithm Step 2. =1. Arc (x 1, x 2 ) is saturated. Step 3. =1.Arc (x 2, x 3 ) is saturated.
N.V.Belous17.Transportation networks 14 Stage ΙFord-and-Falkerson algorithm Stage Ι Ford-and-Falkerson algorithm Step 3. =1.Arc (x 2, x 3 ) is saturated. Step 4. =1.Arc (x 0, x 3 ) is saturated. corresponds to the complete flow, because each path from x 0 to z contains at least one saturated arc.
N.V.Belous17.Transportation networks 15 Stage ΙΙ The process of labeling Stage ΙΙ. The process of increasing the flow φ u consists in labeling the vertices of the network by indexes, that indicate the path where can be changed. If such label can reach the sink z that the flow φ u can be increased. After this vertices are labeled again.
N.V.Belous17.Transportation networks 16 Stage ΙΙ Algorithm of labeling vertices Algorithm of labeling vertices 1. x 0  label 2. Labeling vertex. If x i has already a label then the label [+i] assign to all unlabeling ajacence to x 0 vertices when the flow f z pass through the unbusy arc and the direction of the flow f z coincide with the direction of the considered arc. The label [-i] assign to all unlabeling vertices that are connected with x i by busy arc with head in x i
N.V.Belous17.Transportation networks 17 Stage ΙΙ Algorithm of labeling vertices 3. If the process of labeling vertices reaches the vertex z then go to the step 4 else the flow, received on to the previous step was the maximal value. 4. Exists x 0 – z path with distinct vertices labeled (accurate to the sign) with the number of previous vertices. Path is built, starting form the vertex z.
N.V.Belous17.Transportation networks 18 Stage ΙΙ Algorithm of labeling vertices The flow of the arc φ u corresponds to: a new flow is received Go to the step 1.
N.V.Belous17.Transportation networks 19 Stage ΙΙ Algorithm of labeling vertices The sink z was labeled. There is a path : x 0, x 2, x 4, x 3,z where the flow can be increased. Increase the flow in such arcs: (x 0, x 2 ),(x 4, x 3 ),(x 3,z) by one. Decrease the flow in the arc (x 4, x 2 ) by one.
N.V.Belous17.Transportation networks 20 Stage ΙΙ Algorithm of labeling vertices There is a path = x 0, x 2, x 4, x 3,z, where the flow can be increased. Permits the flow φ u is increased in arcs (x 0, x 1 ),(x 1, x 2 ),(x 4, x 3 ),(x 3,z) and is decreased in (x 4, x 2 ) The vertex z is not labeled then the flow received at the previous step was the maximal. – maximal flow.