It is not a distributed graph. I have run the program numerous times in the debugger and the problem definitely arrises from the AddVertex call.<div><br></div><div><div>My code is called at line 10, the AddVertex is at line 9.</div>
<div><br></div><div><div>0 ?? /lib/tls/i686/cmov/libc.so.6 0 0x0356ca22</div><div>1 malloc /lib/tls/i686/cmov/libc.so.6 0 0x0356e898</div><div>2 operator new(unsigned int) /usr/lib/libstdc++.so.6 0 0x034a9bb7</div>
<div>3 __gnu_cxx::new_allocator<vtkVertexAdjacencyList>::allocate(unsigned int, void const*) /usr/local/lib/vtk-5.4/libvtkFiltering.so.5.4 0 0x02f6a4b6</div><div>4 std::_Vector_base<vtkVertexAdjacencyList, std::allocator<vtkVertexAdjacencyList> >::_M_allocate(unsigned int) /usr/local/lib/vtk-5.4/libvtkFiltering.so.5.4 0 0x02f691f2</div>
<div>5 std::vector<vtkVertexAdjacencyList, std::allocator<vtkVertexAdjacencyList> >::_M_insert_aux(__gnu_cxx::__normal_iterator<vtkVertexAdjacencyList*, std::vector<vtkVertexAdjacencyList, std::allocator<vtkVertexAdjacencyList> > >, vtkVertexAdjacencyList const&) /usr/local/lib/vtk-5.4/libvtkFiltering.so.5.4 0 0x02f67341</div>
<div>6 std::vector<vtkVertexAdjacencyList, std::allocator<vtkVertexAdjacencyList> >::push_back(vtkVertexAdjacencyList const&) /usr/local/lib/vtk-5.4/libvtkFiltering.so.5.4 0 0x02f65e5d</div>
<div>7 vtkGraph::AddVertexInternal(vtkVariantArray*, int*) /usr/local/lib/vtk-5.4/libvtkFiltering.so.5.4 0 0x02f63e3d</div><div>8 vtkMutableUndirectedGraph::AddVertex(vtkVariantArray*) /usr/local/lib/vtk-5.4/libvtkFiltering.so.5.4 0 0x02ff19a8</div>
<div>9 vtkMutableUndirectedGraph::AddVertex() /usr/local/lib/vtk-5.4/libvtkFiltering.so.5.4 0 0x02ff1946</div><div>10 Model::loadVolumeData model.cxx 318 0x0813ffb7</div>
<div>11 Application::openFile application.cxx 96 0x0813b3aa</div><div>12 Application::qt_metacall moc_application.cxx 91 0x0815f9b5</div><div>13 QMetaObject::metacall qmetaobject.cpp 237 0x00bf4adb</div>
<div>14 QMetaObject::activate qobject.cpp 3285 0x00c025a7</div><div>15 QAction::triggered moc_qaction.cpp 263 0x0108f409</div><div>16 QAction::activate qaction.cpp 1255 0x01090acf</div>
<div>17 QMenuPrivate::activateCausedStack qmenu.cpp 1011 0x01568314</div><div>18 QMenuPrivate::activateAction qmenu.cpp 1103 0x0156f373</div><div>19 QMenu::mouseReleaseEvent qmenu.cpp 2312 0x0157169f</div>
<div>20 QWidget::event qwidget.cpp 7998 0x010fa39a</div></div><br><div class="gmail_quote">On Thu, May 13, 2010 at 2:30 PM, Aashish Chaudhary <span dir="ltr"><<a href="mailto:aashish.chaudhary@kitware.com">aashish.chaudhary@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">And this is not a distributed graph?<br><br><div class="gmail_quote"><div class="im">On Thu, May 13, 2010 at 2:16 PM, Caleb Johnston <span dir="ltr"><<a href="mailto:cjj37@cornell.edu" target="_blank">cjj37@cornell.edu</a>></span> wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">
I'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't happen at all (though rarely). I'm only adding about 120 vertices. And the program is not consuming large amounts of data so I don'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<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>0.0){</div><div> X = X / Count;</div><div> Y = Y / Count;</div><div> Z = Z / Count;</div>
<div> len++;</div><div> graph->AddVertex(); // crashes here.</div><div> graph->Update();</div><div> points->InsertNextPoint(X, Y, Z);</div><div> }</div><div>}</div><div>...</div></div></div>
<br></div></div>_______________________________________________<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><font color="#888888"><br><br clear="all"><br>-- <br>| Aashish Chaudhary <br>| R&D Engineer <br>| Kitware Inc. <br>| <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> <br>
</font></blockquote></div><br></div>