def get_vertices_iterator(self, key=None, value=None): """ Get Vertices iterator key: the label to filter value: the value to filter """ return recommend_utils.DictKeyValueIterator(self.vertices)
def V(self, vertex_label=None, value=None): """ Vertices """ self.pipeline.add_pipe(pipes.GraphVertexPipe()) if self.pipeline.starts is None: self.pipeline.set_starts(recommend_utils.DictKeyValueIterator(self.graph.vertices)) return self
def test_dict_key_value_iterator(self): input_dict = {5: 8, 2: 100, 9: 5, -1: 9} list_iterator = recommend_utils.DictKeyValueIterator(input_dict) list_out = [] try: while list_iterator.has_next(): list_out.append(list_iterator.next()) except recommend_utils.FastNoSuchElementException: # Ignore FastNoSuchElementException pass self.assertEqual(list_out, [5, 100, 8, 9])