Category tree of some sort ...

Anton Vredegoor anton at vredegoor.doge.nl
Sat Dec 7 16:01:02 EST 2002


On Sat, 7 Dec 2002 00:58:26 +0100, "Thomas Weholt" <2002 at weholt.org>
wrote:

>I need to put this into a tree-structure, a dictionary like this :
>
>category_tree = {
>    'computers': ([], {
>        'programming': ([], {
>            'python': ( [], {}),
>            'c': ( [], {}),
>        },
>    'technical': ([], {
>        'os': ([], {}),
>        }
>    }
>
>Each level holds a list of ids, pointing to resources on a local disk, the
>dict-part of each tuple is the base for a another, deeper level in the
>tree-structure.

It's possible to exactly identify a tree using a "flat" list and an
index number. The index number can be thought of as describing the
"sublist structure" that the flat list should have so that it would
represent the tree. Here's an example script:

http://home.hccnet.nl/a.vredegoor/prufer

See also Cayley's theorem and Prufer correspondence.

Regards,
		Anton.

--

1. T(u + v) = T(u) + T(v)

but not

2. T(kv) = kT(v) for all real k.




More information about the Python-list mailing list