Certainly! Here is the test case generator for the given problem statement:

```python
import random

def tcgen():
    # Generate the number of vertices N
    N = random.randint(1, 1000)
    
    # Generate the parent array P for vertices 2 to N
    if N > 1:
        P = [random.randint(1, i - 1) for i in range(2, N + 1)]
    else:
        P = []
    
    # Generate the favorite sequence X
    X = [random.randint(0, 5000) for _ in range(N)]
    
    return N, P, X

def format_test_case(N, P, X):
    output = f"{N}\n"
    if P:
        output += " ".join(map(str, P)) + "\n"
    output += " ".join(map(str, X)) + "\n"
    
    return output

# Example of generating and formatting a test case
N, P, X = tcgen()
formatted_test_case = format_test_case(N, P, X)
print(formatted_test_case)
```

### Explanation:
1. **Number of Vertices (N)**: A random integer between 1 and 1000 is generated for the number of vertices.
2. **Parent Array (P)**: For vertices 2 to N, random parent indices are generated such that each parent index `P_i` satisfies \(1 \leq P_i \leq i - 1\).
3. **Favorite Sequence (X)**: An array of size N is created with random non-negative integers between 0 and 5000.
4. **Formatting**: The generated numbers are formatted into a string as specified in the problem statement.

This generator produces random test cases that adhere to the constraints and input format of the problem.