Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-01-13 12:30:56


Hi Neal,

On Fri, 12 Jan 2001, Neal Fachan wrote:

neal> Hi. I just recently started using the BGL. First, I want to
neal> say that BGL is a great library. Thank you for providing it.
neal> I've had three questions/problems with BGL so far. BTW, I'm
neal> using the CVS version with tag Version_1_20_0.

Thanks!

neal> First, there's an add_edge which takes an edge property, but
neal> there isn't an add_vertex which takes a vertex property. It
neal> seems like either both or neither should exist. I would prefer
neal> if there was a second version of add_vertex which took the
neal> property.

That was an oversight. I'll create this version of add_vertex().

neal> Second, when using add_edge on a graph which checks for
neal> parallel edges, it would be handy if the return pair always
neal> contained a valid edge descriptor, even if the edge previously
neal> existed. I seem to have a lot of cases which look like this:
neal>
neal> Edge e;
neal> bool created;
neal> boost::tie(e, created) = add_edge(v1, v2, g);
neal> if (!created)
neal> boost::tie(e, create) = edge(v1, v2);
neal> put(propertyMap, e, enabled);
neal>
neal> It's not that big of a deal to have to make the "edge" call,
neal> but it seems like add_edge must already have the existing edge
neal> to return created=false, so it should be able to return it.

I'll look into this. I suspect it should not be a problem.

neal> Third, adding custom property portably is kind of a pain right
neal> now. The documentation reads that one should be able to create
neal> an empty struct/class, but the examples show that you need
neal> conditional compilation based on
neal> BOOST_NO_PARTIAL_TEMPLATE_SPECIALIZATION. Additionally, since
neal> the non-partial-specialization version uses an enum value for
neal> the instance, while the "normal" version uses a real class
neal> instance, I have to conditionally define the variable in a
neal> .cpp file. I've written some macros to work around this, but
neal> it seems like the old version where you just had a simple
neal> class and could create a simple instance when you needed it,
neal> get(my_tag(), g), was a lot simpler.

Actually, the enum version is portable... it will work for both partial
and no partial situations. Sorry for the confusion.

Also, there is currently a way for you to use the "real class" even with
no partial spec. Here's how one would modify the example/edge_property.cpp
to do this:

struct edge_flow_t {
  typedef edge_property_tag kind;
  enum { num = 100 };
};

struct edge_capacity_t {
  typedef edge_property_tag kind;
  enum { num = 101 };
};

And then in the rest of the example use "edge_flow_t()" instead
of "edge_flow".

neal> Thanks again for providing a great library. I've definitely
neal> enjoyed using it.

You're welcome,
Jeremy

----------------------------------------------------------------------
 Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
 Ph.D. Candidate email: jsiek_at_[hidden]
 Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------


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