<div dir="ltr">It appears graph_copy does not support the graph_traits&lt;&gt; template specialization to retrieve associated types for a graph, but instead relies on typedefs being defined directly in the class, which vtkGraph does not have.<div>
<br></div><div style>Looks like you may need to traverse manually to do the conversion. Something like the following:</div><div style><br></div><div style>for (vtkIdType i = 0; i &lt; graph-&gt;GetNumberOfVertices(); ++i)</div>
<div style>{</div><div style>  add_vertex(g);</div><div style>}</div><div style><br></div><div style>for (vtkIdType i = 0; i &lt; graph-&gt;GetNumberOfEdges(); ++i)</div><div style>{</div><div style>  add_edge(graph-&gt;GetSourceVertex(i), graph-&gt;GetTargetVertex(i), g);</div>
<div style>}</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 7, 2013 at 4:45 AM, Dr. Roman Grothausmann <span dir="ltr">&lt;<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-hannover.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Jeff,<br>
<br>
<br>
Many thanks for Your reply.<div class="im"><br>
<br>
On 06/02/13 15:45, Jeff Baumes wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
You may want to try making an instance of this specific<br>
graph type and use copy_graph<br></div>
&lt;<a href="http://www.boost.org/doc/libs/1_53_0/libs/graph/doc/copy_graph.html" target="_blank">http://www.boost.org/doc/<u></u>libs/1_53_0/libs/graph/doc/<u></u>copy_graph.html</a>&gt; to convert<div class="im"><br>
the vtkGraph to the type the library expects.<br>
</div></blockquote>
<br>
I tried the following:<div class="im"><br>
<br>
<br>
  vtkGraph* graph= polyDataToGraphFilter-&gt;<u></u>GetOutput();<br>
<br>
  //vtkBoostUndirectedGraph g(graph);<br>
<br></div>
  Graph g;<br>
  boost::copy_graph(graph, g);<br>
<br>
<br>
but it fails with:<br>
<br>
In file included from /home/grothama/vtk/<u></u>GraphOpening-master/<u></u>GraphOpeningTrackingExample_<u></u>01.cxx:29:0:<br>
/usr/include/boost/graph/copy.<u></u>hpp: In instantiation of ‘struct boost::detail::choose_graph_<u></u>copy&lt;vtkGraph*&gt;’:<br>
/usr/include/boost/graph/copy.<u></u>hpp:347:7:   required from ‘void boost::copy_graph(const VertexListGraph&amp;, MutableGraph&amp;) [with VertexListGraph = vtkGraph*; MutableGraph = boost::adjacency_list&lt;boost::<u></u>vecS, boost::vecS, boost::undirectedS, boost::no_property, EdgeVisibility&gt;]’<br>

/home/grothama/vtk/<u></u>GraphOpening-master/<u></u>GraphOpeningTrackingExample_<u></u>01.cxx:87:29:   required from here<br>
/usr/include/boost/graph/copy.<u></u>hpp:251:50: error: ‘vtkGraph*’ is not a class, struct, or union type<br>
<br>
Do all these problems arise of the property EdgeVisibility (which I would not need at all) or am I using vtkBoostGraphAdapter.h and boost::copy_graph in the wrong way?<br>
<br>
Thanks for any help or hints<br>
Roman<div class="im"><br>
<br>
If copy_graph doesn&#39;t work you may<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
need to manually iterate over vertices/edges to construct the graph.<br>
<br>
<br>
On Wed, Feb 6, 2013 at 9:30 AM, Dr. Roman Grothausmann<br></div>
&lt;<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-<u></u>hannover.de</a> &lt;mailto:<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-<u></u>hannover.de</a>&gt;&gt;<div class="im">
<br>
wrote:<br>
<br>
    Dear mailing list members,<br>
<br>
<br>
    How can I use a vtkGraph as a boostGraph which is needed for<br>
    OpenGraphFixedTracking from D. Doria<br></div>
    (<a href="http://www.midasjournal.org/__browse/publication/828" target="_blank">http://www.midasjournal.org/_<u></u>_browse/publication/828</a><br>
    &lt;<a href="http://www.midasjournal.org/browse/publication/828" target="_blank">http://www.midasjournal.org/<u></u>browse/publication/828</a>&gt;)?<div class="im"><br>
    I looked at vtkBoostBreadthFirstSearch.cxx and included<br>
    vtkBoostGraphAdapter.h (see below) and copied it to the project dir (seems<br>
    this header-file is not installed with VTK, why?) but I still get an error:<br>
<br>
    error: invalid user-defined conversion from ‘vtkGraph*’ to ‘const Graph&amp;<br></div>
    {aka const boost::adjacency_list&lt;boost::_<u></u>_vecS, boost::vecS,<div class="im"><br>
    boost::undirectedS, boost::no_property, EdgeVisibility&gt;&amp;}’ [-fpermissive]<br>
<br>
    What am I missing?<br>
<br>
    Any help or hints are very much appreciated<br>
    Roman<br>
<br></div>
    ______________________________<u></u>__________<div class="im"><br>
<br>
<br>
    #include &quot;vtkBoostGraphAdapter.h&quot;<br>
<br>
    #include &lt;vtkXMLPolyDataReader.h&gt;//for vtp-files (cannot contain 3D cells?)<br>
    #include &lt;vtkPolyDataToGraph.h&gt;<br>
<br>
    #include &lt;vtkGraphToPolyData.h&gt;<br>
    #include &lt;vtkXMLPolyDataWriter.h&gt;//for vtp-files<br>
<br>
    ...<br>
<br>
       // Read the graph<br>
       //Graph graph = ReadGraph(inputFileName);<br>
<br></div>
       vtkSmartPointer&lt;__<u></u>vtkXMLPolyDataReader&gt; reader =<br>
    vtkSmartPointer&lt;__<u></u>vtkXMLPolyDataReader&gt;::New();<br>
<br>
       //reader-&gt;SetFileName(__<u></u>inputFileName);<div class="im"><br>
       reader-&gt;SetFileName(argv[1]);<br>
       reader-&gt;Update();<br>
<br></div>
       vtkSmartPointer&lt;__<u></u>vtkPolyDataToGraph&gt; polyDataToGraphFilter=<br>
    vtkSmartPointer&lt;__<u></u>vtkPolyDataToGraph&gt;::New();<br>
       polyDataToGraphFilter-&gt;__<u></u>SetInputConnection(reader-&gt;__<u></u>GetOutputPort());<br>
       polyDataToGraphFilter-&gt;Update(<u></u>__);<br>
<br>
       vtkGraph* graph= polyDataToGraphFilter-&gt;__<u></u>GetOutput();<br>
<br>
       //vtkBoostUndirectedGraph g(graph);<br>
<br>
       //vtkUndirectedGraph *g = vtkUndirectedGraph::__<u></u>SafeDownCast(graph);<div class="im"><br>
       //Graph openedGraph = OpenGraphFixedTracking(g, numberOfIterations);<br>
       //Graph openedGraph =<br></div>
    OpenGraphFixedTracking(boost::<u></u>__graph_traits&lt;graph&gt;, numberOfIterations);<div class="im"><br>
       Graph openedGraph = OpenGraphFixedTracking(graph, numberOfIterations);<br>
       //WriteGraph(openedGraph, outputFileName);<br>
<br></div>
       vtkSmartPointer&lt;__<u></u>vtkGraphToPolyData&gt; graphToPolyData=<br>
    vtkSmartPointer&lt;__<u></u>vtkGraphToPolyData&gt;::New();<br>
       graphToPolyData-&gt;SetInput(__<u></u>openedGraph);<br>
       graphToPolyData-&gt;Update();<br>
<br>
       vtkSmartPointer&lt;__<u></u>vtkXMLPolyDataWriter&gt; writer=<br>
    vtkSmartPointer&lt;__<u></u>vtkXMLPolyDataWriter&gt;::New();<br>
       //writer-&gt;SetFileName(__<u></u>outputFileName);<br>
       writer-&gt;SetFileName(argv[2]);<br>
       writer-&gt;SetInputConnection(__<u></u>graphToPolyData-&gt;__<u></u>GetOutputPort());<div class="im"><br>
       writer-&gt;Write();<br>
<br>
<br>
    --<br>
    Dr. Roman Grothausmann<br>
<br>
    Tomographie und Digitale Bildverarbeitung<br>
    Tomography and Digital Image Analysis<br>
<br>
    Institut für Funktionelle und Angewandte Anatomie, OE 4120<br>
    Medizinische Hochschule Hannover<br>
    Carl-Neuberg-Str. 1<br>
    D-30625 Hannover<br>
<br></div>
    Tel. <a href="tel:%2B49%20511%20532-9574" value="+495115329574" target="_blank">+49 511 532-9574</a> &lt;tel:%2B49%20511%20532-9574&gt;<br>
<br>
    ______________________________<u></u>_________________<br>
    Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> &lt;<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>&gt;<div class="im"><br>
<br>
    Visit other Kitware open-source projects at<br>
    <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
    Please keep messages on-topic and check the VTK FAQ at:<br>
    <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_<u></u>FAQ</a><br>
<br>
    Follow this link to subscribe/unsubscribe:<br>
    <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/<u></u>listinfo/vtkusers</a><br>
<br>
<br>
</div></blockquote><div class="HOEnZb"><div class="h5">
<br>
-- <br>
Dr. Roman Grothausmann<br>
<br>
Tomographie und Digitale Bildverarbeitung<br>
Tomography and Digital Image Analysis<br>
<br>
Institut für Funktionelle und Angewandte Anatomie, OE 4120<br>
Medizinische Hochschule Hannover<br>
Carl-Neuberg-Str. 1<br>
D-30625 Hannover<br>
<br>
Tel. <a href="tel:%2B49%20511%20532-9574" value="+495115329574" target="_blank">+49 511 532-9574</a><br>
</div></div></blockquote></div><br></div>