Boost logo

Boost Users :

From: Jeffrey Holle (jeffreyholle_at_[hidden])
Date: 2006-12-05 17:22:38


Since no one replied to this message, I'll answer it myself. Yes, to
both questions!
This is the code that demonstrates:
   typedef map<Vertex,int,ltDescriptor<Vertex> > Demand;
   typedef map<Edge,int,ltDescriptor<Edge> > Cost;

   int main(int argc, char **argv)
   {
     try {
       Graph graph;
       Demand demand;
       Cost cost;
       /*
        * Populate graph and vertex/edge property maps
        */
       if (argc!=2) {
         cerr << "usage: ns_test \"dot file name\"" << endl;
         exit(1);
       }
       ifstream in(argv[1]);
       if (!in) {
         cerr << "can't open input file \"" << argv[1] << "\"" << endl;
         exit(1);
       }
       associative_property_map<Demand> demandProperty(demand);
       associative_property_map<Cost> costProperty(cost);
       dynamic_properties dp;
       dp.property("node_id",get(vertex_name, graph));
       dp.property("demand",demandProperty);
       dp.property("cost",costProperty);

       read_graphviz(in,graph,dp);
     } catch (exception& e){
       cerr << "exception: \"" << e.what() << "\"" << endl;
     } catch (...) {
       cerr << "Something bad happened!" << endl;
     }
   }

Note that I put the actual name of vertices into the graph, but
placed both vertex and edge properties in external resources.

Jeffrey Holle wrote:
> I using the boost CVS version, obtained last week Tuesday.
> I'm interested in using read_graphviz in a fairly complex manner.
>
> I want to read multiple properties from a *.dot file, including:
> - 1 graph property
> - 2 vertex properties
> - 2 edge properties
> Can this be done with the read_graphviz?
>
> Moreover, I would like these properties to end up outside of the graph.
> If this is possible, how is it done?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net