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

Discussion in 'Python' started by nirman longjam, Nov 24, 2011.

  1. 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
    nirman longjam, Nov 24, 2011
    #1
    1. Advertising

  2. nirman longjam

    Miki Tebeka Guest

    Re: Tree data structure with: single, double and triple childrenoption along with AVM data at each node

    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, [])])
    Miki Tebeka, Nov 24, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,408
  2. Sydex
    Replies:
    12
    Views:
    6,453
    Victor Bazarov
    Feb 17, 2005
  3. Brian van den Broek
    Replies:
    7
    Views:
    746
    Brian van den Broek
    Apr 19, 2005
  4. =?gb2312?B?xMi/ycK2wrY=?=

    How to use TreeView, Node, Children to create a tree

    =?gb2312?B?xMi/ycK2wrY=?=, May 24, 2007, in forum: Java
    Replies:
    9
    Views:
    2,215
  5. Peter Mueller
    Replies:
    6
    Views:
    4,530
    Stefan Ram
    Jan 13, 2008
Loading...

Share This Page