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 8404771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:41:05+00:00 2026-06-09T22:41:05+00:00

So, I must have gone through the Boost documentation for an hour today. I

  • 0

So, I must have gone through the Boost documentation for an hour today. I must be blind. I have, I hope, a simple question:

How do you get the corresponding vertices for an edge with boost::adjacency_list?

I have the following code which I’m trying to figure out:

typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS> Graph;
typedef boost::graph_traits<Graph>::edge_iterator EdgeIterator;
typedef std::pair<EdgeIterator, EdgeIterator> EdgePair;

EdgePair ep;
for (ep = edges(g); ep.first != ep.second; ++ep.first)
{
    // Get the two vertices that are joined by this edge...
}

Anyone know how to do this?

Thanks

  • 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-06-09T22:41:07+00:00Added an answer on June 9, 2026 at 10:41 pm

    You can find the functions you need in this page (in the section called “Non-Member Functions”). The ones you need are source and target.

    typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS> Graph;
    typedef boost::graph_traits<Graph>::edge_iterator EdgeIterator;
    typedef std::pair<EdgeIterator, EdgeIterator> EdgePair;
    typedef boost::graph_traits<Graph>::vertex_descriptor VertexDescriptor;
    
    EdgePair ep;
    VertexDescriptor u,v;
    for (ep = edges(g); ep.first != ep.second; ++ep.first)
    {
        // Get the two vertices that are joined by this edge...
        u=source(*ep.first,g);
        v=target(*ep.first,g);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

You must had gone through this before coming to my this question. How to
This must have been answered previously, but my Google powers are off today and
I've already created my models and have gone through several migrations. Now, I want
I must have a misunderstanding of the stack, or how functions are called, the
This must have an obvious solution, but I'm stumped. We are developing an application
I must have pressed on the wrong button at some point, and now when
You must have noticed one link in yahoo.com, msn.com or other popular websites named
I must have overlooked something completely obvious?? but my button displays its image and
I must have a little design in javascript. I have a menu with 5
I must have done something wrong. I have a C# project in Visual Studio

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.