def opposite_node(edge_id, node):
    """
    Get the neighbor of a given node along a given edge
    """
    assert node in edge_id[:2]
    node_idx = edge_id[:2].index(node)
    return edge_id[(node_idx + 1) % 2]