Using GDS library to project nodes with the same value for a specific property

I want to use GDS to project my graph such that all nodes in the base graph with the same value for a specific property get projected to the same representative node in the GDS graph and all relationships on the underlying nodes are projected to connect to the representative. e.g. if I start with,

CREATE (a:Node {name: "foo"}) - [:REL] -> (b :Node {name : "bar"}),
(c:Node {name: "foo"}) - [:REL] -> (d :Node {name : "baz"})

The projected graph should have three nodes, one representing {a,c}, one representing {b}, and one representing {d} with edges {a,c} -> {b} and {a,c} -> {d}.

Hello Liz,
aggregating your graph this way is not currently possible with GDS.
Do you want to use GDS only for the aggregation or is the idea to project a graph into GDS of that shape and then run algorithms on top?

One option could be to create the super graph, such as with:

MATCH (n)
MERGE (n1:SUPER {name: n.name})
WITH n, n1
MATCH (n)-[r]->(m), (n1)
MERGE (m1:SUPER {name: m.name})
CREATE (n1)-[r1:R]->(m1)

And then you can project this graph into GDS with: CALL gds.graph.projection('g', 'SUPER', 'R')

I want to project a graph into GDS of that shape so that I can run algorithms on top. Is that solution the only way to do this?

To my knowledge yes. Inside GDS we dont offer such as an aggregation of a graph.

As a side note, some community detection algorithms create such graphs internally.
I can add it as a feature request but that wont help you in the near term.

Depending on your coding experience, you could also contribute such an algorithms to our library (GitHub - neo4j/graph-data-science: Source code for the Neo4j Graph Data Science library of graph algorithms.).
I would be happy to give you some pointers :)