cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Local Clustering Coefficient with Neo4j

Below is the example in Neo4j algorithm book.
What are other choices for the relationship orientation?
What does undirected mean?
My relationships are directed. I changed the orientation to directed but it says it is not an option.

Thanks in advance.

CALL gds.localClusteringCoefficient.stream({

nodeProjection: "Library",

relationshipProjection: {

DEPENDS_ON: {

type: "DEPENDS_ON",

orientation: "UNDIRECTED"

}

}
})

YIELD nodeId, localClusteringCoefficient

WHERE localClusteringCoefficient > 0

RETURN gds.util.asNode(nodeId).id AS library, localClusteringCoefficient

ORDER BY localClusteringCoefficient DESC;

3 REPLIES 3

Relationship orientations are either "directed" or "undirected".

By default in Neo4j, all relationships are directed - that means they have a source and a target, and they always go in one way. So for example:

(:Person { name: "David" })-[:KNOWS]->(:Person { name: "Ben" })

However, sometimes it's useful to think about the relationship in both directions, and we don't really care which way it actually runs. For example, if David knows Ben, probably Ben knows David, and so direction doesn't really matter. In this sense, using some of the algorithms we can treat that "KNOWS" relationship as undirected and kinda work with it as if it runs both ways.

When an algorithm says that it's undirected, that means it doesn't use the direction information at all. Meaning that if you ran the algorithm twice, once on your graph, and once on the same graph with all of the relationships pointing the opposite way, you'd probably get the same thing.

Thanks for your response. I have a follow up question.

I would like to use the directed option for relationship orientations. I put "DIRECTED" as my orientation and it returns:

Orientation DIRECTED is not supported. Must be one of: NATURAL, REVERSE, UNDIRECTED.

would you mind explaining what does natural and reverse do ?

thanks in advance.

NATURAL, REVERSE, UNDIRECTED

These are defined here