And this is not a distributed graph?<br><br><div class="gmail_quote">On Thu, May 13, 2010 at 2:16 PM, Caleb Johnston <span dir="ltr">&lt;<a href="mailto:cjj37@cornell.edu">cjj37@cornell.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I&#39;m getting a segfault when calling vtkMutableUndirectedGraph::AddVertex. However, it does not always occur at the same vertex. Sometimes it is after the 2nd vertex. Sometimes it won&#39;t happen at all (though rarely). I&#39;m only adding about 120 vertices. And the program is not consuming large amounts of data so I don&#39;t understand why this is happening. Also, this only happens in Linux and Windows but not MacOS X. Below, I have included my algorithm for adding vertices.<div>


<div><br></div><div>thanks,</div><div>Caleb</div><div><br></div><div>...</div><div><div>int len = 0;</div><div>double X,Y,Z,Count;</div><div>for(i=0, j=0; j&lt;numberOfLabels; i+=3, j++){</div><div>   X = (double)coords[i];</div>


<div>   Y = (double)coords[i+1];</div><div>   Z = (double)coords[i+2];</div><div>   Count = (double)centroids[j];</div><div>   if(Count&gt;0.0){</div><div>      X = X / Count;</div><div>      Y = Y / Count;</div><div>      Z = Z / Count;</div>


<div>      len++;</div><div>      graph-&gt;AddVertex();  // crashes here.</div><div>      graph-&gt;Update();</div><div>      points-&gt;InsertNextPoint(X, Y, Z);</div><div>   }</div><div>}</div><div>...</div></div></div>


<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">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" target="_blank">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" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>| Aashish Chaudhary <br>| R&amp;D Engineer         <br>| Kitware Inc.            <br>| <a href="http://www.kitware.com">www.kitware.com</a>    <br>