I'm try to run gds.alpha.allShortestPaths.stream
in a py2neo.Graph
instance
That is my code:
cypherCode = """CALL gds.alpha.allShortestPaths.stream({
nodeQuery: 'MATCH (n:AUTHOR) RETURN id(n) AS id',
relationshipQuery: 'MATCH (n:AUTHOR)-[r:COAUTHORS]-(p:AUTHOR) RETURN id(n) AS source, id(p) AS target'
})
YIELD sourceNodeId, targetNodeId, distance
return sourceNodeId, targetNodeId, distance
"""
r = graph.run(cypherCode)
I'm using relationshipQuery: 'MATCH (n:AUTHOR)-[r:COAUTHORS]-(p:AUTHOR) RETURN id(n) AS source, id(p) AS target'
becouse I need undirected paths.
After 60sec I get this error:
IndexError: index out of range
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<timed exec> in <module>
~/.local/lib/python3.8/site-packages/py2neo/database.py in run(self, cypher, parameters, **kwparameters)
403 :return:
404 """
--> 405 return self.auto().run(cypher, parameters, **kwparameters)
406
407 def evaluate(self, cypher, parameters=None, **kwparameters):
~/.local/lib/python3.8/site-packages/py2neo/database.py in run(self, cypher, parameters, **kwparameters)
976 result = self._connector.run(self.ref, cypher, parameters)
977 else:
--> 978 result = self._connector.auto_run(cypher, parameters,
979 graph_name=self.graph.name,
980 readonly=self.readonly)
~/.local/lib/python3.8/site-packages/py2neo/client/__init__.py in auto_run(self, cypher, parameters, pull, graph_name, readonly)
1341 if pull != 0:
1342 try:
-> 1343 cx.pull(result, n=pull)
1344 except TypeError:
1345 # If the RUN fails, so will the PULL, due to
~/.local/lib/python3.8/site-packages/py2neo/client/bolt.py in pull(self, result, n, capacity)
941 result.append(response, final=(n == -1))
942 try:
--> 943 self._sync(response)
944 except BrokenWireError as error:
945 result.transaction.mark_broken()
~/.local/lib/python3.8/site-packages/py2neo/client/bolt.py in _sync(self, *responses)
745 self.send()
746 for response in responses:
--> 747 self._wait(response)
748
749 def _audit(self, task):
~/.local/lib/python3.8/site-packages/py2neo/client/bolt.py in _wait(self, response)
740 """
741 while not response.full() and not response.done():
--> 742 self._fetch()
743
744 def _sync(self, *responses):
~/.local/lib/python3.8/site-packages/py2neo/client/bolt.py in _fetch(self)
715 failed state into an exception.
716 """
--> 717 tag, fields = self.read_message()
718 if tag == 0x70:
719 self._responses.popleft().set_success(**fields[0])
~/.local/lib/python3.8/site-packages/py2neo/client/bolt.py in read_message(self)
642
643 def read_message(self):
--> 644 tag, fields = self._reader.read_message()
645 if tag == 0x71:
646 # If a RECORD is received, check for more records
~/.local/lib/python3.8/site-packages/py2neo/client/bolt.py in read_message(self)
94 chunks.append(self.wire.read(size))
95 message = b"".join(chunks)
---> 96 _, n = divmod(message[0], 0x10)
97 try:
98 unpacker = UnpackStream(message, offset=2)
IndexError: index out of range
When I try to change the relationshipQuery
with oriented path or with an small graph it's works fine.
Running this cypher code directly on neo4j browser it's works and takes about 80sec to run.
My graph have 10k nodes and 20k relations.