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

Function gen_node_map

tf_euler/python/dataset/pubmed_utils.py:22–38  ·  view source on GitHub ↗
(cite_file)

Source from the content-addressed store, hash-verified

20import os
21import numpy as np
22def gen_node_map(cite_file):
23 node_map = {}
24 node_index = 0
25 with open(os.path.realpath(cite_file), 'r') as f:
26 for line in f:
27 nodes = line.strip().split("\t")
28 if len(nodes) != 4:
29 continue
30 src_node = nodes[1].split(":")[1]
31 if not node_map.has_key(src_node):
32 node_map[src_node] = node_index
33 node_index += 1
34 dst_node = nodes[3].split(":")[1]
35 if not node_map.has_key(dst_node):
36 node_map[dst_node] = node_index
37 node_index += 1
38 return node_map
39
40def gen_edge(cite_file, node_map, train_num):
41 src = []

Callers 1

parse_graph_fileFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected