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

BGL - add CGAL::shortest_path(vs, vt, mesh) #8724

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

Conversation

janetournois
Copy link
Member

@janetournois janetournois commented Jan 31, 2025

Summary of Changes

computes the shortest path between two vertices, using Dijkstra algorithm

Todo

  • write doc and integrate to
  • add np
  • add measure to define what "shortest" means
  • add to ref manual top page
  • use in demo code

Release Management

@janetournois janetournois added this to the 6.1-beta milestone Jan 31, 2025
@sloriot
Copy link
Member

sloriot commented Feb 6, 2025

Compilation error here

@MaelRL MaelRL added Not yet approved The feature or pull-request has not yet been approved. Small feature CHANGES.md not updated labels Feb 6, 2025
@afabri
Copy link
Member

afabri commented Feb 11, 2025

Compilation error here

What error ?


/*!
* \ingroup PkgBGLTraversal
* Computes the shortest path between two vertices in a graph `g`
Copy link
Member

Choose a reason for hiding this comment

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

We have to add that the vertices must be in the same connected component

for (auto path_it = path.begin(); path_it != path.end() - 1; ++path_it)
{
const std::pair<halfedge_descriptor, bool>
h = halfedge((path_it + 1)->vertex, path_it->vertex, g);
Copy link
Member

Choose a reason for hiding this comment

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

Can't we obtain directly the halfedges when running Dijkstra, instead of having a sequence of vertices?

Copy link
Member

Choose a reason for hiding this comment

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

I think we can by implementing a DijkstraVisitor::edge_relaxed(e) and store the edge in a property map of the target vertex. See the documentation here: vis.edge_relaxed(e, g) is invoked on edge (u,v) if d[u] + w(u,v) < d[v]. The edge (u,v) that participated in the last relaxation for vertex v is an edge in the shortest paths tree.

@sloriot
Copy link
Member

sloriot commented Feb 12, 2025

Successfully tested in CGAL-6.1-Ic-84

@github-actions github-actions bot removed the Tested label Mar 3, 2025
Copy link

github-actions bot commented Mar 3, 2025

This pull-request was previously marked with the label Tested, but has been modified with new commits. That label has been removed.

@janetournois janetournois marked this pull request as ready for review March 4, 2025 10:39
@janetournois
Copy link
Member Author

/build:v0

Copy link

github-actions bot commented Mar 4, 2025

The documentation is built. It will be available, after a few minutes, here: https://cgal.github.io/8724/v0/Manual/index.html

@janetournois
Copy link
Member Author

/force-build:v0

Copy link

github-actions bot commented Mar 4, 2025

The documentation is built. It will be available, after a few minutes, here: https://cgal.github.io/8724/v0/Manual/index.html

@janetournois
Copy link
Member Author

/force-build:v0

* \cgalParamDescription{a property map associating to each edge in the graph its weight or ``length''.
* The weights must all be non-negative.}
* \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits<PolygonMesh>::%edge_descriptor`
* as key type and `FT` as value type.}
Copy link
Member

Choose a reason for hiding this comment

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

No need to introduce FT. It is probably specified in the BGL what has to be provided for "adding" and "comparing" weights.

Copy link

github-actions bot commented Mar 4, 2025

The documentation is built. It will be available, after a few minutes, here: https://cgal.github.io/8724/v0/Manual/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CHANGES.md not updated Not yet approved The feature or pull-request has not yet been approved. Pkg::BGL Small feature TODO
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants