Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6341577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:03:54+00:00 2026-05-24T20:03:54+00:00

In the algorithm I’m currently implementing, there is this line (where u is a

  • 0

In the algorithm I’m currently implementing, there is this line (where u is a vertex in a graph, and Pred(u) are all vertices having edges pointing at u):

for all s ∈ Pred(u) ∪ {u}

The Pred(u) part I translate into boost::graph code like this:

boost::graph_traits<Graph>::in_edge_iterator in_begin, in_end;
boost::tie(in_begin, in_end) = boost::in_edges(u, G);
for(boost::graph_traits<Graph>::in_edge_iterator i = in_begin; i != in_end; ++i) {
    // Do stuff
}

For now, I’m doing the Do stuff stuff outside of the loop for u explicitly, but I’d like to do it in the for loop. Is there some trick to create the iterators as if u was returned from boost::in_edges?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:03:55+00:00Added an answer on May 24, 2026 at 8:03 pm

    I think the solution you are using is alright (as long as the Do stuff code is well factorized).

    However, if you often face such issues, you can have a look at Boost.Range, a library for manipulating ranges of values instead of iterators. Here, you could use the join function to obtain the union of your two ranges (the result of boost::in_edges and u).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In QuickGraph - is there algorithm for find all parents (up to root vertex's)
What algorithm I can use for problem like this: Have a graph positive weighted,
My algorithm produces a list of (usually) several thousand line segments (all 2D) which
This algorithm does a great job of traversing the nodes in a graph. Dictionary<Node,
I know the basic algorithm for this problem but I am having trouble changing
Algorithm to generate all possible letter combinations of given string down to 2 letters
The algorithm name is after some mathematician. You can traverse image line by line
An algorithm having worst-case running time of O(N^2) took 30secs to run for input
Algorithm Consider this layout: +-------------+ | | | | | +--+ | | |##|
The algorithm I need to come up with is one that computes all the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.