150 likes | 261 Views
This presentation explores the application of network flow algorithms, specifically Ford-Fulkerson and Edmonds-Karp, to achieve maximum task assignment between employees and tasks represented in a bipartite graph. The problem statement highlights the need for efficient task allocation, detailing the input as a bipartite graph and the output as the maximum assignment. Key concepts include identifying valid edges, dead nodes, and employing a Depth-First Search (DFS) approach to find random paths. The outcome demonstrates how these algorithms effectively maximize assignments while ensuring optimal resource utilization.
E N D
Network Flow : Task Allocation Using Bipartite Match Presented byAdnanRahath KhanSkKajalArefinImon
Problem Statement • Using Network Flow Algorithm (Ford Fulkerson and Edmond Karp) to solve maximum task assignment. • Input: A bipartite graph with nodes representing tasks and employees. • Output: Find maximum assignment among employees and tasks
Maximum Task Assignment using Network Flow Person Tasks 0 2 1 3
Using Network Flow 0 2 1 1 1 1 5 4 1 3 1 1 1 Max Flow = 2 Maximum Matching = 2 Assignments: Node 0 to Node 3 Node 1 to Node 2
Ford Fulkerson • Some definition: • Valid edge: Edges that have weight 1 in the residual graph. • Dead Nodes: Nodes which has no outgoing valid edges • Finding a Random Path: • We start from the source node. Push it on the stack. Now take a node from its neighbors randomly that is connected with a valid edge. Push it on the stack and repeat the whole process until we find destination node. • Basically we perform DFS like approach to have a set of valid edges starting from source ending at destination node from the residual graph. • If we reach a dead node, pop the stack to go back to a previous node to check if we have a valid path from there. • Used a list to keep track of dead nodes. While finding a neighboring edge, if it leads to a dead node, we don’t return it as a valid edge. • Don’t return source node as a neighbor to avoid loop.
Initial graph 0 2 1 1 1 1 5 4 1 3 1 1 1 1 1 4
FordFulkerson 0 3 1 1 1 1 6 5 1 4 1 1 1 1 2 1 First round: FordFulkerson randomly chooses 5->0->3->6
FordFulkerson 0 1 3 1 0 1 1 0 6 5 0 1 4 1 1 1 1 2 1 Second round: FordFulkerson randomly chooses 5->1->3->0->4->6
FordFulkerson 0 0 3 1 1 1 0 0 6 5 0 1 0 1 1 1 4 1 0 0 1 2 1 Third round: FordFulkerson chooses 5->2->4->0->3->1 and reaches at dead node 1 Pop node 1
FordFulkerson 0 0 3 1 1 1 0 0 6 5 0 1 0 1 1 1 4 1 0 0 1 2 1 current stack: 5->2->4->0->3; 3 is also a dead node Pop 3
FordFulkerson 0 0 3 1 1 1 0 0 6 5 0 1 0 1 1 1 4 1 0 0 1 2 1 current stack: 5->2->4->0; 0 is a dead node Pop 0
FordFulkerson 0 0 3 1 1 1 0 0 6 5 0 1 0 1 1 1 4 1 0 0 1 2 1 Pop 0; current stack: 5->2->4; 4 is a dead node Pop 4
FordFulkerson 0 0 3 1 1 1 0 0 6 5 0 1 0 1 1 1 4 1 0 0 1 2 1 current stack: 5->2; 2 is a dead node Pop 2
FordFulkerson 0 0 3 1 1 1 0 0 6 5 0 1 0 1 1 1 4 1 0 0 1 2 1 Pop 5; stack empty; so no path available at this point
EdmondKarp • Key points: • Modified BFS to get a path from source to destination. • Took an edge in the path only the weight of that edge is 1.