Boost logo

Boost :

From: Provisional Dissonance (prosonance_at_[hidden])
Date: 2004-03-31 04:48:00


If one accepts the axiom that "a picture is worth a
thousand words," then it naturally follows that
discussion of graphs is always overly prolix. Sadly,
the same reasoning is also applicable to the code of
graph libraries. Boost.Graph seems to expose and
require an unnecessarily large amount of complexity,
though. Whereas libraries like Spirit go to great
lengths to make hard things easy, BGL seems to try
only to make hard things possible. The amount of
scaffolding required to use BGL for even the simplest
of projects often dwarfs the code size of a naive, yet
functional, special-purpose implementation.

While I understand that the BGL is deeply entrenched
in boost culture, certain academic circles, and even
publications, I nonetheless suggest that BGL lacks the
ease of use necessary for widespread adoption. Even
knowing that ease-of-use is not a criterion for
acceptance into boost, looking at what is required of
the client to use the BGL always leaves me feeling
perplexed. Is there any particular reason that a
simplified interface is not made available? Perhaps a
container adapter could be packaged with the library
allowing a compromise of functionality and flexibility
for simplicity? If a graphing problem is trivial,
shouldn't BGL provide a trivial solution? Why are the
simplest useful examples several hundred lines of
code?

I apologize for all of my vague criticisms - my
intention is not to flame but rather to test the
waters. It is difficult for me to assess whether the
simplicity I yearn for isn't present for stylistic
reasons or whether it would rather necessitate a
sacrifice of flexibility, functionality or
implementation clarity. Nor is it clear to me to what
extent these criteria can be compromised to promote
clarity of client code. For what it is worth, the
kind of ease-of-use I'm imagining might look like:

#include <less_than_10_graph_headers>
...
digraph<some_node_type,some_edge_context_type> g;
g << "vertex" << make_pair("vertex",
"implicit_vertex");
g.add_edge("brother", "sister", "sibling");
if(g.find(make_pair("brother", "sister")))
            related = true;

Could someone please elucidate on why it is
impossible/impractical/unnecessary/whatever for a
graph library to have such an interface? Should I
accept that the BGL is not the magic bullet graph
library and move on, or can this kind of simplicity be
somehow found within?

Thanks in advance,
prs

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html


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