Search code examples
c#asynchronousneo4jtask-parallel-libraryneo4jclient

How to run cypher query asynchronously with neo4jclient


I am exploring neo4j for a large scale optimization application. Basically, I have uploaded a graph of locations to neo4j DB. The use case is to find the shortest path between two nodes. I am able to do this using neo4jclient, however, I have to find the shortest paths between several nodes for each request and I was looking to use Task Parallel Library (c#, .net) to send cypher queries to neo4j for different pairs of locations "in-parallel" and then add up all the distances. I don't see an "async" method in the GraphClient interface in Neo4jClient. Has anyone implemented this kind of parallel cypher queries in .net or is it just not reasonable to expect this kind of parallelism with cypher?


Solution

  • The async method is part of the Execution points. So, for a query where you're returning values you end with:

    /**/.ResultsAsync
    

    for a query with no expected return:

    /**/.ExecuteWithoutResultsAsync()