How do I get properties of edges and not just nodes from a query to the python driver?
I have a query to try and find variable length paths between two nodes, like
match path = (n1:page{name:'start-page'})-[*..2]->(n2:page) return path limit 5
In the neo4j browser, table view I can see a table with a segments
property in the middle with all the data on each connecting edges (see below)
But when I send the same query to cypher/python driver, I don't get any segments, just the start/end nodes.
What query can I use to get the same detail on the path / edges as below?
Do I need to use subgraphs or somehow unwind the paths between?
{
"start": {
"identity": 95, "labels": ["page"],
...
"segments": [
{
"start": {
"identity": 95,
"relationship": {
"identity": 152,
"start": 95,
"end": 97,
"type": "nav",
"properties": {
"start_page": "start-page",
"weight": 2,
...
"length": 1.0
}
I did try a more complex with
type query, which works well in neo4j browser, but from the python driver I still just get the pages, and no data or properties on the edges between each node:
// unex charge to end by weight
match path = (n1:page{name:'start-page'})-[*..5]->(n2:page{name:'end_session'})
with n1 as startPage,
relationships(path) as edges,
n2 as endPage
return startPage, edges, endPage
order by edges[0].weight desc
limit 50
This just seems to put page
data into the edges
too:
{
'edges': [({
'flow': 'BILL',
'name': 'start-page',
'type': 'page',
'weight': 18
},
'nav', {
'flow': 'BILL',
'name': 'end_session',
'type': 'page'
})
],
'endPage': {
'flow': 'BILL',
'name': 'end_session',
'type': 'page'
},
'startPage': {
'flow': 'BILL',
'name': 'start-page',
'type': 'page',
'weight': 18
}
}
Confused why I can't get edge data, and also what magic the neo4j query browser is doing to get queries to work, in a completely different way than the python driver. >.<