Chapter 15 Directed Graphs and Networks PWE...

Preview:

Citation preview

Chapter(15(–(Directed(graphs(&(networks(

Page 1 of 27

!

Further'Mathematics:"Module'5:!

CHAPTER(15:"Directed"graphs"and"networks!!A(directed(graph((digraph)(is(a(graph(/(network(where(every%edge%has%a%direction.%%(They(can(be(used(to(represent(many(situations,(such(as(traffic(flow,(competitions(between(teams(or(the(order(of(activities(in(a(production(line.((This%chapter%includes:%(

• Graphical(and(matrix(representation(of(directed(graphs((networks),(including(application(to(dominance(and(reachability;;(((

• Critical(path(analysis,(including(network(construction((with(activity(as(edge),(location(of(the(critical(path(by(forward(and(backward(scanning;;(((

• Network(flow(‘minimum(cutKmaximum(flow’(theorem(((• Assignment( problems,( for( example,( representation( by( bipartite( graph;( optimal( allocation(

including((use(of(the(Hungarian(algorithm.((In(this(module(it(is(expected(that(students(will(have(developed( a( working( knowledge( of( the( following( terms:( graph,( subgraph,( vertex( (=( node),(edge,(degree(of(a(vertex,( loop,( isolated(vertex,(connected(graph,(circuit,( tree,(spanning(tree,(complete(graph,( simple(graph,(bipartite(graph,(digraph,( reachable,(Hamiltonian(and(Eulerian(paths((lines)(and(circuits,(network,(cutKset,(capacity,(planar(graph,(adjacency(matrix((loop(=(1(edge)( critical(path,(dummy(activity,(earliest(and( latest( start(and( finish( times,( ‘crashing’( (as(a(means( of( shortening( the( critical( path)( and( float( (slack)( in( nonKcritical( activities.( Matrix(arithmetic(is(not(required(but(may(be(used.(((

Questions!15A! 1(a,!c),!2,!4,!5,!7,!9,!10!15B! 1,!2,!3,!5,!6,!8,!10,!11,!12!!15C! 2,!4,!5,!6,!7,!8,!9,!10,!11,!12,!15,!16,!17,!!20,!21!15D! 1(a,!c),!3,!4,!5(a,!c),!6,!7(a,!c),!8,!10,!14(a,!c),!15,!16,!17!15E! 1,!2,!3,!4,!6,!7,!8,!9,!11,!12(a,!c),!13,!14,!16,!17!

Further resources

http://drweiser.weebly.com

Chapter(15(–(Directed(graphs(&(networks(

Page 2 of 27

(

(

Table!of!Contents!

(

FURTHER!MATHEMATICS:!MODULE!5:! 1(

CHAPTER!15:!DIRECTED!GRAPHS!AND!NETWORKS! 1(

QUESTIONS! 1(TABLE!OF!CONTENTS! 2(

15A!REACHABILITY!AND!DOMINANCE!IN!DIRECTED!NETWORKS! 3(

REACHABILITY! 3(PATHWAYS!FROM!TOWN!A!TO!TOWN!C! 3(MATRIX!REPRESENTATION! 3(DOMINANCE! 5(

15B!CRITICAL!PATH!ANALYSIS! 7(

FORWARD!SCANNING! 8(COMPLETING!A!FORWARD!SCAN! 8(

15C!CRITICAL!PATH!ANALYSIS!WITH!BACKWARD!SCANNING! 10(

BACKWARD!SCANNING! 10(DUMMY!ACTIVITIES! 13(CRASHING! 15(

15D!NETWORK!FLOW! 16(

FLOW!CAPACITIES!AND!MAXIMUM!FLOW! 16(EXCESS!FLOW!CAPACITY! 18(MINIMUM!CUT!–!MAXIMUM!FLOW!METHOD! 19(EDGES!THAT!FLOW!BACK!INTO!THE!CUT! 21(

15E!ASSIGNMENT!PROBLEMS!AND!BIPARTITE!GRAPHS! 22(

ALLOCATION!PROBLEMS!AND!THE!HUNGARIAN!ALGORITHM! 24(OPTIMAL!ALLOCATION! 24(HUNGARIAN!ALGORITHM! 24(

!!

Chapter(15(–(Directed(graphs(&(networks(

Page 3 of 27

15A!Reachability+and+Dominance+in+Directed+Networks((

Reachability!Reachability(is(the(concept(of(how(it(is(possible(to(go(from(one(vertex(in(a(directed(network(to(another(following(a(particular(pathway.(

• A(one2stage%pathway(is(one(that(includes(one(edge(only.(• A(two2stage%pathway(is(one(that(contains(two(edges(only.(

(

Edges(have(arrows(to(indicate(their(direction(into(or(out(of(a(vertex.(• The(indegree(is(the(number(of(edges(moving(into(a(vertex.(• The(outdegree(is(the(number(of(edges(moving(away(from(a(vertex.((

(

PATHWAYS!FROM!TOWN!A!TO!TOWN!C!(

(Matrix!Representation!The(matrix(for(all(possible(one1stage%pathways(is(known(as(the(adjacency%matrix.((denoted%A)(The(adjacency(matrix(for(the(network(above(is:(

((( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( (

(Outdegree((=(the(sum(of(vertex(row((Indegree((=(the(sum(of(vertex(column(((

The(matrix(for(all(of(the(possible%two1stage%pathways((is(denoted(by(!!)(is:((

( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( (

(A(three2stage%pathway(is(_______(,((A(four2stage%pathway(is(__________(

Chapter(15(–(Directed(graphs(&(networks(

Page 4 of 27

(Example:(Wendy(is(a(businesswoman(working(in(town(A(and(wishes(to(meet(with(a(colleague(in(town(D.(She(also(needs(to(pick(up(some(documents(from(town(B(to(take(to(the(meeting.((((a) Find(the(number(of(twoKstage(paths(that(Wendy(could(

take(and(name(them.((((((b) Find(the(number(of(threeKstage(paths(that(Wendy(could(take(and(name(them.((((((c) Represent(the(oneKstage(and(twoKstage(pathways(of(the(directed(network(in(matrix(form.((((One(stage(pathways((((((((((Two(stage(pathways(((((!( !

( ( ( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( ( ( (

Chapter(15(–(Directed(graphs(&(networks(

Page 5 of 27

Dominance!If(an(edge(in(a(directed(network(moves(from(A(to(B,(then(it(can(be(said(that(A(is(dominant,(or(has(a(greater(influence,(over(B.((

Generally(speaking,(if(there(are(more(ways(to(go(from(A(to(B(than(there(are(to(go(from(B(to(A,(then(A(is(the(dominant(vertex.((Two(techniques(for(determining(the(dominant(vertex(in(a(directed(network:(((a) simple(inspection(of(the(network((

(b) finding(the(matrix(addition(! + !!!(and(summing(the(rows(of(this(resultant(matrix.(The(row(with(the(highest(sum(corresponds(with(the(dominant(vertex.(

(Example:!!Find(the(dominant(vertex(in(the(following(network.((

(

((

(Method:(a) simple(inspection((((((

b) (! + !!((

((((((! !

( ( ( ( ( ( ( ( ( ( ( ( ( ( (

( ( ( (

+(

( ( ( (

=(

( ( ( ( (

( ( ( ( ( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( ( ( ( ( ( ( (

Chapter(15(–(Directed(graphs(&(networks(

Page 6 of 27

Example:(The(results(of(a(round(robin((each(competitor(plays(each(other(once)(tennis(competition(are(represented(by(the(directed(graph(at(right.(((a) By(inspection,(determine(the(dominant(vertex((dominant(

competitor);(that(is,(the(winner.(Rank(the(competitors(in(finishing(order.(((((((

(b) Confirm(your(answer(to(part((a)(by(finding(the(matrix,(! + !!!,(and(summing(the(rows(of(this(matrix.(((

(((((((((((((((((

( (

( ( ( ( ( ( ( ( ( ( ( ( ( ( (

( ( ( (

+(

( ( ( (

=(

( ( ( ( (

( ( ( ( ( ( ( ( ( ( ( ( (

( ( ( ( ( ( ( ( ( ( ( ( ( ( (

Chapter(15(–(Directed(graphs(&(networks(

Page 7 of 27

15B$Critical$Path$Analysis(• Edges(represent(activities(and(nodes(represent(the(start(and(end(of(activities.(• Edges(are(labelled(with(the(activity(letter(and(the(time(it(takes(to(complete(that(activity.(• Arrows(indicate(the(direction.((Immediate!predecessor(–(an(activity(that(must(be(completed(immediately(before(the(next(activity(can(start.(!Example:!Frieda’s(morning(schedule(is:(

• she(eats(her(cooked(breakfast((6(min)(• downloads(her(email((1(min)(• reads(her(email((2(min)(

Frieda(must(complete(all(these(tasks(in(7(minutes.(How(can(she(accomplish(this?(Clearly,(she(needs(to(be(able(to(do(some(tasks(simultaneously.(Although(this(seems(like(a(simple(problem,(let(us(look(at(what(might(happen(each(minute.((

Time! Activity! Activity!1st(minute( Download(email( (2nd(minute( Eat(breakfast( (3rd(minute( Eat(breakfast( (4th(minute( Eat(breakfast( (5th(minute( Eat(breakfast( Read(email(6th(minute( Eat(breakfast( Read(email(7th(minute( Eat(breakfast( (

(((Another(way(of(representing(this(information(is(in(an(activity(chart.(Activity!letter( Activity( Predecessor( Time!(min)(

( ( ( (( ( ( (( ( ( (

(A(directed%graph%or(directed%network%can(be(used(to(represent(the(flow(of(activities.((((((((

! !

Chapter(15(–(Directed(graphs(&(networks(

Page 8 of 27

Forward!scanning!Allows(us(to(calculate(the(earliest(start(times(for(each(activity(and(the(earliest(completion(time(for(the(whole(project.(((Earliest%Start%Time%(EST)(K(earliest(that(any(activity(can(be(started(after(all(prior(activities(have(been(completed.(((Earliest!completion!time(–(earliest(we(can(finish(the(project.((

Completing!a!forward!scan!• Place(a(pair(of(square(boxes(at(beginning(of(each(edge.(• Enter(the(earliest(start(time(for(each(edge(in(the(first(square.((• Follow(the(path(along(activities(that(cannot(be(delayed((activities(that(take(the(longest).(• Add(values(along(the(path(and(write(it(in(the(first(square.(• Where(two(or(more(edges(lead(into(a(node,(choose(the(largest(value.(((Example:!Use(forward(scanning(to(determine(the(earliest(completion(time(for(Frieda’s(initial(three(tasks.((((

(((((((((((Earliest(completion(time(for(Frieda’s(tasks(is(_______________________((((

!!!Critical!path(K(a(path(through(the(network(which(follows(those(activities(that(cannot(be(delayed(without(causing(the(entire(project(to(be(delayed.(((

Chapter(15(–(Directed(graphs(&(networks(

Page 9 of 27

(Let(us(now(extend(Frieda’s(activity(chart(to(a(more(complex(set(of(activities(for(her(morning(routine.(

(Activity( Activity( Predecessor( Time!(min)(A( Prepare(breakfast( —( 4(B( Cook(breakfast( A( 2(C( Eat(breakfast( B,(E,(G( 6(D( Have(shower( A( 4(E( Get(dressed( D( 4(F( Brush(teeth( C,(H( 2(G( Download(email( A( 1(H( Read(email( B,(E,(G( 2(

Total(time( 25((

Draw( a( network( diagram( for( these( activities( listed( in( Frieda’s(morning( routine.( Find( the( earliest( completion(time(and(hence(identify(those(tasks(that(may(be(delayed(without(extending(the(completion(time.(Identify(the(critical(path.(

(((((((((((((((((((((((((((!

!

Chapter(15(–(Directed(graphs(&(networks(

Page 10 of 27

15C$Critical$Path$Analysis$with$Backward$Scanning!Backward( scanning( is( a(more( formal(method( to(enable( float( times( to(be( calculated(and( the( critical(path(to(be(determined.(((

Backward!scanning!• Start(placing(a(pair(of(squares(at(the(beginning(of(each(edge.(• First(complete(a(forward(scanning(by(entering(the(EST(for(activities(in(the(first(square.(• At(the(end(node,(write(the(same(number(in(first(square(as(in(the(second(square.(

• Take(the(number(of(the(second(square(of(the(last(node(moving(backwards(and(subtract(the(activity(time(of(that(edge.(Place(that(value(in(the(second(square(at(the(beginning(of(that(edge.(

• Where(two(or(more(edges(come(together(at(one(edge,(record(the(smaller!number(in(the(second(square.(

• Continue(until(returning(to(the(starting(node.(((

Float(Time(for(an(activity(

=( Latest(Start(Time(of(the(activity(

(LSTx)(

−( Earliest(Start(Time(of(the(activity((ESTx)(

!

!"#$%!!"#$! = !"#! − !"#!!(

!"#! = !"#! + !!((Critical(path(is(the(path(where(the(edges(have(the(same(number(in(both(squares.((Activities(on(the(critical(path(have(zero(float(time.(!

Latest(Finish(Time!of(an(activity((LFTx)(

=( Latest(Start(Time(of(the(activity(

(LSTx)(

+( Time(of(the(activity((Tx)(

!RULES!FOR!CRITICAL!PATH!ANALYSIS!!

Rule!1((Two(nodes(can(be(connected(directly(by(a(maximum!of!one!edge.(

((This(does!NOT(meet(rule(1!

Rule!2!!An(activity(must(be(represented(by(exactly!one!edge.(

((This(does!NOT(meet(rule(2!

!!!

Chapter(15(–(Directed(graphs(&(networks(

Page 11 of 27

Example:!!Use(forward(and(backward(scanning(to(clearly(display(the(critical(path(and(to(list(any(float(times.(• Forward(scan,(record(the(Earliest(Start(Time(in(the(first(square.(• Backward(scan,(write(the(same(number(of(the(first(square(in(the(second(square.(Take(the(number(

of(the(second(square(of(the(last(node(moving(backwards(and(subtract(the(value(of(the(edge.(Place(that(value(in(the(second(square(at(the(beginning(of(that(edge.(((

(((The(critical(path(is(identified(where(the(number(in(both(squares(are(the(same.(((Calculate(the(float(times(using(the(formula(below.(((

FTx((Float(timex)(=(LSTx(−(ESTx(((

Activity!(edge)(

Activity!Timex!

Earliest!Start!Timex%First(square(at(start(of(edge(

Latest!Start!Timex%Second(square(at(start(

of(the((edge(

Float!time!=!LSTx!`!ESTx!

A( 3( 0( 0( 0(−(0(=(0(

B( 5( 0( 2( 2(−(0(=(2(

C( 6( ( ( (

D( 2( ( ( (

Chapter(15(–(Directed(graphs(&(networks(

Page 12 of 27

Example:!!The(chart(at(right(has(been(given(to(an(Operations(Manager.(The(activities(have(been(simplified(to(letter(names.(The(manager(is(required(to(find(all(critical(activities(and(the(earliest(completion(time(for(the(project(by:(((((((a) creating(a(network(diagram.((b) completing(a(forward(scan,(and(determining(the(earliest(

completion(time.((c) completing(a(backward(scan(and(identifying(the(critical(path.((d) calculating(the(float(times(for(each(activity.(!Solution!(a) (Creating(a(network(diagram.(

((

((

((((((((((((

((((b) Complete(a(forward(scan(by(filling(in(the(first(square.(((c) Complete(a(backward(scan(by(filling(in(the(second(square.(((

Identify(the(critical(path(where(the(numbers(in(both(squares(are(the(same.(((

Earliest(completion(time(=(________________(Critical(path(is(_______________(((( (

Chapter(15(–(Directed(graphs(&(networks(

Page 13 of 27

((d) Calculate(the(float(times(in(the(table(below.(

Activity(Letter(

Immediate(predecessor(

Tx( ESTx( LSTx( Float(time(=(LSTx(−(ESTx((

A( −( 3( 0( 0( F(=(0(−(0(=(0(

B( −( 4( 0( 2( F(=(2(−(0(=(2(

C( B( 6( ( ( F(=(6(−(___((=(___(

D( A( 15( ( ( (

E( A( 4( ( ( (

F( E( 7( ( ( (

G( E( 2( ( ( (

H( C,(G( 4( ( ( (

I( F,(H( 2( ( ( (

J( D,(I( 3( ( ( (

K( D,(I( 4( ( ( (

M( J( 2( ( ( (

N( K( 3( ( ( (

(

Activities!on!the!critical!path!have!a!float!time!of!zero.!!Dummy!Activities!A(dummy%activity%is(an(edge(that(must(be(added(to(avoid(a(network(with(two(or(more(activities(having(the(same(name(or(occurring(in(parallel.((Example:!!Introduce(a(dummy(edge(to(the(network(diagram.(

(((

((( ( ( ((( ( ( (((

(!((Therefore,(not(only(is(A(the(immediate(predecessor(of(C,(but(B((via(B’,(with(a(time(=(0)(is(also(effectively(the(immediate(predecessor(of(C.(!! !

, . .

1

)1 , . .

, . . .

( .

.

,.

,

. , .

, .

,

Chapter(15(–(Directed(graphs(&(networks(

Page 14 of 27

Example:!!From(the(table(below(construct(a(network(diagram.((

(((( (

Chapter(15(–(Directed(graphs(&(networks(

Page 15 of 27

Crashing!Crashing(is(a(method(that(speeds(up(the(completion(time(of(a(project(by(shortening(the(critical(path.(%

Example:!Take(the(critical(path(found(in(the(network(in(a(previous(example((below).((To(shorten(the(overall(completion(time(of(the(project:(• activity(A(is(to(be(shortened(to(2(days.((• activity(D(is(to(be(shortened(to(12(days.((!(((Determine(the(new(critical(path(and(new(minimum(completion(time(for(the(project.((

Redraw(the(network(with(the(new(completion(times(by(calculating(the(Earliest(Start(Time(and(Latest(Start(Time((forward(and(backward(scanning).(!

((((((((((((((

((The(new(critical(path(is(_____________________________(((

The(new(minimum(completion(time(is(____________________(

!

( (

Chapter(15(–(Directed(graphs(&(networks(

Page 16 of 27

15D$Network$flow!Flow!capacities!and!maximum!flow!• The(network’s(starting(node(s)(is(called(the(source.(This(is(where(all(flows(commence.(

• The(flow(goes(through(the(network(to(the(end(node(s)(which(is(called(the(sink.(

• The(flow%capacity%(capacity)(of(an(edge(is(the(amount(of(flow(that(an(edge(can(allow(through(if(it(is(not(connected(to(any(other(edges.(

• The(inflow%of(a(node(is(the(total(of(the(flows(of(edges(leading(into(the(node.(

• The(outflow%of(a(node(is(the(minimum%value(obtained(when(one(compares(the(inflow(to(the(sum(of(the(capacities(of(all(the(edges(leaving(the(node.(

(Consider!the!following!figures.!All(flow(commences(at(A.(It(is(therefore(the(source.(All(flow(converges(on(F(indicating(it(is(the(sink.(((((((((B(has(an(inflow(of(100.(The(flow(capacity(of(the(edges(leaving(B(is(30(+(20(+(10(=(60.((The(outflow(is(the(minimum(of(these(two(values,(which(is(60.(((((((B(still(has(an(inflow(of(100(but(now(the(capacity(of(the(edges(leaving(B(is(80(+(20(+(30(=(130.(The(outflow(from(B(is(now(100.((((((((The(flow%capacity%of%the%network%is(the(total(flow(possible(through(the(entire(network.(!! !

Chapter(15(–(Directed(graphs(&(networks(

Page 17 of 27

Example:!!Convert(the(information(presented(in(the(following(table(to(a(network(diagram,(clearly(indicating(the(direction(and(quantity(of(the(flow.((

From! To( Quantity!(L/min)!! Demand!(E)*!

Rockybank(Reservoir((((R)( Marginal(Dam((((M)( 1000( —(

Marginal(Dam(((((((((((((((M)( Freerange(((((((((((F)( 200( 200(

Marginal(Dam(((((((((((((((M)( Waterlogged((((((W)( 200( 200(

Marginal(Dam(((((((((((((((M)( Dervishville((((((((D)( 300( 300(

(By(inspection,(determine:((a) The(flow(capacity(of(the(network.(((b) Whether(the(flow(through(the(network(is(sufficient(to(meet(the(demand(of(all(towns.(((((((((((((((((((((((((a) The(flow(capacity(of(the(network(is(the(maximum(flow(through(Marginal(Dam((M).((In(this(case,(

the(network(flow(capacity(is(_______________.(

(

(b) Since(the(total(flow(demand(of(all(towns(is(_______________(and(the(network(flow(capacity(is(

_______________.((Hence(it(is(possible(to(conclude(that(the(flow(through(the(network(is(

_______________(to(meet(the(demand.(

% %

Chapter(15(–(Directed(graphs(&(networks(

Page 18 of 27

Excess!flow!capacity!Excess(flow(capacity(is(the(surplus(of(the(capacity(of(an(edge(less(the(flow(into(the(edge.(!

Example:!A(new(dairy(factory((Creamydale((C))(is(to(be(set(up(on(the(outskirts(of(Dervishville.(The(factory(will(require(250(L/min(of(water.((a) Determine(whether(the(original(flow(to(Dervishville(is(sufficient.((((((((((((((((((

((b) If(the(answer(to(part((a)(is(no,(is(there(sufficient(

flow(capacity(into(Marginal(Dam(to(allow(for(a(new(pipeline(to(be(constructed(directly(to(the(factory(to(meet(their(demand?((

((((((((((((((((c) Determine(the(maximum(flow(through(the(network(if(the(new(pipeline(was(constructed.((!! !

Adding a new dairy factory, Creamydale (C), to the existing network.

Chapter(15(–(Directed(graphs(&(networks(

Page 19 of 27

Minimum!cut!–!Maximum!flow!method!To(determine(the(maximum(flow,(the(network(first(needs(to(be(divided(or(‘cut’(into(two(parts.((• A(cut% in(a(network(diagram(is(a( line(drawn(through(a(number(of(edges(which(stops(all%flow(from(

the(source(to(the(sink.(• The(value(of(the(cut(is(the(total(flow(of(the(edges(that(are(cut.(• The(flow(value(of(an(edge(which(heads(back(inside(a(cut(is(excluded.(• The(minimum%cut%is(the(cut(with(the(smallest(value.(• The(maximum%flow%through(a(network(is(equal(to(the(minimum(cut(value.((

Maximum!flow!=!Minimum!cut!value.!!

A!valid!cut!MUST!separate!the!source!and!sink!Example:!!Which,(if(any,(of(the(cuts(are(invalid?((

!!

(

!!

Example:!!!Determine(the(minimum(cut(that(would(allow(the(maximum(flow(through(the(network((

!(!!!!!

Chapter(15(–(Directed(graphs(&(networks(

Page 20 of 27

Example:!!For(the(network(below,(determine(all(possible(cuts(and(calculate(the(value(of(each(cut.(Find(the(minimum(cut(and(hence(the(maximum(flow(through(the(network.((

!!!!

!!

! ! ! !(

(

(

(

Value(of(cut(1(=((8(+(3(+(7(=(18((((((((((((((((((((( (___________________________( (

Value(of(cut(2(=(( __________________________(( (____________________________( (

Value(of(cut(3(=(( __________________________(( (____________________________( (

Value(of(cut(4(=(( __________________________(( (____________________________( ( (

Value(of(cut(5(=(( __________________________(( (____________________________( (

Value(of(cut(6(=(( __________________________(( (____________________________( (

The(value(of(the(minimum(cut(is(____,(therefore,(the(maximum(flow(is(____.(

(

!

Chapter(15(–(Directed(graphs(&(networks(

Page 21 of 27

Edges!that!flow!back!into!the!cut!• Some(cuts(contain(edges(that(head(back(inside%the(cut.((• If(an(edge(does(this,(its(value(is(ignored(in(the(calculation(of(the(cut(value.((• The(inside(of(a(cut(is(the(side(on(which(the(source(node(lies((shaded(below)(

(((((((((((((

((((((((((((((((

(((((((((((Determine(the(minimum(cut,(maximum(flow(for(the(above(circuit.((Cut(3(=(( ____________________________________________________________________( (

Cut 2 Edges: The edge ______ heads into the cut, so the flow value is ignored when calculating the cut value.

Cut 1 Edges: The edge ______ heads into the cut (shaded region), so the flow value is ignored when calculating the cut value

Chapter(15(–(Directed(graphs(&(networks(

Page 22 of 27

15E$Assignment$Problems$and$Bipartite$Graphs!Representing!information!as!bipartite!graphs!The(Shiny(Shoe(Company(makes(shoes(at(two(factories,(one(at(Alphaville(producing(200(pairs(per(day,(the(other(at(Beta(City(producing(300(pairs(per(day.((It(ships(them(to(three(distributions:(Fartown,(who(want(50(per(day,(Giver(River,(who(want(250(pairs(per(day(and(Hamlet,(who(want(200(pairs(per(day.(Represent(this(information(as(a(bipartite(graph.!! !

Chapter(15(–(Directed(graphs(&(networks(

Page 23 of 27

!Bipartite!graphs!Bipartite(graphs(have(nodes(that(can(be(separated(into(two(types(K(supply(and(demand.(Example:!

Student! Subjects!taken!Alice( Biology,(Chemistry(Betty( Chemistry.(Physics(Carla( Biology,(Chemistry,(Psychology(Diane( Psychology(

(a. Represent(this(information(as(a(bipartite(graph.(

((((((((((((((((

b. Determine(whether(the(following(statements(are(true(or(false:((

(i) Alice(studies(more(Science(subjects(than(Carla(does.((((((((

(ii) Between(Carla(and(Betty(all(Science(subjects(are(studied.((((((((

(iii) Between(Alice(and(Betty,(more(subjects(are(studied(than(by(Carla.((((

!

Chapter(15(–(Directed(graphs(&(networks(

Page 24 of 27

Allocation!Problems!and!the!Hungarian!Algorithm!The(optimal%allocation(is(allocating(the(right(person(for(the(right(job(in(order(to(reduce(cost(or(time.(

(

Optimal!allocation!!

1 Perform(row(reductionK(subtract(smallest(number(in(each(row(from(all(the(numbers(in(that(

row.(

2 Cover(all(zeros(with(the(smallest(number(of(HORIZONTAL(and/or(VERTICAL(straight(lines.(!

If(the(number(of(lines(match(the(number(of(jobs(stop,!go!to!step!7.!!

If(not(perform(column(reduction.(

3 Column(reduction(K(subtract(smallest(number(in(each(column(from(all(the(numbers(in(that(

column.(

4 Cover(all(zeros(with(the(smallest(number(of(straight(lines((horizontal(or(vertical(only).((If(the(

number(of(lines(matches(the(number(of(jobs(stop,!go!to!step!7.!!If(not(perform(the(Hungarian(

algorithm.(

(

(

HUNGARIAN!ALGORITHM!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!(

5 (i)(Find(the(smallest(uncovered(number(and(add(this(number(to(all(covered(numbers.((

( (( At(the(intersections(of(straight(lines,(add(this(number(twice.((

( (ii)(Subtract(the(overall(smallest(number(from(all(the(numbers(in(the(matrix(

6 Cover(all(zeros(with(the(smallest(number(of(straight(lines((horizontal(or(vertical(only).(

7 Produce(a(bipartite(graph((zero’s(represent(allocations)(

8 List(possible(allocations((

(

! !

Chapter(15(–(Directed(graphs(&(networks(

Page 25 of 27

Example:!A(building(site(has(three(more( jobs(to(be(done(by(the(three(remaining(workers,(Alan,(Bob(and(Carl.(The( time( taken( by( each( to( do( the( three( jobs( is( given( in( the( table( below.( Determine( the( optimal(allocation(and(hence(state(the(minimum(time.((

! Job!X! Job!Y! Job!Z!

Alan! 10( 4( 9(

Bob! 8( 11( 10(

Carl!! 9( 8( 7(

!!Step!1%2%Perform%row%reduction%by%finding%the%smallest%value%in%each%row%and%subtract%it%from%all%numbers%in%that%row.%%%

! Job!X! Job!Y! Job!Z!

!!Alan! ( ( (

Bob! ( ( (

Carl!! ( ( (

((Step!2%2%Cover%all%zeros%with%the%smallest%number%of%lines%(use%only%horizontal%or%vertical%lines).%If%the%number%of%lines%equals%the%number%of%jobs%to%be%allocated,%then%process%to%the%next%step.%Produce(a(bipartite(graph.(((((((((((Determine(the(optimal(allocation.((((((Determine(the(minimum(time.(((((

X Y Z

A

B

C

Chapter(15(–(Directed(graphs(&(networks(

Page 26 of 27

Example:!Amy,(Beth,(Cate(and(Dana(offer(quotes(on(how(much(each(of(them(will(charge(($)(to(complete(four(different(jobs,(P,(Q,(R%and(S,(summarised(in(the(table(below.(Use(the(Hungarian(algorithm(to(minimise(the(total(cost(to(complete(the(four(jobs,(one(job(per(person.((

( P! Q! R! S!

Amy! 17( 24( 42( 21(

Beth! 25( 18( 19( 20(

Cate! 29( 14( 31( 22(

Dana! 11( 20( 17( 14(

(1. Row(reduction(((((

((((((

(2. Cover(all(zeros(above(with(the(smallest(number(of(straight(lines(

(((3. Column(reduction(on(columns(without(zeros(

(

( P! Q! R! S!

A! ( ( ( (

B!! ( ( ( (

C!! ( ( ( (

D!! ( ( ( (

((

4. Cover(all(zeros(above(with(the(smallest(number(of(straight(lines((((

( (

( P! Q! R! S!

A! ( ( ( (

B!! ( ( ( (

C!! ( ( ( (

D!! ( ( ( (

Chapter(15(–(Directed(graphs(&(networks(

Page 27 of 27

(

5. Perform(Hungarian(algorithm(((i) Add(smallest(uncovered(number(to(all(covered(number.((

At(intersections(add(twice.((

( P! Q! R! S!

A! ( ( ( (

B!! ( ( ( (

C!! ( ( ( (

D!! ( ( ( (

((i) Subtract(the(overall(smallest(number(from(all(numbers.((

( P! Q! R! S!

A! ( ( ( (

B!! ( ( ( (

C!! ( ( ( (

D!! ( ( ( (

(((((

6. Cover(all(zeros(above(with(the(smallest(number(of(straight(lines((((((

7. Produce(a(bipartite(graph((zeros(represent(allocations)((((((((((((

8. Determine(the(optimal(allocation(((((Calculate(the(total(cost(

Recommended