I'm using the result.graph()
to try and get graph info from a cypher call.
however, even using a debugger it's hard to tell how to extract anything useful from this API.
How do I iterate through or otherwise use a neo4j.graph.Graph
object?
- it's not an array
- it doesn't have named keys like a dict
- it's not an iterable
- it doesn't respond to
g.relationships()
- it doesn't have
.data()
so basically wut can I do with this graph
instance?
code and query are like below, debugger output to after
def path_from(self, start_page, flow='BILL'):
q6 = """
MATCH
path = (n1:page{cname:$start_page})
-[*..5]->
(n2:page {flow:'BILL'})
WITH n1
AS startPage,
[p IN relationships(path) | properties(p)] AS edges,
n2 AS endPage,
path as path
RETURN startPage, edges, endPage, path
ORDER BY edges[0].weight DESC
LIMIT 1
"""
result = neolib.get_cursor(q6, start_page=start_page)
path = result.get('path')
g = result.graph()
logging.info('graph %s', g)
In a bit more detail my cypher query is trying to return a few things - nodes, edges and a 'path'
but not sure if i need to apply the .graph
somehow on only part of this result?
Or do I need to do an even more complex query with subgraphs for graph to return anything? Maybe that's the problem above.