Skip to content
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

add cutoff versions of shortest path functions #2362

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

GroteGnoom
Copy link
Member

fixes #2358

@codecov
Copy link

codecov bot commented Jun 10, 2023

Codecov Report

Merging #2362 (d7d6b7f) into master (e38117b) will increase coverage by 0.03%.
The diff coverage is 97.56%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2362      +/-   ##
==========================================
+ Coverage   83.50%   83.54%   +0.03%     
==========================================
  Files         377      377              
  Lines       61909    61932      +23     
==========================================
+ Hits        51700    51742      +42     
+ Misses      10209    10190      -19     
Impacted Files Coverage Δ
src/paths/all_shortest_paths.c 96.46% <80.00%> (-0.79%) ⬇️
src/paths/dijkstra.c 96.61% <100.00%> (+0.27%) ⬆️
src/paths/unweighted.c 95.07% <100.00%> (+0.30%) ⬆️

... and 4 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 e38117b...d7d6b7f. Read the comment docs.

@GroteGnoom
Copy link
Member Author

I think this https://dev.azure.com/igraph-team/igraph/_build/results?buildId=5553&view=logs&jobId=bbfa2fa6-a202-51ab-3559-6013e9e5f686&j=bbfa2fa6-a202-51ab-3559-6013e9e5f686&t=46cc7337-1682-57f5-be99-ed9c70724455

[191/194] Resolving includes in DocBook XML source
FAILED: doc/igraph-docs-with-resolved-includes.xml /home/vsts/work/1/s/build/doc/igraph-docs-with-resolved-includes.xml 
cd /home/vsts/work/1/s/build/doc && /usr/bin/xmllint --xinclude --output igraph-docs-with-resolved-includes-tmp.xml igraph-docs.xml && /usr/bin/python3.10 /home/vsts/work/1/s/tools/removeexamples.py igraph-docs-with-resolved-includes-tmp.xml igraph-docs-with-resolved-includes.xml && /usr/local/bin/cmake -E remove igraph-docs-with-resolved-includes-tmp.xml
Traceback (most recent call last):
  File "/home/vsts/work/1/s/tools/removeexamples.py", line 37, in <module>
    main()
  File "/home/vsts/work/1/s/tools/removeexamples.py", line 24, in main
    tree.parse(sys.argv[1])
  File "/usr/lib/python3.10/xml/etree/ElementTree.py", line 580, in parse
    self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: undefined entity &nbsp;: line 55521, column 30

is telling me I have a non-breaking space somewhere (https://en.wikipedia.org/wiki/Non-breaking_space), but I'm not sure how to find where this problem is.

@szhorvat
Copy link
Member

This is due to my change, I'll fix it in a moment.

Somehow the failure happens only on the CI but not locally.

@szhorvat
Copy link
Member

Fixed on master.

@GroteGnoom GroteGnoom marked this pull request as ready for review July 22, 2023 09:24
Copy link
Member

@szhorvat szhorvat left a comment

Choose a reason for hiding this comment

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

Thanks! This is an initial review round, will take a more detailed look later.

igraph_vector_int_list_t *vertices,
igraph_vector_int_list_t *edges,
igraph_vector_int_t *nrgeo,
igraph_integer_t from, const igraph_vs_t to,
igraph_neimode_t mode) {
igraph_neimode_t mode, igraph_integer_t cutoff) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we make the cutoff be an igraph_real_t even in the unweighted version, for clarity? This is the choice I made in igraph_distances(), with the reasoning that passing 2.1 should include paths of length 2.0. However, if the parameter is of integer type, then 2.1 is rounded to 2, and will exclude paths of length 2.

* \function igraph_get_all_shortest_paths
* \brief All shortest paths (geodesics) from a vertex.
* \function igraph_get_all_shortest_paths_cutoff
* \brief All shortest paths (geodesics) from a vertex, with cutoff.
Copy link
Member

Choose a reason for hiding this comment

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

Let's add \experimental for all new functions, even if changes are unlikely. We can remove that in 0.11. igraph_distances_cutoff() is also marked as experimental.

Copy link
Member

Choose a reason for hiding this comment

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

These docs say "added in 0.2", but that's for igraph_get_all_shortest_paths(), not for igraph_get_all_shortest_paths_cutoff().

* \function igraph_get_all_shortest_paths
* \brief All shortest paths (geodesics) from a vertex.
*
* \ref igraph_get_all_shortest_paths() without a cutoff.
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean the following?

Suggested change
* \ref igraph_get_all_shortest_paths() without a cutoff.
* \ref igraph_get_all_shortest_paths_cutoff() without a cutoff.

Can we keep the full original docs here please, especially since the new function will be "experimental"?

@@ -320,6 +320,31 @@ igraph_error_t igraph_shortest_paths_dijkstra(const igraph_t *graph,
* \function igraph_get_shortest_paths_dijkstra
* \brief Weighted shortest paths from a vertex.
*
* \ref igraph_get_shortest_paths_dijkstra() without a cutoff.
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as above, please keep the original docs, and add a reference to the cutoff version.

/**
* \ingroup structural
* \function igraph_get_shortest_paths_dijkstra_cutoff
* \brief Weighted shortest paths from a vertex with a cutoff.
Copy link
Member

Choose a reason for hiding this comment

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

Mark as experimental.

@@ -705,8 +735,8 @@ igraph_error_t igraph_get_shortest_path_dijkstra(const igraph_t *graph,

/**
* \ingroup structural
* \function igraph_get_all_shortest_paths_dijkstra
* \brief All weighted shortest paths (geodesics) from a vertex.
* \function igraph_get_all_shortest_paths_dijkstra_cutoff
Copy link
Member

Choose a reason for hiding this comment

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

Mark as experimental.


/**
* \ingroup structural
* \function igraph_get_all_shortest_paths_dijkstra
Copy link
Member

Choose a reason for hiding this comment

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

Keep original docs.

* \function igraph_get_shortest_paths
* \brief Shortest paths from a vertex.
* \function igraph_get_shortest_paths_cutoff
* \brief Shortest paths from a vertex with a cutoff.
Copy link
Member

Choose a reason for hiding this comment

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

Mark as experimental.

igraph_vector_int_list_t *vertices,
igraph_vector_int_list_t *edges,
igraph_integer_t from, const igraph_vs_t to,
igraph_neimode_t mode,
igraph_vector_int_t *parents,
igraph_vector_int_t *inbound_edges) {
igraph_vector_int_t *inbound_edges,
igraph_integer_t cutoff) {
Copy link
Member

Choose a reason for hiding this comment

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

Make it an igraph_real_t.

/**
* \ingroup structural
* \function igraph_get_shortest_paths
* \brief Shortest paths from a vertex.
Copy link
Member

Choose a reason for hiding this comment

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

Keep original docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shortest path functions with cutoff distance
2 participants