Implement a function min_operations_to_star_tree(n, edges) that calculates the minimum number of operations needed to convert a given tree structure into a star tree. A star tree is defined as a tree in which one central node is connected directly to all other nodes, with no other connections.
Input/Output Requirements
Input:
An integer n (1 ≤ n ≤ 100,000) representing the number of nodes in the tree.
A list of tuples edges where each tuple (u, v) represents an edge between nodes u and v. The list contains n-1 edges, as is characteristic of a tree.
Output:
The function should return a single integer, which is the minimum number of operations needed to convert the tree into a star tree.
Additional Information
The solution must be written in a file called /app/solution.py.
Ensure the program is efficient and can handle the upper limits of input sizes.
Notes
You may assume that the input edges will always form a valid tree structure.