neo4j / graph-data-science

Source code for the Neo4j Graph Data Science library of graph algorithms.
https://neo4j.com/docs/graph-data-science/current/
Other
596 stars 157 forks source link

Betweeness centrality with source and target node #307

Open Mintactus opened 1 month ago

Mintactus commented 1 month ago

It would be amazing to have a betweeness centrality parameter to set a source and target node, so you can know the influence of all nodes in the graph to go from source to target node.

I'm trying to get the behavior of all cusomers from zero to a specific touchpoint type, for now I'm using yen's but the output of yen is not optimised for that purpose at all.

Mats-SX commented 2 weeks ago

Hello @Mintactus and thank you for the feature request.

I find the feature a little off-beat to the general semantics of Betweenness Centrality. If we limit the computation to just one single shortest path, the result will not really represent the algorithm. The algorithm is defined as the sum of shortest paths from all other nodes to all other nodes passing through this node. With only a single path, most nodes will trivially be zero.

I would advise similar to what you are already trying, namely to use a Path Finding algorithm instead for this use case.

Limiting to only a single source node, across all target nodes, is potentially more interesting. It still doesn't really represent a Betweenness Centrality score, because it's scoped from a single source node only.

Limiting to a specific set of source nodes, across all target nodes (vice versa would be possible with a REVERSE orientation) is a different variant of the already present approximation method that GDS offers. Instead of a random set of nodes it would accept a specific set. It now starts looking more like a BC score again.

These are some of my thoughts on the feature.