Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@noahares
Copy link

Compute the diameter of directed graphs with one strongly connected component faster than with the current naive approach.
Implemented as the practical part of @michitux lecture on networks.
Difub: http://link.springer.com/chapter/10.1007/978-3-642-30850-5_10

count size_f = i < distancesF.size() ? distancesF[i].size() : 0;
count size_b = i < distancesB.size() ? distancesB[i].size() : 0;
#pragma omp parallel for
for (count j = 0; j < size_f + size_b; ++j) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be omp_index which is a signed integer when using MSVC as - at lest with the parameters NetworKit uses - MSVC doesn't support OpenMP loops with unsigned integers.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I fixed it. Changing j to omp_index should be enough? In cpp/distance/APSP.cpp the loop has a count in its condition.

@noahares
Copy link
Author

Master branch seems to pass CI now, merged it and now this branch should pass it as well.

*/
template <class InputIt, typename L>
void BFSfrom(const Graph &G, InputIt first, InputIt last, L handle) {
void BFSfrom(const Graph &G, InputIt first, InputIt last, L handle, bool reverse = false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR. I see that you need to follow in-edges but I am not sure that adding this reverse parameter to BFSfrom is the best way to do it.
What about making the implementation of BFSfrom private (e.g., BFSfromImpl) and exposing two functions BFSfrom (follows out-edges) and ReverseBFSfrom (follows in-edges)? The two functions would both use BFSfromImpl, which can take an additional (template?) boolean parameter to decide whether to follow in- our out-edges (as you are already doing here). This holds for Eccentricity as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback. This sounds like a good way to do it. I will implement it like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants