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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:24:27+00:00 2026-06-08T09:24:27+00:00

I have an adjacency list defined as shown below. At this point I need

  • 0

I have an adjacency list defined as shown below. At this point I need to access vertex_descriptor as an int type. How can I do that tvertex source = ...; int source_as_int = ???source??? I remember bumping into this same question before and solved it but don’t remember how and the BGL documentation is useless using it as reference, they should try to take a look at and learn from Javadocs.

Another possibility is to use a possible member function of the vertex_descriptor type or otherwise some of the global BGL functions for this purpose … one never knows where to look for this and they seem to randomly choose between making global functions or member functions, a total fail of an intuitive design if you ask me.

typedef adjacency_list_traits<setS, setS, bidirectionalS> ttraits;

typedef adjacency_list<setS, setS, bidirectionalS,
        // vertex properties
        property<vertex_color_t, default_color_type>,
        // edge properties
        property<edge_capacity_t, int,
        property<edge_residual_capacity_t, int,
        property<edge_reverse_t, ttraits::edge_descriptor> > >, no_property, vecS> tbgl_adjlist_bidir;

typedef graph_traits<tbgl_adjlist_bidir>::vertex_descriptor     tvertex;
typedef graph_traits<tbgl_adjlist_bidir>::edge_descriptor       tedge;
typedef property_map<tbgl_adjlist_bidir, edge_capacity_t>::type tedge_capacity_map;
typedef property_map<tbgl_adjlist_bidir, edge_reverse_t>::type  treverse_edge_map;
typedef property_map<tbgl_adjlist_bidir, vertex_color_t>::type  tvertex_color_map;
typedef graph_traits<tbgl_adjlist_bidir>::out_edge_iterator     tout_edge_iterator;
typedef graph_traits<tbgl_adjlist_bidir>::in_edge_iterator      tin_edge_iterator;
  • 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-08T09:24:28+00:00Added an answer on June 8, 2026 at 9:24 am

    OK I figured it out. Adding the vertex property vertex_index_t solves the problem. I can then access the int index of the vertex like this:

    typedef adjacency_list_traits<setS, vecS, bidirectionalS> ttraits;
    
    typedef adjacency_list<setS, vecS, bidirectionalS,
            // vertex properties
            property<vertex_index_t, int,
            property<vertex_color_t, default_color_type> >,
            // edge properties
            property<edge_capacity_t, int,
            property<edge_residual_capacity_t, int,
            property<edge_reverse_t, ttraits::edge_descriptor> > >, no_property, vecS> tbgl_adjlist_bidir;
    
    typedef graph_traits<tbgl_adjlist_bidir>::vertex_descriptor     tvertex;
    typedef graph_traits<tbgl_adjlist_bidir>::edge_descriptor       tedge;
    typedef property_map<tbgl_adjlist_bidir, edge_capacity_t>::type tedge_capacity_map;
    typedef property_map<tbgl_adjlist_bidir, edge_reverse_t>::type  treverse_edge_map;
    typedef property_map<tbgl_adjlist_bidir, vertex_color_t>::type  tvertex_color_map;
    typedef property_map<tbgl_adjlist_bidir, vertex_index_t>::type  tvertex_index_map;
    typedef graph_traits<tbgl_adjlist_bidir>::vertex_iterator       tvertex_iterator;
    typedef graph_traits<tbgl_adjlist_bidir>::edge_iterator         tedge_iterator;
    typedef graph_traits<tbgl_adjlist_bidir>::out_edge_iterator     tout_edge_iterator;
    typedef graph_traits<tbgl_adjlist_bidir>::in_edge_iterator      tin_edge_iterator;
    

    then I use it like this:

        tbgl_adjlist_bidir bgl_adjlist_bidir;
        // ...
        tvertex_index_map indices = get(vertex_index, bgl_adjlist_bidir);
        // ...
        tvertex source; 
        // ...
        int source_as_int = indices[source];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an adjacency list like this: A - A1 A - A2 A
In mysql, I have a tree that is represented using the adjacency list model.
I have Adjacency list mode structure like that and i want to count all
I have an adjacency model list and this is the query: SELECT t1.FIO AS
I have this hadoop map reduce code that works on graph data (in adjacency
Can someone please tell me what kind of adjacency list i have to make
I have an adjacency list of objects (rows loaded from SQL database with the
I have an undirected graph on matris by vertex adjacency relations like that; /*
I have a defined a simple template class. In this class I define a
I have the adjacency list of a large graph stored in a table. v1

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.