Aggregate Parallel Relationships after gds.alpha.collapsePaths

Main query
Is it possible to either...

  • a) Aggregate parallel relationships on an existing GDS graph projection after it has been created.
  • b) Create a new graph projection using the content of an existing one?

Why?
I have a projected graph...

CALL gds.graph.create('test','USER',{
     REPRESENTS: {type: 'REPRESENTS',orientation: 'NATURAL'},
     FOLLOWS: {type: 'FOLLOWS', orientation: 'NATURAL'}}) 
YIELD graphName, nodeCount,relationshipCount

and I have mutated it using gds.alpha.collapsePath.mutate

CALL gds.alpha.collapsePath.mutate('test', {
    relationshipTypes:['FOLLOWS','REPRESENTS'],
    allowSelfLoops:false,
    mutateRelationshipType:'META_FOLLOWS'}) 
Yield relationshipsWritten

The point of it is to collapse down the current relationship to a simplified version.

(a: USER)-[:REPRESENTS]->(:USER)-[:FOLLOWS]->(:USER)<-[:REPRESENTS]-(b:USER)
(a:USER)-[:META_FOLLOWS]->(b:USER)

After my original test graph has been mutated, and had the META_FOLLOWS relationship added, I wanted to aggregate all parallel relationships so that I would have distinct relationships between nodes, each with a weight property that was equal to the count of parallel relationships. If collapsePath had written directly to the database I (think i) would do the following..

CALL gds.graph.create('final_graph', 'USER', {
    META_FOLLOWS: {
        properties:{
           weight:{property: '*', aggregation: 'COUNT'}
                 }
            }
        }
)

Is the only way ahead to manually stream out the META_FOLLOWS relationship from the first graph, save it to the DB and then run the second projection with the aggregation, or is there a way to do this all in one projection?

Any advice would be very helpful, thanks!

*NB for reasons I can't just export the projection to another database.

Hi, Minyall

Did I understand correctly that you get parallel META_FOLLOWS relations between a pair of nodes? I asking because the "gds.alpha.collapsePaths" documentation says that only one connection is created between a pair of nodes.

Thanks in advance for your answer