Boost logo

Boost :

From: Daniel Mitchell (danmitchell_at_[hidden])
Date: 2006-07-25 13:39:43


Loïc Joly <loic.joly <at> reportive.com> writes:

>
> Daniel Mitchell a écrit :
>
> > I'm not sure I'd call that a bug; after all, the graph must contain at
least a
> > source vertex for DFS to be sensible. I would say that having a non-empty
> > graph is a pre-condition for calling DFS.
>
> It may be so for depth-first-search, I'm not a domain expert at all. In
> that case, maybe just adding this requirement to the doc would be enough.
>
> However, for topological_sort, this goes against my expectations.
> std::sort on an empty STL sequence may be useless, it is however defined
> and does the right thing. And it allows to write generic code easily,
> without requiring the user to check anything before. I do not see any
> reason why topological_sort would not behave the same.
>

I guess adding a simple test such as

if( vertices( g ).first == vertices( g ).second ) return;

at the beginning of topological_sort wouldn't hurt.


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