Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

Triangle Count coefficient that are returned are incorrect. #903

Open
tomzeppenfeldt opened this issue Jun 17, 2019 · 0 comments
Open

Triangle Count coefficient that are returned are incorrect. #903

tomzeppenfeldt opened this issue Jun 17, 2019 · 0 comments

Comments

@tomzeppenfeldt
Copy link

I have the impression that

CALL algo.triangleCount.stream('Person', 'KNOWS', {concurrency:4})
YIELD nodeId, triangles, coefficient

RETURN algo.asNode(nodeId).id AS name, triangles, coefficient
ORDER BY coefficient DESC

as illustrated on https://neo4j.com/docs/graph-algorithms/current/algorithms/triangle-counting-clustering-coefficient/ (table 6.25) returns the wrong results:

from https://en.wikipedia.org/wiki/Clustering_coefficient :
The local clustering coefficient {\displaystyle C_{i}} C_{i} for a vertex {\displaystyle v_{i}} v_{i} is then given by the proportion of links between the vertices within its neighbourhood divided by the number of links that could possibly exist between them. For a directed graph, {\displaystyle e_{ij}} e_{ij} is distinct from {\displaystyle e_{ji}} e_{{ji}}, and therefore for each neighbourhood {\displaystyle N_{i}} N_{i} there are {\displaystyle k_{i}(k_{i}-1)} k_{i}(k_{i}-1) links that could exist among the vertices within the neighbourhood ( {\displaystyle k_{i}} k_{i} is the number of neighbours of a vertex).

For node “Michael”, 3 out of 6 possible edges connecting all vertices in their neighbourhood actually exist, so the coefficient should be 0,5 instead of 0,3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant