$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Olivier Tournaire (olitour_at_[hidden])
Date: 2007-11-12 17:24:59
I tried something else which seems to work, however, it might be unefficient
:
        if ( erase_nodes || erase_all )
        {
            while (num_vertices(*this)>0)
            {
                MPPRectangleGraph::vertex_iterator vi, vi_end, next;
                boost::tie(vi, vi_end) = vertices(*this);
                unsigned int i=0;
                clear_vertex(*vi, *this);
                remove_vertex(*vi, *this);
            }
        }
Any help would be appreciate.
Regards
2007/11/12, Olivier Tournaire <olitour_at_[hidden]>:
>
> Hi all,
>
> i'm trying to clear an adjacency_list. I do the following, as described in
> the documentation :
>
>
>
> void MPPRectangleGraph::Clear(unsigned int flags)
> {
>     bool erase_nodes = false, erase_edges = false, erase_all = false;
>     if ( flags&GraphErase::eERASE_ALL )
>         erase_all = true;
>     else
>     {
>         if ( flags&GraphErase::eERASE_NODES )
>             erase_nodes = true;
>         if ( flags&GraphErase::eERASE_EDGES )
>             erase_edges = true;
>     }
>     if ( erase_nodes || erase_all )
>     {
>         std::cout << "begin" << std::endl;
>         MPPRectangleGraph::vertex_iterator vi, vi_end, next;
>         boost::tie(vi, vi_end) = vertices(*this);
>         unsigned int i=0;
>         std::cout << num_vertices(*this) << std::endl;
>         //clear_vertex(*vi, *this);
>         //remove_vertex(*vi, *this);
>         for (next = vi; vi != vi_end; vi = next)
>         {
>             std::cout << i++ << std::endl;
>             ++next;
>             clear_vertex(*vi, *this);
>             remove_vertex(*vi, *this);
>         }
>     }
>     std::cout << "end" << std::endl;
> }
>
> The MPPRectangleGraph is simply derived from adjacency_list. Containers
> are boost:vecS for both vertices and edges. When I have 100 vertices in my
> graph, I catch an unhandeld exception with catch(...) ("i" is printed only
> unitl 50), and, when my graph contains only 3 nodes, a std::exception is
> catched with this message : "vector<T> too long".
> Can you help ?
>
> Regards.
>
-- Le temps des cerises reviendra. Dans l'immédiat, c'est le temps des noyaux. Courage.