e25548
e25548

Reputation: 13

Using GDS to make a neo4j undirected graph

The neo4j Graph Data Science (GDS) "Triangle Count" algorithm only runs on an undirected graph. I can convert my existing directed graph to undirected for the calculation using:

CALL gds.graph.create('myGraph3', '*', {BELONGS_TO: {orientation: 'UNDIRECTED'}, FLOWS_TO: {orientation: 'UNDIRECTED'}})

But I have to list every relationship, which is brittle and lengthy for the actual list of relationships. Is there a way to make the '*' work with this?

Something like

CALL gds.graph.create('myGraph3', '', {'': {orientation: 'UNDIRECTED'}})

which does not work, but I can't figure the correct pattern.

Upvotes: 0

Views: 887

Answers (2)

Ryan Chandler
Ryan Chandler

Reputation: 1

You can create a ephemeral graph from the projection. This ephemeral graph is an in-memory version that can be queried with Cypher so that you can see if it is correct or not.

CALL gds.ephemeral.database.create( 'ephemeralDatabaseName', 'existingProjectedGraph' ) YIELD dbName, graphName, createMillis

Upvotes: 0

Tomaž Bratanič
Tomaž Bratanič

Reputation: 6534

Yes, that is possible, there is a type parameter where you can input the wildcard option:

CALL gds.graph.create('myGraph3', 
   '*', 
   {ALL: {orientation: 'UNDIRECTED', type:'*'}})

Upvotes: 0

Related Questions