def _find_branches_connected_to_bus(branch, bus_id):
    """Find all branches connected to a given bus.

    :param pandas.DataFrame branch: branch DataFrame from Grid object.
    :param int bus_id: index of bus to find neighbors of.
    :return: (*set*) -- set of bus indexes (integers).
    """
    branches_from = branch.index[branch["from_bus_id"] == bus_id].tolist()
    branches_to = branch.index[branch["to_bus_id"] == bus_id].tolist()

    branches_connected = set(branches_from) | set(branches_to)

    return branches_connected