Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Well, it depends. :^)

If this is an HTML-related question, then I've always preferred to use a LoL along the following lines:

  • my @submenu = ('div', 'img', 'alt');
  • my @menu = (
    • ('div', 'img', 'alt', \@submenu)
  • );

This does away with the sorting issue and gives you a fairly obvious way to change parameters in a menu so that if you need a special icon or want to manipulate the menu while writing an HTML file, you can.

Of course, this doesn't have any obvious mechanism for drawing your nodes correctly (this straight scenario works best for DHTML menus where elements aren't supposed to cause a reflow.

For displaying a tree more properly I've found JavaScript objects to be pretty handy (unless you want to write for NN3 or IE3 and early IE4) -- you create a Tree object and Node object and then assign your nodes to the tree in any order using some kind of simple path system. Each node 'knows' how deep it is in the tree (since it can query its parent node) and can draw itself appropriately (again, by querying its parents as necessary).

I don't know if this exactly answers your question since it's unclear (to me at least) what your output format is, and I do like some aspects of your system a lot (the matrix transformations seem quite quick and simple), while having doubts about others (the numbering scheme is unduly difficult for a human to read).

HTH


In reply to Re: representing a tree graphically... by jreades
in thread representing a tree graphically... by cLive ;-)

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-24 07:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found