Cast this graph to use another ID type. Features are copied (shallow copy) to the new graph. Parameters ---------- idtype : Data type object. New ID type. Can only be int32 or int64. Returns ------- DGLGraph Graph in
(self, idtype)
| 6239 | return self._graph.create_formats_() |
| 6240 | |
| 6241 | def astype(self, idtype): |
| 6242 | """Cast this graph to use another ID type. |
| 6243 | |
| 6244 | Features are copied (shallow copy) to the new graph. |
| 6245 | |
| 6246 | Parameters |
| 6247 | ---------- |
| 6248 | idtype : Data type object. |
| 6249 | New ID type. Can only be int32 or int64. |
| 6250 | |
| 6251 | Returns |
| 6252 | ------- |
| 6253 | DGLGraph |
| 6254 | Graph in the new ID type. |
| 6255 | """ |
| 6256 | if idtype is None: |
| 6257 | return self |
| 6258 | utils.check_valid_idtype(idtype) |
| 6259 | if self.idtype == idtype: |
| 6260 | return self |
| 6261 | bits = 32 if idtype == F.int32 else 64 |
| 6262 | ret = copy.copy(self) |
| 6263 | ret._graph = self._graph.asbits(bits) |
| 6264 | return ret |
| 6265 | |
| 6266 | # TODO: Formats should not be specified, just saving all the materialized formats |
| 6267 | def shared_memory(self, name, formats=("coo", "csr", "csc")): |
no test coverage detected