def calculate_happiness_for_room(arr, G):
    """
    Given an array of students in to be placed in a room, calculate happiness for the room.
    Args:
        arr: Array of students
        G: Original graph
    Returns:
        room_happiness: Happiness value of the room
    """
    H = G.subgraph(arr)
    return H.size("happiness")