Path expand and Virtual relationships

Hi,

I'm looking for a way to use apoc.create.vRelationship on apoc.path.subgraphAll results.

For example, lets take the same data from documentation about subgraphAll:
The following returns the subgraph reachable by the KNOWS relationship at 1 to 2 hops from Praveena.

MATCH (p:Person {name: "Praveena"})
CALL apoc.path.subgraphAll(p, {
    relationshipFilter: "KNOWS",
    minLevel: 1,
    maxLevel: 2
})
YIELD nodes, relationships
RETURN nodes, relationships;

image

If from some reason Zhen had several relationships to Martin and I wanted to aggregate them into one using apoc.create.vRelationship, how can I specify the "from node" and "to node" parameters for the function from the "YIELD nodes, relationships"?

And more generally, for any given result from apoc.path.subgraphAll, how can I use vRelationship function to aggregate relationships for specified source and target node labels?

Thanks.

Using

  • Neo4j 3.5
  • APOC 3.5.0.11