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

  • Home
  • SEARCH
  • 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 7066225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:03:29+00:00 2026-05-28T05:03:29+00:00

I am having some problems with the code from boost graph library Dijkstra example

  • 0

I am having some problems with the code from boost graph library Dijkstra example. I changed it so that my version doesn’t use enums and Letter rather just integers. It complains about the for loop and the tie function, as well as other tie calls except for the first.

Declerations:

  typedef std::pair<int, int> Edge;

  const int num_edges = num_edge;
  Edge edge_array[num_edges];
  int weights[num_edges];

  int size = 0;
  for(itora = edges.begin(); itora != edges.end(); ++itora){
    int u = *itora;
    ++itora;
    int v = *itora;
    ++itora;

    weights[size] = *itora;
    edge_array[size] = Edge(u,v);

    size++;
  }


  graph_traits<graph_t>::vertex_iterator i, iend;
  #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
  graph_t g(vertices.size());
  property_map<graph_t, edge_weight_t>::type weightmap = get(edge_weight, g); 

  std::vector<vertex_descriptor> msvc_vertices;
  for (boost::tie(i, iend) = vertices(g); i != iend; ++i){
    msvc_vertices.push_back(*i);
  }

  for (std::size_t j = 0; j < num_edges; ++j) {
    edge_descriptor e; bool inserted;
    boost::tie(e, inserted) = add_edge(msvc_vertices[edge_array[j].first], 
                                       msvc_vertices[edge_array[j].second], g); 
    weightmap[e] = weights[j];
  }

Does not break:

for (boost::tie(i, iend) = vertices(g); i != iend; ++i){
  msvc_vertices.push_back(*i);
}

This part breaks:

graph_traits<graph_t>::vertex_iterator xi, xiend;
for (boost::tie(xi, xiend) = vertices(g); xi != xiend; ++xi) {
  indexmap[*xi] = c;
  name[*xi] = '0' + c;
  c++;
}

Here is the error:

x.cc: In function 'int main(int, char**)':
x.cc:141: error: no match for call to '(std::vector<int, std::allocator<int> >) (main(int, char**)::graph_t&)'
gmake: *** [x.o] Error 1

Any help would be greatly appreciated, I don’t really know what the error is complaining about…

  • 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-28T05:03:29+00:00Added an answer on May 28, 2026 at 5:03 am

    Did you create a local variable std::vector<int> vertices somewhere in the unquoted code?

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

Sidebar

Related Questions

Having some problems with a piece of Jquery code, well that's where I think
I'm having some problems with the following code: private class ClientPluginLoader : MarshalByRefObject {
I'm having some problems trying to get the code below to output the data
I'm having some problems with this piece of code. I've included a class declaration
I am currently having some problems with <li> in IE6 essentially my code looks
I'm having problems with some code to create a CDialog based window. The code
I'm having a problem with some code that used to work in PHP 4.X
I'm having some problems with parsing the xml response from my ajax script. The
I am having some problems creating a query that gives me the average of
I'm having some problems debugging my code as I can't work out where an

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.