| 119 | return nx_graph |
| 120 | |
| 121 | def __load_node_label_feature(self): |
| 122 | node_label_feature = [] |
| 123 | label_id_map = {} |
| 124 | with open(self.content_file, 'r', encoding='utf-8') as fin: |
| 125 | for line in fin: |
| 126 | fields = line.rstrip().split("\t") |
| 127 | node, label = fields[0], fields[-1] |
| 128 | feature = [int(x) for x in fields[1:-1]] |
| 129 | if label not in label_id_map: |
| 130 | label_id_map[label] = len(label_id_map) |
| 131 | node_label_feature.append((node, label_id_map[label], feature)) |
| 132 | return node_label_feature |
| 133 | |
| 134 | def __load_edges(self): |
| 135 | edges = [] |