MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / from_dgl

Function from_dgl

easygraph/convert.py:376–394  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

374
375
376def 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
397def to_pyg(

Callers

nothing calls this directly

Calls 1

from_networkxFunction · 0.85

Tested by

no test coverage detected