|
618 | 618 | " max_degree = max(g.degree())\n", |
619 | 619 | " for i in range(len(g.vertices())): # pad adjacency list\n", |
620 | 620 | " while len(adjacency_list[i]) < max_degree:\n", |
621 | | - " adjacency_list[i].append(65536)\n", |
| 621 | + " adjacency_list[i].append(65535)\n", |
622 | 622 | " with open('adjacency_lists/rome_temp.txt', 'w') as f:\n", |
623 | 623 | " f.write(f'{len(g.vertices())} {len(g.edges())}\\n')\n", |
624 | 624 | " for i in range(len(g.vertices())):\n", |
|
643 | 643 | }, |
644 | 644 | { |
645 | 645 | "cell_type": "code", |
646 | | - "execution_count": 13, |
| 646 | + "execution_count": null, |
647 | 647 | "metadata": { |
648 | 648 | "vscode": { |
649 | 649 | "languageId": "python" |
|
659 | 659 | " max_degree = max(g.degree())\n", |
660 | 660 | " for i in range(len(g.vertices())): # pad adjacency list\n", |
661 | 661 | " while len(adjacency_list[i]) < max_degree:\n", |
662 | | - " adjacency_list[i].append(65536)\n", |
| 662 | + " adjacency_list[i].append(65535)\n", |
663 | 663 | " with open(filename, 'w') as f:\n", |
664 | 664 | " f.write(f'{len(g.vertices())} {len(g.edges())}\\n')\n", |
665 | 665 | " for i in range(len(g.vertices())):\n", |
|
670 | 670 | }, |
671 | 671 | { |
672 | 672 | "cell_type": "code", |
673 | | - "execution_count": 14, |
| 673 | + "execution_count": null, |
674 | 674 | "metadata": { |
675 | 675 | "vscode": { |
676 | 676 | "languageId": "python" |
|
686 | 686 | " file.write(num_vertices.to_bytes(num_bytes, byteorder=\"little\"))\n", |
687 | 687 | " for v in range(num_vertices):\n", |
688 | 688 | " for u in adj_list[v]:\n", |
689 | | - " if u == 65536:\n", |
| 689 | + " if u == 65535:\n", |
690 | 690 | " continue\n", |
691 | 691 | " u = u - min_vertex_id\n", |
692 | 692 | " if u > v:\n", |
|
858 | 858 | " num_vertices, num_edges = map(int, lines[0].strip().split())\n", |
859 | 859 | " for i in range(1, len(lines)):\n", |
860 | 860 | " neighbors = list(map(lambda x: int(x) - START_INDEX, lines[i].strip().split()))\n", |
861 | | - " adjacency_list.append(list(filter(lambda x: x != 65536 - START_INDEX, neighbors)))\n", |
| 861 | + " adjacency_list.append(list(filter(lambda x: x != 65535, neighbors)))\n", |
862 | 862 | " assert len(adjacency_list) == num_vertices\n", |
863 | 863 | "print(num_vertices, num_edges, adjacency_list)\n", |
864 | 864 | "\n", |
|
0 commit comments