On Thu, 24 May 2012, Bruce wrote:
> On Mon, 2012-05-21 at 22:25 +0200, Benoît Minisini wrote:
> 
> > * Tree
> > * Graph
> > 
> > Native implementation of that would be interesting.
> > 
> > Any volunteer? :-)
> > 
> I think trees are easily implemented directly in gambas using Emil's
> suggestions regarding object references as a general n-tree can be
> implemented as a B-tree using something like
>  
>     Class CNode
>         public data as Variant
>         public left as CNode
>         public right as CNode
>     Public Sub PreOrder() as Variant[]
>         blah blah ... etc  according to Mr Knuth
>     End
> 
> where "left" is the first child and "right" is the first sibling.  Read
> Knuth Vol 3 for the truth (I had to go searching through the attic to
> find my copy.)
> 
>         Now Graphs are   M U C H   more interesting!  
>         
>         Someone said that they couldn't think of a use for them.  Well
>         here's one, UML diagrams are all directed graphs. In fact much
>         of OO thinking is actually (mathematically) directed graphs.
>         Nodes and edges. From use cases through structural models,
>         component models, in fact the whole she-bang.
> 
> 
> Getting back to trees. The funny thing is that I had a real need to
> construct a n-tree this week to solve a problem I had with populating a
> gambas treeview from a persistence store where the nodes where out of
> order, i.e. the parents were later in the storage than the children (the
> code is a hack and I choose not to share it.)  Suffice to say that
> Demosthenes original post prompted me to go searching through the attic.
> 
> .. found some interesting stuff, by the way .. (No, lets not go there.)
> 
> Getting back to the point, I think a gb.datastructures component is an
> excellent idea.  I can't help much on the dev side as I'm pretty poor at
> C/C++ (can "read only") and am totally lost with Benoit's macros but I'd
> be willing to put in much effort at testing and proving. Ah! Linked
> lists, how many times have I needed them and built them from scratch.
> 
> Bruce
> 
> 
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

Hi,

so what syntax did you desire for an n-tree then? You presented a b-tree above, 
this appears generic
to me... I certainly lack theory on those things.

But shouldn't it be less annoying to get to level 3 than "Root.left.left.left" ?
There are a lot of purposes and designs of trees (graphs), right? To implement 
a certain idea would
not be too difficult but instead to implement only one of those as a generic 
tree (graph) which is
then able to be inherited and specialised, maybe in gambas, - that's what I 
find difficult (no
wonder without theory).

Regards,
Tobi

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to