cancel
Showing results for 
Search instead for 
Did you mean: 

Native graph reduces degree when all relationship types are present

georg_kf_heiler
Node Clone

I want to execute graph algorithms from the GDS plugin. To do so, a graph projection needs to be defined: 4.1. Graph Catalog - Chapter 4. Graph management

However, I noticed that there is a huge difference in the degree distribution (max of 10k) when only using (A) (= only Friends) but the max is down to 5 when using all the relations present in (B).

This seems strange to me - I would have expected that the max degree can only increase when more diverse types of relationships are made available to the GDS graph.


CALL gds.graph.drop('my_graph') YIELD graphName;

// A: only Friend
CALL gds.graph.create.cypher(
    'my_graph',
    'MATCH (n) RETURN id(n) AS id',
    'MATCH (a)-[r:Friend]->(b) RETURN id(a) AS source, id(b) AS target'
);

// B: everything
CALL gds.graph.create.cypher(
    'my_graph',
    'MATCH (n) RETURN id(n) AS id',
    'MATCH (a)-[r]->(b) RETURN id(a) AS source, id(b) AS target'
);
CALL gds.graph.list();
2 REPLIES 2

You'll want to look at relationship aggregation parameters: https://neo4j.com/docs/graph-data-science/current/management-ops/cypher-projection/#cypher-projectio...


My suspicion is that, while the degree is higher, the number of nodes is lower for the Friend projection. I assume you're using percentiles vs maximum?

I was looking at the output for: CALL gds.graph.list(); and there at the max degree attribute. This attribute decreased drastically when adding more relationships - and I still do not understand why.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.