Limiting graph projection size by filtering on Node property values

We are currently using gds 1.1.1 and using node similarity. The basic projection looks like:

CALL gds.graph.create(
  'myGraph',
  ['Guest', 'Theme'],
  "PLAYS_THEME'
);

Question is how to limit the size of the projection by filtering on a Guest property (e.g., where Guest.color = "purple"). Where and how is that where clause entered?

I need to add that the property on which i want to filter is a string, not numeric.

You'll need a cypher projection for this:

CALL gds.graph.create.cypher(
   'my-graph',
   'MATCH (n) WHERE n:Guest AND c.color='Purple' OR n:Theme RETURN id(n) as id',
   'MATCH (n:Guest)-[:PLAYS_THEME]->(m:Theme) RETURN id(n) AS source, id(m) AS target'

)

(or something along those lines)
1 Like