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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:56:59+00:00 2026-05-20T10:56:59+00:00

Using the Boost Graph Library, is it possible to get the port identifiers for

  • 0

Using the Boost Graph Library, is it possible to get the port identifiers for an edge?

Example: After calling read_graphviz, I can iterate through the edges of this graph and print their node_ids — I get “A -> B, A -> B”. How can I print something like “A:p0 -> B:p1, A:p0 -> B:p2”?

digraph G {
    A [label="A|<p0>p0"];
    B [label="B|<p1>p1|<p2>p2"];

    A:p0 -> B:p1;
    A:p0 -> B:p2;
}

Rendering of digraph G

  • 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-20T10:57:00+00:00Added an answer on May 20, 2026 at 10:57 am

    From the read_graphviz_new.hpp source:

    struct edge_info {
      node_and_port source;
      node_and_port target;
      properties props;
    };
    

    Where node_and_port looks like this:

    struct node_and_port {
      node_name name;
      std::string angle; // Or empty if no angle
      std::vector<std::string> location; // Up to two identifiers
      // ...
    }
    

    I think (but have not verified) that these results are available if you call the parser directly using:

     void parse_graphviz_from_string(const std::string& str, parser_result& result, bool want_directed);
    

    in namespace boost::read_graphviz_detail. It may also be available in the dynamic_property_map if you use read_graphviz directly; it internally refers to read_graphviz_new.


    Note: In graphviz.hpp, one of two graphviz parsers is selected, based on an #ifdef:

    #ifdef BOOST_GRAPH_USE_SPIRIT_PARSER
      return read_graphviz_spirit(data.begin(), data.end(), graph, dp, node_id);
    #else // Non-Spirit parser
      return read_graphviz_new(data,graph,dp,node_id);
    #endif
    

    If I am reading this correctly, then the non-spirit parser is the one you want; the spirit-based one looks like it disregards ports.

    Anyway, this is just based on a quick look at the source for boost v. 1.44; for me code of interest lives in /usr/include/boost/graph/detail/read_graphviz_new.hpp. I have not tested this, but it looks like all the plumbing is there.

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

Sidebar

Related Questions

I am writing a Graph-class using boost-graph-library. I use custom vertex and edge properties
Can anyone please tell me that once I've created a graph using Boost Graph
Using boost::program_options, I can not get my own option type to compile when it
I have C++ program using boost graph library. I wonder if there is any
I have a large graph (30k vertices, 250m edges) and using boost graph library
I am using the boost graph library to make a call to dijkstra_shortest_paths .
I'm looking at using Boost Graph Library as the basis for a dag graph.
Using boost build, if I can link to a boost python library with this
Using BOOST, I am trying to get the calling convention of a function, and
I currently use C++ to do some graph related computation using boost::graph. boost::graph can

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.