MCPcopy Create free account
hub / github.com/alibaba/GraphScope / nx

Method nx

python/graphscope/client/session.py:1394–1415  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1392 return g
1393
1394 def nx(self):
1395 if not self.eager():
1396 raise RuntimeError(
1397 "Networkx module need the session to be eager mode. "
1398 "Current session is lazy mode."
1399 )
1400 if self._nx:
1401 return self._nx
1402 import importlib.util
1403
1404 spec = importlib.util.find_spec("graphscope.nx")
1405 mod = importlib.util.module_from_spec(spec)
1406 spec.loader.exec_module(mod)
1407
1408 graph = type("Graph", (mod.Graph.__base__,), dict(mod.Graph.__dict__))
1409 digraph = type("DiGraph", (mod.DiGraph.__base__,), dict(mod.DiGraph.__dict__))
1410 setattr(graph, "_session", self)
1411 setattr(digraph, "_session", self)
1412 setattr(mod, "Graph", graph)
1413 setattr(mod, "DiGraph", digraph)
1414 self._nx = mod
1415 return self._nx
1416
1417 def add_lib(self, resource_name):
1418 """

Callers 3

test_importMethod · 0.80

Calls 1

eagerMethod · 0.95

Tested by 3

test_importMethod · 0.64