title: Creating a subgraph using Cypher projection
body: <p>I am trying to create a subgraph of my graph using Cypher projection because I want to use the GDS library. First, I am creating a subgraph using Cypher query which works perfectly fine. Here is the query:</p>
  <pre><code>// Filter for only recurrent events
  WITH [path=(m:IDHcodel)--(n:Tissue)
  WHERE (m.node_category = 'molecular' AND n.event_class = 'Recurrence')
      AND NOT EXISTS((m)--(:Tissue{event_class:'Primary'})) | m] AS recur_events
  
  // Obtain the sub-network with 2 or more patients in edges
  MATCH p=(m1)-[r:hasIDHcodelPatients]-&gt;(m2) 
  WHERE (m1 IN recur_events AND m2 IN recur_events AND r.total_common_patients &gt;= 2)
  WITH COLLECT(p) AS all_paths
  WITH [p IN all_paths | nodes(p)] AS path_nodes, [p IN all_paths | relationships(p)]  AS path_rels
  RETURN apoc.coll.toSet(apoc.coll.flatten(path_nodes)) AS subgraph_nodes, apoc.coll.flatten(path_rels) AS subgraph_rels
  </code></pre>
  <p>So far so good. Now all I am trying to do is a Cypher projection by sending the subgraph nodes and subgraph rels as parameters in the GDS create query and this gives me a null pointer exception:</p>
  <pre><code>// All the above lines except using WITH instead of RETRUN in the last line. ie.,
  
  ...
  
  WITH apoc.coll.toSet(apoc.coll.flatten(path_nodes)) AS subgraph_nodes, apoc.coll.flatten(path_rels) AS subgraph_rels
  
  // Call gds library to create a graph by sending subgraph_nodes and subgraph_rels as parameters
  CALL gds.graph.create.cypher(
      'example',
      'MATCH (n) where n in $sn RETURN id(n) as id',
      'MATCH ()-[r]-() where r in $sr RETURN r.start as source , r.end as target',
      {parameters: {sn: subgraph_nodes, sr: subgraph_rels} } 
  ) YIELD graphName AS graph, nodeQuery, nodeCount AS nodes, relationshipQuery, relationshipCount AS rels
  
  RETURN graph
  </code></pre>
  <p>What could be wrong? Thanks.</p>