简体   繁体   中英

Neo4j, Graph Data Science Library: Calculating betweenness returns negative values

When calculating the betweenness centrality of my graph, some nodes receive negative values when using 'Undirected' as relationship orientation. Happens in Neo4j 4.0.6 with gds 1.2.2. but also in older versions. The graph itself should be alright, exporting it to Gephi and then calculating the betweenness factor returns all positive values.

Here is the Query:

CALL gds.alpha.betweenness.stream({
    nodeProjection: 'poi',
    relationshipProjection: {
        similar: {
            type: 'similar',
            orientation: 'UNDIRECTED'
        }
    }
}) 
YIELD nodeId, centrality
RETURN gds.util.asNode(nodeId).OsmID AS id, centrality
ORDER BY centrality ASC

Result: Negative Values after betweenness calculation

Used Graph: graphml file (4MB)

I am pretty much out of ideas at this point, the query should be alright and the graph also. Any help would be greatly appreciated.

Betweenness centrality has been just recently promoted out of the alpha tier to production quality in Graph Data Science version 1.3. At this moment only the preview version of the 1.3. GDS is available on GitHub . I have tested your dataset and it looks like with the new version the issue does not persist. So for now, you can either use the preview version of the GDS 1.3 version or wait a couple of days until the GA version will be available. The only thing changed is the output syntax, where centrality has been renamed to score.

CALL gds.betweenness.stream({
    nodeProjection: '*',
    relationshipProjection: {
        similar: {
            type: 'similar',
            orientation: 'UNDIRECTED'
        }
    }
}) 
YIELD nodeId, score
RETURN gds.util.asNode(nodeId).OsmID AS id, score
ORDER BY score ASC

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM