<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<title>Re: [vtk-developers] vtkMutableTree?</title>
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:Consolas;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:Consolas;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Well I was being shy… but since Ken chimed in… I
send out what I had in my drafts folder… reflecting some of the same
observations that Ken made…<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoPlainText>Making vtkTree mutable is a darned if you do darned if
you don't proposition....<o:p></o:p></p>

<p class=MsoPlainText><o:p> </o:p></p>

<p class=MsoPlainText>1) Make the 'treeness' of the class enforced at all
times, so every insert or delete revalidates the structure as a valid tree. <o:p></o:p></p>

<p class=MsoPlainText>      Pros: You know you always have a valid tree  <o:p></o:p></p>

<p class=MsoPlainText>      Cons: insertion and deletion become more expensive
or not possible at all*<o:p></o:p></p>

<p class=MsoPlainText><o:p> </o:p></p>

<p class=MsoPlainText>* If I hit a flat file or a database I may get edges in
arbitrary order, so I would have to store all the edges in an auxiliary data
structure and then carefully traverse and construct the tree (this use case
happens a lot for us).<o:p></o:p></p>

<p class=MsoPlainText><o:p> </o:p></p>

<p class=MsoPlainText><o:p> </o:p></p>

<p class=MsoPlainText>2) Don't enforce validation, have a function like
CheckValidTree() that you call after construction/modification. <o:p></o:p></p>

<p class=MsoPlainText>      Pros: you get a mutable tree  <o:p></o:p></p>

<p class=MsoPlainText>      Cons: Can the toolkit enforce this to be called?
When? How? What if a filter upstream is still naughty? What if this check fails
and the filter doesn't gracefully handle that failure? Defensive programming
necessitates that everyone call this on the tree before beginning processing of
the tree (expensive).<o:p></o:p></p>

<p class=MsoPlainText><o:p> </o:p></p>

<p class=MsoPlainText>But going off the suggestion (which I think) was to have both
vtkTree (non-mutable) and vtkMutableTree (that looks a lot like
vtkMutableDirectedGraph but allows shallow copies back and forth from a
vtkTree)… I’m going to have to think about whether this makes sense…
perhaps after a peanut butter and cheetos sandwich it will become clear…<o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<div>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas;
color:#1F497D'>  Brian Wylie - Org 1424<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas;
color:#1F497D'>  Sandia National Laboratories<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas;
color:#1F497D'>  MS 1323 - Building CSRI/242<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas;
color:#1F497D'>  (505)844-2238 FAX(505)284-2518   <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas;
color:#1F497D'>       _______ __<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas;
color:#1F497D'>      /_  __(_) /_____ _____<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas;
color:#1F497D'>       / / / / __/ __ `/ __ \<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas;
color:#1F497D'>      / / / / /_/ /_/ / / / /<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas;
color:#1F497D'>     /_/ /_/\__/\__,_/_/ /_/<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas;
color:#1F497D'>            Informatics Toolkit<o:p></o:p></span></p>

</div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
vtk-developers-bounces@vtk.org [mailto:vtk-developers-bounces@vtk.org] <b>On
Behalf Of </b>Moreland, Kenneth<br>
<b>Sent:</b> Tuesday, March 30, 2010 1:28 PM<br>
<b>To:</b> Nasztanovics Ferenc; VTK Developers; David Doria<br>
<b>Subject:</b> Re: [vtk-developers] vtkMutableTree?<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif"'>I am perhaps not the best person to speak
to this, but I can assure you that the graph storage objects were not created
without a great deal of deliberation and revision.  At one point in an
early version of Titan we did have a mutable tree.  That turned out to be
very difficult to work with because unless you happened to be building the tree
in a very specific way, you would end up with intermediate structures that
technically were not trees, which the class did not allow.  That meant
that most filters that created a tree would have to build their own auxiliary
structures and then copy the final version into the VTK tree structure.
 This is why to create a tree you now have to first build it in a mutable
graph and then copy it into a tree structure, at which time the tree will be
validated.<br>
<br>
I think the real problem is that you have to manually copy the vtkTree.
 Does it not work to call DeepCopy on vtkMutableDirectedGraph with the vtkTree?
 If not, then that is probably a bug that you should submit a bug report
for.<br>
<br>
-Ken<br>
<br>
<br>
On 3/30/10 8:58 AM, "Nasztanovics Ferenc" <<a
href="naszta@naszta.hu">naszta@naszta.hu</a>> wrote:</span><o:p></o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif"'>I think it would be nice. :)<br>
<br>
Thanks,<br>
<br>
Naszta<br>
________________________________________<br>
Feladó: <a href="vtk-developers-bounces@vtk.org">vtk-developers-bounces@vtk.org</a>
[<a href="vtk-developers-bounces@vtk.org">vtk-developers-bounces@vtk.org</a>],
meghatalmaz&#243;: David Doria [<a href="daviddoria+vtk@gmail.com">daviddoria+vtk@gmail.com</a>]<br>
Küldve: 2010. március 30. 23:50<br>
Címzett: VTK Developers<br>
Tárgy: [vtk-developers] vtkMutableTree?<br>
<br>
Is there a reason you can't add to a vtkTree? I always have to convert<br>
a vtkTree manually (copy every vertex and edge) to a<br>
vtkMutableDirectedGraph, make my changes, then convert back with<br>
CheckedShallowCopy. Could we create a vtkMutableTree?<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>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<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>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br>
</span><o:p></o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif"'><br>
</span><span style='font-size:10.0pt;font-family:Consolas'><br>
   ****      Kenneth Moreland<br>
    ***      Sandia National
Laboratories<br>
***********  <br>
*** *** ***  email: <a href="kmorel@sandia.gov">kmorel@sandia.gov</a><br>
**  ***  **  phone: (505) 844-8919<br>
    ***      web:   <a
href="http://www.cs.unm.edu/~kmorel">http://www.cs.unm.edu/~kmorel</a></span><o:p></o:p></p>

</div>

</body>

</html>