title: boost graph library: named_graph and remove_vertex
body: <p>I'm experimenting with using the named_graph mixin, and I'm a little confused how remove_vertex() should work.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;boost/lexical_cast.hpp&gt;
  #include &lt;boost/graph/adjacency_list.hpp&gt;
  
  struct vertex_info {
    std::string name;          // uses vertex_from_name&lt;vertex_info&gt;
    vertex_info(const std::string &amp;name_) : name(name_) { }   
  };
  
  ostream&amp; operator&lt;&lt;(ostream &amp; os, const vertex_info &amp;v)
  {
    os &lt;&lt; v.name;
    return os;
  }
  
  namespace boost { namespace graph {
  
  template&lt;typename Type&gt;
  struct vertex_name_extractor
  {
    typedef Type type;
    typedef const std::string&amp; result_type;    
    result_type operator()(const Type&amp; v) const
    {
      return v.name;
    }
  };
  
  template&lt;&gt;
  struct internal_vertex_name&lt;vertex_info&gt;
  {
    typedef vertex_name_extractor&lt;vertex_info&gt; type;
  };
  
  template&lt;&gt;
  struct internal_vertex_constructor&lt;vertex_info&gt;
  {
    typedef vertex_from_name&lt;vertex_info&gt; type;
  };
  
  } }
  
  typedef adjacency_list&lt; vecS, vecS, undirectedS, vertex_info, edge_info&gt; graph_t;
  
  namespace bg=boost::graph;
  int main()
  {
    using namespace std;
    graph_t g;
  
    int i;
    typedef graph_traits&lt;graph_t&gt;::vertex_descriptor vert;
  
    for(i=0;i &lt; 10;++i)
    {
      string t_name("Vertex");
      vert V;
      t_name += lexical_cast&lt;string&gt;(i);
      V = add_vertex(t_name,g);
    }
  
    typedef graph_t::vertex_name_type name_t;
    name_t s_temp("Vertex2");
  
    optional&lt;vert&gt; V(
    find_vertex(s_temp,g));
  
    if( V ) {
      cout &lt;&lt; "Found vertex:" &lt;&lt; *V &lt;&lt; '\n';
      //remove_vertex(*V,g);           // (1)
      //remove_vertex(vertex(*V,g),g); // (2)
      //remove_vertex(g[*V],g);        // (3)
      //remove_vertex(s_temp,g);       // (4)
    } else {
      cout &lt;&lt; "Vertex not found\n";
    }
  
  
    graph_traits&lt;graph_t&gt;::vertex_iterator v_i, v_end;
  
    for(tie(v_i,v_end) = vertices(g); v_i != v_end; ++v_i)
    {
      cout &lt;&lt; '\'' &lt;&lt; g[*v_i] &lt;&lt; '\'' &lt;&lt; endl;;
    }
  }
  </code></pre>
  
  <p>When I try using (3) or (4), I get an error for no matching function call to    ‘remove_vertex(vertex_info&amp;, graph_t&amp;)’</p>
  
  <p>adjacency_list.hpp:2211 candidates: remove_vertex(typename graph_t::vertex_descriptor, graph_t &amp;)</p>
  
  <p>But when I try using (1) or (2), I get an error for invalid conversion from ‘long unsigned int’ to ‘const char*’.</p>
  
  <pre><code>  error:   initializing argument 1 of ‘std::basic_string&lt;...'
    boost/graph/named_graph.hpp:349
    template&lt;BGL_NAMED_GRAPH_PARAMS&gt;
    inline void BGL_NAMED_GRAPH::removing_vertex(Vertex vertex)
    {
        named_vertices.erase(vertex);  //line 349
    }
  </code></pre>