Example #1
0
    def get_edges(self, direction, *labels):
        """

        """
        labels = recommend_utils.flatten_iterable(labels)

        if direction == recommend_utils.Direction.OUT:
            return self.get_out_edges(labels)
        elif direction == recommend_utils.Direction.IN:
            return self.get_in_edges(labels)
        else:
            out_list = []

            for current_edge in self.get_out_edges(labels):
                out_list.append(current_edge)

            for current_edge in self.get_in_edges(labels):
                out_list.append(current_edge)

            return out_list
Example #2
0
    def get_edges(self, direction, *labels):
        """

        """
        labels = recommend_utils.flatten_iterable(labels)

        if direction == recommend_utils.Direction.OUT:
            return self.get_out_edges(labels)
        elif direction == recommend_utils.Direction.IN:
            return self.get_in_edges(labels)
        else:
            out_list = []

            for current_edge in self.get_out_edges(labels):
                out_list.append(current_edge)

            for current_edge in self.get_in_edges(labels):
                out_list.append(current_edge)

            return out_list
Example #3
0
    def get_out_edges(self, *labels):
        """
        Get out edges
        """
        labels = recommend_utils.flatten_iterable(labels)
        output_list = []
        labels_list = []

        if not labels:
            for label in self.out_edges:
                labels_list.append(label)
        else:
            for label in labels:
                labels_list.append(label)

        for label in labels_list:
            if self.out_edges.get(label):
                out_edge_dict = self.out_edges.get(label)
                for current_edge_key in out_edge_dict:
                    output_list.append(out_edge_dict[current_edge_key])
        return output_list
Example #4
0
    def get_out_edges(self, *labels):
        """
        Get out edges
        """
        labels = recommend_utils.flatten_iterable(labels)
        output_list = []
        labels_list = []

        if not labels:
            for label in self.out_edges:
                labels_list.append(label)
        else:
            for label in labels:
                labels_list.append(label)

        for label in labels_list:
            if self.out_edges.get(label):
                out_edge_dict = self.out_edges.get(label)
                for current_edge_key in out_edge_dict:
                    output_list.append(out_edge_dict[current_edge_key])
        return output_list