MCPcopy Create free account
hub / github.com/alibaba/euler / get_neighbors

Method get_neighbors

tf_euler/python/dataflow/relation_dataflow.py:31–46  ·  view source on GitHub ↗
(self, n_id)

Source from the content-addressed store, hash-verified

29 self.metapath = metapath
30
31 def get_neighbors(self, n_id):
32 neighbors = []
33 types = []
34 neighbor_src = []
35 for i in range(len(self.metapath)):
36 n_id = tf.reshape(n_id, [-1])
37 one_neighbor, _, one_type = tf_euler.get_full_neighbor(n_id, self.metapath[i])
38 neighbors.append(tf.reshape(one_neighbor.values, [-1]))
39 types.append(tf.reshape(one_type.values, [-1]))
40 one_indices = one_neighbor.indices[:, 0]
41 neighbor_src.append(tf.cast(one_indices, tf.int32))
42 new_n_id = tf.reshape(one_neighbor.values, [-1])
43 n_id = tf.concat([new_n_id, n_id], axis=0)
44 n_id, _ = tf.unique(n_id)
45
46 return neighbors, types, neighbor_src
47
48 def produce_subgraph(self, n_id):
49 n_id = tf.reshape(n_id, [-1])

Callers 1

produce_subgraphMethod · 0.95

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected