RNeo4j cypher - search paths

I am trying to extract subgraphite from a global network (subnets of specific nodes to a certain depth).

The network consists of nodes marked as an Account with the iban property and the TRANSFER_TO_AGG relationship.

The cypher syntax is as follows:

 MATCH (a:Account { iban :'FR7618206004274157697300156' }),(b:Account), p = allShortestPaths((a)-[:TRANSFER_TO_AGG*..3]-(b)) RETURN p limit 250 

This works great on the Neo4J web interface. However, when I try to save the results to an R object using the cypher command, I get the following error:

 "Error in as.data.frame.list(value, row.names = rlabs) : supplied 92 row names for 1 rows" 

I believe that this is due to the fact that when you return data, you can only request tabular results. That is, this method does not have current functionality for Cypher results containing array properties, collections, nodes, or relationships.

Can anyone suggest a solution?

+5
source share
1 answer

I recently added functionality to return paths as R. objects. First, uninstall / reinstall RNeo4j. Then see:

? getSinglePath

? getPaths

? shortestPath

? allShortestPaths

? nodes

rels

? startNode

? endNode

For your request in particular, you should use getPaths() :

 library(RNeo4j) graph = startGraph("http://localhost:7474/db/data/") query = " MATCH (a:Account { iban :'FR7618206004274157697300156' }),(b:Account), p = allShortestPaths((a)-[:TRANSFER_TO_AGG*..3]-(b)) RETURN p limit 250 " p = getPaths(graph, query) 

p is a list of path objects. See Docs for examples of using the apply function family with a list of path objects.

+3
source

Source: https://habr.com/ru/post/1202535/


All Articles