Implement a Python function that calculates the shortest distances from a specified starting node to all other nodes in a village represented as an undirected graph. The graph is defined by a set of nodes and a set of main roads connecting specific pairs of nodes. The function should use a breadth-first search (BFS) approach to determine the minimum distance from the starting node to each of the other nodes, excluding those directly connected by a main road.
n (1 ≤ n ≤ 1000): An integer representing the total number of nodes in the village.
m (1 ≤ m ≤ 1000): An integer representing the total number of main roads.
main_roads: A list of tuples, where each tuple (a, b) represents a main road between node a and node b.
start_node: An integer representing the starting node for the distance calculations.
Output Requirements
The function should return a list of integers that represent the shortest distances from the start_node to all other nodes (excluding the start node). Distances must be based on the BFS algorithm, and nodes directly connected by main roads should be bypassed.
File Requirements
The implementation must be placed in a file named /app/solution.py. Ensure that the file contains the complete implementation of the shortest_village_distances function with correct import statements and proper handling of input/output as per the specifications above. Include any necessary helper functions within the same file.
Example Usage
Here is an example of how the function could be invoked:
python
n = 5
m = 3
main_roads = [(1, 2), (2, 3), (3, 4)]
start_node = 1
result = shortest_village_distances(n, m, main_roads, start_node)
print(result) # Expected output: [2, 1, 0, None, ...] depending on the village layout
Constraints
Ensure that the start node is valid (i.e., between 1 and n).
The function should handle cases where some nodes may not be reachable from the start node due to disconnected components or a lack of connecting roads. In such cases, the corresponding distance should be represented as None in the output list.