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

Working towards running BGL algorithms on ManifoldSurfaceMesh #192

Merged
merged 3 commits into from
Sep 30, 2024

Conversation

afabri
Copy link
Contributor

@afabri afabri commented Sep 11, 2024

Hello,
As a mesh is a graph with vertices and edges it is sometimes useful to run graph algorithms on a mesh.
This PR is the first step towards this goal which will enable to write code like

  geometrycentral::surface::VertexData<double> distance(*mesh);

  auto source = *(vertices(*mesh).first);
  boost::breadth_first_search(*mesh, source,
    boost::visitor(boost::make_bfs_visitor(boost::record_distances(boost::make_assoc_property_map(distance), boost::on_tree_edge())))
    .vertex_index_map(boost::associative_property_map<geometrycentral::surface::VertexData<std::size_t>>(mesh->getVertexIndices())));

  for(auto v : mesh->vertices()){
    std::cout << v << " at distance " << distance[v] << std::endl;
  }

@nmwsharp nmwsharp merged commit 43866a1 into nmwsharp:master Sep 30, 2024
3 checks passed
@nmwsharp
Copy link
Owner

looks good, thank you!

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.

2 participants