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

Class GraphDAGNode

python/graphscope/framework/graph.py:225–868  ·  view source on GitHub ↗

A class represents a graph node in a DAG. In GraphScope, all operations that generate a new graph will return a instance of :class:`GraphDAGNode`, which will be automatically executed by :meth:`Session.run` in `eager` mode. The following example demonstrates its usage: .. code

Source from the content-addressed store, hash-verified

223
224
225class GraphDAGNode(DAGNode, GraphInterface):
226 """A class represents a graph node in a DAG.
227
228 In GraphScope, all operations that generate a new graph will return
229 a instance of :class:`GraphDAGNode`, which will be automatically
230 executed by :meth:`Session.run` in `eager` mode.
231
232 The following example demonstrates its usage:
233
234 .. code:: python
235
236 >>> # lazy mode
237 >>> import graphscope as gs
238 >>> sess = gs.session(mode="lazy")
239 >>> g = sess.g()
240 >>> g1 = g.add_vertices("person.csv","person")
241 >>> print(g1) # <graphscope.framework.graph.GraphDAGNode object>
242 >>> g2 = sess.run(g1)
243 >>> print(g2) # <graphscope.framework.graph.Graph object>
244
245 >>> # eager mode
246 >>> import graphscope as gs
247 >>> sess = gs.session(mode="eager")
248 >>> g = sess.g()
249 >>> g1 = g.add_vertices("person.csv","person")
250 >>> print(g1) # <graphscope.framework.graph.Graph object>
251 >>> del g1
252 """
253
254 def __init__(
255 self,
256 session,
257 incoming_data=None,
258 oid_type="int64",
259 vid_type="uint64",
260 directed=True,
261 generate_eid=True,
262 retain_oid=True,
263 vertex_map: Union[str, int] = "global",
264 compact_edges=False,
265 use_perfect_hash=False,
266 ):
267 """Construct a :class:`GraphDAGNode` object.
268
269 Args:
270 session (:class:`Session`): A graphscope session instance.
271 incoming_data: Graph can be initialized through various type of sources,
272 which can be one of:
273
274 - :class:`graphscope.framework.operation.Operation`
275 - :class:`graphscope.nx.Graph`
276 - :class:`graphscope.Graph`
277 - :class:`vineyard.Object`, :class:`vineyard.ObjectId` or :class:`vineyard.ObjectName`
278
279 oid_type: (str, optional): Type of vertex original id. Defaults to "int64".
280 vid_type: (str, optional): Type of vertex internal id. Defaults to "uint64".
281 directed: (bool, optional): Directed graph or not. Defaults to True.
282 generate_eid: (bool, optional): Generate id for each edge when set True. Defaults to True.

Callers 12

gMethod · 0.90
subgraphMethod · 0.90
_project_to_simpleMethod · 0.85
to_directedMethod · 0.85
to_undirectedMethod · 0.85
add_verticesMethod · 0.85
add_edgesMethod · 0.85
consolidate_columnsMethod · 0.85
add_columnMethod · 0.85
projectMethod · 0.85
_load_from_grapharMethod · 0.85
load_fromMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected