def _find_first_degree_branches(branch, branch_id):
    """Find all branches connected to a given branch.

    :param pandas.DataFrame branch: branch DataFrame from Grid object.
    :param int branch_id: index of branches to find neighbors of.
    :return: (*set*) -- set of branch indexes (integers).
    """
    from_bus = branch.loc[branch_id, "from_bus_id"]
    to_bus = branch.loc[branch_id, "to_bus_id"]
    endpoints = (from_bus, to_bus)
    to_endpoints = branch.index[branch["to_bus_id"].isin(endpoints)]
    from_endpoints = branch.index[branch["from_bus_id"].isin(endpoints)]
    first_degree_branch_idxs = set(to_endpoints) | set(from_endpoints)

    return first_degree_branch_idxs