Skip to content

Direct betweenness #2352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Conversation

GroteGnoom
Copy link
Member

@GroteGnoom GroteGnoom commented May 28, 2023

Fixes #1796

Making cutoffs work seems like a lot of work, because the only shortest path functions with cutoffs are igraph_distances_cutoff, igraph_distances_dijkstra_cutoff, which don't actually give me the paths.

subset betweenness should be doable.
Edit:
subset betweenness is way harder than I thought.

the FINALLY stack is a mess, that still needs to be fixed.

@codecov
Copy link

codecov bot commented May 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.46%. Comparing base (6e3d61b) to head (15c8ae8).
Report is 1268 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2352   +/-   ##
=======================================
  Coverage   83.46%   83.46%           
=======================================
  Files         376      376           
  Lines       61576    61576           
=======================================
+ Hits        51394    51397    +3     
+ Misses      10182    10179    -3     
Files with missing lines Coverage Δ
src/paths/all_shortest_paths.c 98.16% <ø> (+0.91%) ⬆️

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6e3d61b...15c8ae8. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@GroteGnoom
Copy link
Member Author

GroteGnoom commented Jun 3, 2023

If I have an undirected line:

igraph_small(&graph, 5, IGRAPH_UNDIRECTED, 0,1, 1,2, -1);

and I do a subset betweenness between source 0, and target 2:

igraph_vss_range(0, 1), igraph_vss_range(2,3))

Then for vertex 1 I should get a betweenness of 1, right? Not 0.5.

The original implementation just divides the end result by 2 for undirected situations, but I think that's incorrect. That only works if your targets and sources are the same. If there's no overlap then there is no division needed at all, and if there is a little overlap, you can't use a basic division at the end to fix everything.

@szhorvat
Copy link
Member

szhorvat commented Jun 3, 2023

Making cutoffs work seems like a lot of work, because the only shortest path functions with cutoffs are igraph_distances_cutoff, igraph_distances_dijkstra_cutoff, which don't actually give me the paths.

Let's skip this until the necessary functions are implemented. #2358

@szhorvat
Copy link
Member

szhorvat commented Jun 3, 2023

If I have an undirected line:

igraph_small(&graph, 5, IGRAPH_UNDIRECTED, 0,1, 1,2, -1);

and I do a subset betweenness between source 0, and target 2:

igraph_vss_range(0, 1), igraph_vss_range(2,3))

Then for vertex 1 I should get a betweenness of 1, right? Not 0.5.

Correct.

The original implementation just divides the end result by 2 for undirected situations, but I think that's incorrect. That only works if your targets and sources are the same. If there's no overlap then there is no division needed at all, and if there is a little overlap, you can't use a basic division at the end to fix everything.

I believe you are right. I'd have to look into this in more detail to see how the subset version works and how it can be fixed most effectively.

But we are making progress, we discovered a bug, so that's good. This was precisely the purpose of the direct implementation.

@szhorvat
Copy link
Member

szhorvat commented Jun 3, 2023

@ntamas
Copy link
Member

ntamas commented Jun 4, 2023

I believe you are right.

Yes, you are correct. This seems to be a bug indeed. Great job!

Copy link

stale bot commented Apr 26, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@szhorvat szhorvat added the todo Triaged for implementation in some unspecified future version label Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
todo Triaged for implementation in some unspecified future version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a direct implementation of betweenness for testing
3 participants