Search code examples
chartsneo4japoc

APOC Virtual Relationships and GDS


I want to create virtual relationships in Neo4j using APOC and run GDS algorithms like degree distributions. Is it even possible?


Solution

  • No, virtual nodes and relationships cannot be projected in GDS.

    For example, if you try this query:

    CALL apoc.create.vNode(['Foo'], {name: 'xyz'}) YIELD node
    RETURN gds.graph.project('t', node) AS g
    

    You get an error like this (virtual entities have negative native IDs):

    Failed to invoke function gds.graph.project: Caused by: java.lang.IllegalArgumentException: GDS expects node ids to be positive. But got a negative id of -2.