Task Description: Implement Max Flow Calculation Functionality
You are required to implement a function that calculates the maximum flow in a flow network using the Edmonds-Karp algorithm, which is an implementation of the Ford-Fulkerson method using breadth-first search (BFS).
Functionality Requirements:
Implement the function calculate_max_flow(N: int, M: int, Edges: List[Tuple[int, int, int]]) -> int.
The function should take in three parameters:
N: An integer representing the number of vertices in the graph (1-indexed).
M: An integer representing the number of edges in the graph.
Edges: A list of tuples, where each tuple contains three integers (u, v, cap) indicating an edge from vertex u to vertex v with capacity cap.
The function should return an integer representing the maximum flow from the source vertex (vertex 1) to the sink vertex (vertex N).
Input/Output Requirements:
Input:
The function takes in integer N (1 <= N <= 1000), integer M (1 <= M <= 10000), and a list Edges where each edge tuple contains integers u, v, cap (1 <= u, v <= N and 0 <= cap <= 10000).
Output:
The function should return a single integer representing the maximum flow in the network.
Implementation Details:
You should utilize breadth-first search (BFS) for finding augmenting paths.
You must account for both directed edges and bidirectional flow by updating the capacity matrix accordingly.
File Structure:
The solution must be implemented in a Python file located at /app/solution.py.