def _find_neighbors_relations(node, relations, nodes):
    """
    Find all neighbors and relation for this node.

    :param node: the node we search the neighbors and relations for
    :param relations: a list of all relations
    :param nodes: a list of all nodes
    :return: a pair (neighbors, relations)
    """
    node_neighbors = []
    node_relations = []
    for r in relations:
        if node.variable in r.dimensions:
            node_relations.append(r)
            dim_vars = list(r.dimensions)
            dim_vars.remove(node.variable)
            for n in nodes:
                if n.variable in dim_vars and n not in node_neighbors:
                    node_neighbors.append(n)
    return node_neighbors, node_relations