generating a tree-like structure

Discussion in 'Python' started by Thorsten Kampe, May 31, 2007.

  1. Hi,

    This is a fairly general question: is there some kind of module or
    framework that allows building a tree like structure from certain kind
    of data?

    To be specific: I have a program that dumps the content of a LDAP
    directory including all properties and values and groups the result
    from the LDAP search by objClass.

    Now I was thinking: would it be possible to generate from the totally
    unordered output that the LDAP server gives me, a tree like
    representation that displays the hierarchy (omitting the values or
    even properties if necessary)?

    It should be a textual representation of what you see in GUI programs
    like "LDAP Administrator" but the output should be represented like
    the "tree" program in Linux or Windows "tree.com".

    Any ideas appreciated...


    Thorsten
    Thorsten Kampe, May 31, 2007
    #1
    1. Advertising

  2. Thorsten Kampe

    Guest

    On May 31, 12:44 pm, Thorsten Kampe <> wrote:
    > Hi,
    >
    > This is a fairly general question: is there some kind of module or
    > framework that allows building a tree like structure from certain kind
    > of data?
    >
    > To be specific: I have a program that dumps the content of a LDAP
    > directory including all properties and values and groups the result
    > from the LDAP search by objClass.
    >
    > Now I was thinking: would it be possible to generate from the totally
    > unordered output that the LDAP server gives me, a tree like
    > representation that displays the hierarchy (omitting the values or
    > even properties if necessary)?
    >
    > It should be a textual representation of what you see in GUI programs
    > like "LDAP Administrator" but the output should be represented like
    > the "tree" program in Linux or Windows "tree.com".
    >
    > Any ideas appreciated...
    >
    > Thorsten


    I think you might be able to use ElementTree. The website for the
    module claims it can be used for hierarchical data structures:
    http://effbot.org/zone/element-index.htm

    Did you look at any of the Python LDAP tools? They might be useful
    too. See some of the links below:
    http://linuxjournal.com/article/6988
    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303336

    Hopefully they'll give some guidance. I've not used LDAP myself as of
    yet.

    Mike
    , May 31, 2007
    #2
    1. Advertising

  3. * (31 May 2007 12:15:48 -0700)
    > On May 31, 12:44 pm, Thorsten Kampe <> wrote:
    > > This is a fairly general question: is there some kind of module or
    > > framework that allows building a tree like structure from certain kind
    > > of data?
    > >
    > > To be specific: I have a program that dumps the content of a LDAP
    > > directory including all properties and values and groups the result
    > > from the LDAP search by objClass.
    > >
    > > Now I was thinking: would it be possible to generate from the totally
    > > unordered output that the LDAP server gives me, a tree like
    > > representation that displays the hierarchy (omitting the values or
    > > even properties if necessary)?
    > >
    > > It should be a textual representation of what you see in GUI programs
    > > like "LDAP Administrator" but the output should be represented like
    > > the "tree" program in Linux or Windows "tree.com".

    >
    > I think you might be able to use ElementTree. The website for the
    > module claims it can be used for hierarchical data structures:
    > http://effbot.org/zone/element-index.htm
    >
    > Did you look at any of the Python LDAP tools? They might be useful
    > too. See some of the links below:
    > http://linuxjournal.com/article/6988
    > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303336
    >
    > Hopefully they'll give some guidance. I've not used LDAP myself as of
    > yet.


    I already have the LDAP output part working - with python-ldap under
    Cygwin - and I generate HMTL output with markup.py. Pretty simple. But
    a tree structure output would be even prettier...
    Thorsten Kampe, May 31, 2007
    #3
  4. Thorsten Kampe

    A.T.Hofkamp Guest

    On 2007-05-31, Thorsten Kampe <> wrote:
    > * (31 May 2007 12:15:48 -0700)
    >> On May 31, 12:44 pm, Thorsten Kampe <> wrote:
    >> > This is a fairly general question: is there some kind of module or
    >> > framework that allows building a tree like structure from certain kind
    >> > of data?
    >> >
    >> > To be specific: I have a program that dumps the content of a LDAP
    >> > directory including all properties and values and groups the result
    >> > from the LDAP search by objClass.
    >> >
    >> > Now I was thinking: would it be possible to generate from the totally
    >> > unordered output that the LDAP server gives me, a tree like
    >> > representation that displays the hierarchy (omitting the values or
    >> > even properties if necessary)?
    >> >
    >> > It should be a textual representation of what you see in GUI programs
    >> > like "LDAP Administrator" but the output should be represented like
    >> > the "tree" program in Linux or Windows "tree.com".

    >>
    >> I think you might be able to use ElementTree. The website for the
    >> module claims it can be used for hierarchical data structures:
    >> http://effbot.org/zone/element-index.htm
    >>
    >> Did you look at any of the Python LDAP tools? They might be useful
    >> too. See some of the links below:
    >> http://linuxjournal.com/article/6988
    >> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303336
    >>
    >> Hopefully they'll give some guidance. I've not used LDAP myself as of
    >> yet.

    >
    > I already have the LDAP output part working - with python-ldap under
    > Cygwin - and I generate HMTL output with markup.py. Pretty simple. But
    > a tree structure output would be even prettier...


    I would probably generate a DOT file to get a 2D visualization. DOT is part of
    Graphviz (graphviz.org), and there are quite a few graphviz front-ends
    available in Python to make DOT generation easier (pydot, yapgvb, and probably
    a few others).

    Albert
    A.T.Hofkamp, Jun 1, 2007
    #4
    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. Stub

    B tree, B+ tree and B* tree

    Stub, Nov 12, 2003, in forum: C Programming
    Replies:
    3
    Views:
    10,097
  2. sharan
    Replies:
    4
    Views:
    676
    CBFalconer
    Oct 30, 2007
  3. sharan
    Replies:
    2
    Views:
    822
    SM Ryan
    Oct 31, 2007
  4. sharan
    Replies:
    1
    Views:
    680
    CBFalconer
    Oct 30, 2007
  5. anne001
    Replies:
    1
    Views:
    229
Loading...

Share This Page