neo4jcyphergraph-databasesknowledge-graph

How do I create a Neo4J multi-graph using gds.version() 1.7.2?


I want to project a subgraph that contains multiple nodes and relationship types. In gds 2.0 there is this (https://neo4j.com/docs/graph-data-science/current/graph-project/):

CALL gds.graph.project(
  'personsAndBooks',    
  ['Person', 'Book'],   
  ['KNOWS', 'READ']     
)
YIELD
  graphName AS graph, nodeProjection, nodeCount AS nodes, relationshipCount AS rels

I want to do something similar, using gds 1.7.2 gds.graph.create.cypher, but the node and edge selection only take strings not lists. Can anyone suggest how to do this?


Solution

  • I think you are looking for the gds.graph.create procedure (doc), which is the equivalent of project in previous versions of GDS:

    CALL gds.graph.create(
      'personsAndBooks',    
      ['Person', 'Book'],   
      ['KNOWS', 'READ']     
    )
    YIELD
      graphName AS graph, nodeProjection, nodeCount AS nodes, relationshipCount AS rels
    
    

    This is the so called "native projection", as opposed to "Cypher projection" which is performed by the .cypher procedure you mention, which expect a Cypher query as parameter, hence the string.