<HTML>
<HEAD>
<TITLE>Re: [vtkusers] UnstructuredGrid to Graph</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hi David,<BR>
<BR>
It looks to me like the loop where you iterate over points and GetConnectedVertices() is where it&#8217;s most expensive. You can replace that behavior with the vtkUnstructuredGrid::GetCells().<BR>
<BR>
Iterating over that vtkCellArray and iterating over the pts returned from GetCell() may be faster. &nbsp;You&#8217;ll need to build a switch around cell type to understand what that connectivity is, but I think after removing GetConnectedVertices(), the code size won&#8217;t change too much...<BR>
<BR>
HTH,<BR>
Nathan.<BR>
<BR>
On 5/21/10 7:35 AM, &quot;David Doria&quot; &lt;<a href="daviddoria+vtk@gmail.com">daviddoria+vtk@gmail.com</a>&gt; wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>I am trying to convert all of the edges in an vtkUnstructuredGrid to a vtkGraph.<BR>
<BR>
Here is what I have come up with:<BR>
<a href="http://www.rpi.edu/~doriad/VTK_List/UnstructuredGridToGraph/">http://www.rpi.edu/~doriad/VTK_List/UnstructuredGridToGraph/</a><BR>
<BR>
It seems to be horribly slow. Can anyone recommend a faster way to do this?<BR>
<BR>
Thanks,<BR>
<BR>
David<BR>
_______________________________________________<BR>
Powered by www.kitware.com<BR>
<BR>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><BR>
<BR>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><BR>
<BR>
Follow this link to subscribe/unsubscribe:<BR>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><BR>
<BR>
<BR>
</SPAN></FONT></BLOCKQUOTE>
</BODY>
</HTML>