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

Method subgraph

python/graphscope/interactive/query.py:159–187  ·  view source on GitHub ↗

We currently only support subgraph using gremlin script. Create a subgraph, which input is the executor result of `gremlin_script`. Any gremlin script that output a set of edges can be used to construct a subgraph. Args: gremlin_script (str): Gremlin script to

(self, gremlin_script, lang="gremlin", request_options=None)

Source from the content-addressed store, hash-verified

157 return self._cypher_driver
158
159 def subgraph(self, gremlin_script, lang="gremlin", request_options=None):
160 """We currently only support subgraph using gremlin script.
161
162 Create a subgraph, which input is the executor result of `gremlin_script`.
163
164 Any gremlin script that output a set of edges can be used to construct a subgraph.
165
166 Args:
167 gremlin_script (str): Gremlin script to be executed.
168 request_options (dict, optional): Gremlin request options. format:
169 {
170 "engine": "gae"
171 }
172
173 Returns:
174 :class:`graphscope.framework.graph.GraphDAGNode`:
175 A new graph constructed by the gremlin output, that also stored in vineyard.
176 """
177 assert lang == "gremlin", "Only support gremlin script"
178 # avoid circular import
179 from graphscope.framework.graph import GraphDAGNode
180
181 op = gremlin_to_subgraph(
182 self,
183 gremlin_script=gremlin_script,
184 request_options=request_options,
185 oid_type=self._graph._oid_type,
186 )
187 return self._session._wrapper(GraphDAGNode(self._session, op))
188
189 def traversal_source(self):
190 """We currently only support traversal_source using gremlin.

Callers

nothing calls this directly

Calls 3

gremlin_to_subgraphFunction · 0.90
GraphDAGNodeClass · 0.90
_wrapperMethod · 0.80

Tested by

no test coverage detected