Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-09-19 14:32:04


----- Original Message -----
From: "jeremy siek" <jsiek_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, September 19, 2000 2:27 PM
Subject: Re: [boost] Graph stuff

> David Abrahams writes:
> > Isn't it really there to make up for lack of template template
parameters?
> > If so, I would hesitate to use the same convention for weight, which
will
> > never be a TTP.
>
> Right, they are used to replace TTPs.
>
> > property<int, edge_weight> // nobody puts weights on nodes anyway
> > property<int, edge_color> // I realize there are some orthogonality
> > issues here...
> > property<int, node_color> // ...but it may actually make the
declaration
> > of the graph a lot clearer
> >
> > Any of these things strike your fancy or set off a spark?
>
> This last suggestion strikes my fancy. Something that has been bugging
> me is that it is hard to tell by looking at an adjacency_list typedef
> whether a plugin was being used for a vertex or edge plugin. Having
> "edge" or "vertex" in the name certainly makes this stand out.
>
> typedef adjacency_list<
> mapS, vecS, bidirectionalS,
> property<default_color_type, vertex_color,
> property<int, vertex_in_degree> >,
> property<int, edge_weight>
> > Graph;
>
> The orthogonality issue is not a big deal. They are just empty structs
> anyways, so having duplicates like edge_color and vertex_color is ok
> (though in this case, nobody uses edge_color).

Great! Now how about dropping the S from bidirectionalS, undirectedS, and
directedS?

Also, let's talk about the following:

  edge_property_accessor<Graph, capacity_tag>::type capacity
    = get_edge_property_accessor(G, capacity_tag());
  edge_property_accessor<Graph, flow_tag>::type flow
    = get_edge_property_accessor(G, flow_tag());

Now it looks like this, given our changes:

  edge_property_accessor<Graph, edge_capacity>::type capacity
    = get_edge_property_accessor(G, edge_capacity());
  edge_property_accessor<Graph, edge_flow>::type flow
    = get_edge_property_accessor(G, edge_flow());

Do you think we could have one of these instead?

  edge_property<Graph, edge_capacity>::type capacity
    = edge_property(G, edge_capacity());
  edge_property<Graph, edge_flow>::type flow
    = edge_property(G, edge_flow());

or better yet:

  // using static template member functions
  edge_capacity_type<Graph>::type capacity = edge_capacity::get(G);
  edge_flow_type<Graph>::type flow = edge_flow::get(G);

or maybe:

  property_traits<Graph, edge_capacity>::type capacity =
edge_capacity::get(G);
  property_traits<Graph, edge_flow>::type flow = edge_flow::get(G);

And then some convenience functions:

  edge_capacity::get(G, edge_descriptor) // to get an edge_capacity
  edge_capacity::set(G, edge_descriptor, value) // to set an edge capacity

If you want to call it put(), that's OK too I guess.

never-satisfied-ly y'rs,
dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk