Read original id files for the partitioned graph objects Parameters: ----------- out_dir : string specifying the directory where the files are located fname : string file name to read from num_parts : integer no. of partitions Returns: --------
(out_dir, fname, num_parts)
| 264 | |
| 265 | |
| 266 | def read_orig_ids(out_dir, fname, num_parts): |
| 267 | """Read original id files for the partitioned graph objects |
| 268 | |
| 269 | Parameters: |
| 270 | ----------- |
| 271 | out_dir : string |
| 272 | specifying the directory where the files are located |
| 273 | fname : string |
| 274 | file name to read from |
| 275 | num_parts : integer |
| 276 | no. of partitions |
| 277 | |
| 278 | Returns: |
| 279 | -------- |
| 280 | dictionary : |
| 281 | where keys are node/edge types and values are original node |
| 282 | or edge ids from the original graph |
| 283 | """ |
| 284 | orig_ids = {} |
| 285 | for i in range(num_parts): |
| 286 | ids_path = os.path.join(out_dir, f"part{i}", fname) |
| 287 | part_ids = load_tensors(ids_path) |
| 288 | for type, data in part_ids.items(): |
| 289 | if type not in orig_ids: |
| 290 | orig_ids[type] = data.numpy() |
| 291 | else: |
| 292 | orig_ids[type] = np.concatenate((orig_ids[type], data)) |
| 293 | return orig_ids |
no test coverage detected