(self)
| 829 | ) |
| 830 | |
| 831 | def process(self): |
| 832 | root = self.raw_path |
| 833 | # load graphs |
| 834 | self.graphs = [] |
| 835 | with open("{}/graphs.txt".format(root), "r") as f: |
| 836 | elist = [] |
| 837 | for line in f.readlines(): |
| 838 | if line.startswith("graph"): |
| 839 | if len(elist) != 0: |
| 840 | self.graphs.append(dgl_graph(tuple(zip(*elist)))) |
| 841 | elist = [] |
| 842 | else: |
| 843 | u, v = line.strip().split(" ") |
| 844 | elist.append((int(u), int(v))) |
| 845 | if len(elist) != 0: |
| 846 | self.graphs.append(dgl_graph(tuple(zip(*elist)))) |
| 847 | with open("{}/pmpds.pkl".format(root), "rb") as f: |
| 848 | self.pmpds = _pickle_load(f) |
| 849 | self.labels = [] |
| 850 | with open("{}/labels.txt".format(root), "r") as f: |
| 851 | cur = [] |
| 852 | for line in f.readlines(): |
| 853 | if line.startswith("graph"): |
| 854 | if len(cur) != 0: |
| 855 | self.labels.append(np.asarray(cur)) |
| 856 | cur = [] |
| 857 | else: |
| 858 | cur.append(int(line.strip())) |
| 859 | if len(cur) != 0: |
| 860 | self.labels.append(np.asarray(cur)) |
| 861 | # sanity check |
| 862 | assert len(self.graphs) == len(self.pmpds) |
| 863 | assert len(self.graphs) == len(self.labels) |
| 864 | |
| 865 | @property |
| 866 | def graph_path(self): |
nothing calls this directly
no test coverage detected