Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Tree data structure with: single, double and triple children optionalong with AVM data at each node

Reply
Thread Tools

Tree data structure with: single, double and triple children optionalong with AVM data at each node

 
 
nirman longjam
Guest
Posts: n/a
 
      11-24-2011
Dear sir,

I am very happy to find this group.

Sir, i am new to Python. Currently i am working on text processing.
Can you give me some suggestions about Tree data structure
representation, where i require each node capable to handle: only one
child, or up to 3 children plus hold feature information.


Thanking you,
L. Nirman Singh

 
Reply With Quote
 
 
 
 
Miki Tebeka
Guest
Posts: n/a
 
      11-24-2011
There a many ways to do this, here's one:

from collections import namedtuple
Tree = namedtuple('Tree', ['feature', 'children'])
t = Tree(1, [Tree('hello', []), Tree(3, [])])
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
find path from one tree node to another tree node Peter Mueller Java 6 01-13-2008 02:36 AM
How to use TreeView, Node, Children to create a tree =?gb2312?B?xMi/ycK2wrY=?= Java 9 05-28-2007 06:23 AM
How to set the node indent property between the parent node and the leaf node viveknatani@gmail.com ASP .Net 0 02-13-2006 07:11 PM
pydoc preference for triple double over triple single quotes -- anyreason? Brian van den Broek Python 7 04-19-2005 03:39 AM
cannot convert parameter from 'double (double)' to 'double (__cdecl *)(double)' error Sydex C++ 12 02-17-2005 06:30 PM



Advertisments