Convert a DGL graph to an EasyGraph graph. Args: g (DGLGraph): A DGL graph Raises: ImportError: If DGL is not installed. Returns: Union[Graph, DiGraph]: Converted EasyGraph graph
(g)
| 374 | |
| 375 | |
| 376 | def from_dgl(g) -> "Union[Graph, DiGraph]": |
| 377 | """Convert a DGL graph to an EasyGraph graph. |
| 378 | |
| 379 | Args: |
| 380 | g (DGLGraph): A DGL graph |
| 381 | |
| 382 | Raises: |
| 383 | ImportError: If DGL is not installed. |
| 384 | |
| 385 | Returns: |
| 386 | Union[Graph, DiGraph]: Converted EasyGraph graph |
| 387 | """ |
| 388 | try: |
| 389 | import dgl |
| 390 | except ImportError: |
| 391 | raise ImportError("DGL not found. Please install it.") |
| 392 | g_nx = dgl.to_networkx(g) |
| 393 | g_eg = from_networkx(g_nx) |
| 394 | return g_eg |
| 395 | |
| 396 | |
| 397 | def to_pyg( |
nothing calls this directly
no test coverage detected