-
-
Notifications
You must be signed in to change notification settings - Fork 393
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
Wishlist: How many vertices are reachable from each vertex? #1872
Comments
It seems that faster than |
Do we still implement this if it's O(|V|^2)? I'm not sure it's worth it in that case. We already have this feature in The intuitive way to solve it is with repeated calls to Thus, there may be minor benefits to such a function, but I am not sure it's worth it. Opinions? If we do decide to implement it anyway, it can be marked as a good first issue. |
Worst case doesn't mean any implementation will always be so bad. I think there's some merit to such a function, so it wouldn't hurt including it. |
Is this issue still open? If yes, I would like to work on it. I hope O(V^2) is fine? |
Please first finish the PR you are working on right now (#1892). Once that is merged, we can talk about this one. |
Hello, I think I have an idea for a O(|V| + |E|) algorithm but I am not sure it's 100% correct. |
I would like to work on the issue even if my solution turned to be incorrect. That's of course in case you decided to move forward with the O(|V|^2) solution |
Hello I am the coauthor of a task in an algorithmic programming contest that had a problem which is exactly this. We can use a SCC algorithm as mentioned before to obtain a DAG. The time complexity becomes For the task to be solvable in python we decided on the value of With SIMD registers you may get even higher speeds. I'm not sure whether the compiler would automatically optimize that for us and I've only ever written SIMD code in C++. I imagine it is very similar in C. |
I will implement the method I described and make a pull request. |
What is the feature or improvement you would like to see?
A function that counts how many vertices are reachable from each vertex in a directed graph.
Here is an example where every vertex is labelled with how many others are reachable from it:
Can we devise a fast (faster than
O(|V| ^2)
) algorithm that accomplishes this?Use cases for the feature
References
The text was updated successfully, but these errors were encountered: