@staticmethod
def __filter_nodes(node_weights, return_positive_weights=True):
    """
        Filters out nodes with positive or negative weights and
        takes the absolute.

        :param node_weights: dict
        :param return_positive_weights: bool, if True returns nodes with
                                              positive weights,
                                              if False negative weights
        :return:
        """
    new_node_weights = {}
    for n, nv in node_weights.items():
        if nv > 0 and return_positive_weights:
            new_node_weights[n] = nv
        elif nv < 0 and not return_positive_weights:
            new_node_weights[n] = -nv
    return new_node_weights
