<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>I'm looking for advice (and also good overviews) on tree and trie implementations in <br>Python. I already did some reading and it's a tower of Babel out there (<a href="http://stackoverflow.com/questions/2442014/tree-libraries-in-python?rq=1">StackOverflow</a> , pypi, macports etc.); I can't find any good overviews. Apparently figuring out which package to use causes severe grief, especially to people from other languages where these exist in stdlib.<br><br>In my current use case I need an n-ary tree or trie to store 32,000 UK regions and placenames.<br>Max depth is 6. The keys are strings, possibly multiword. The values should be arbitrary objects. Must run on a Mac.<br><br>Requirements:<br><br>- doesn't need to be fancy. Only needs to support insert, and lookup by name,<br>  and also hierarchical lookup by name, e.g. there is a location UK->North East England->Tyne & Wear->Newcastle Upon Tyne, hence we should be able to lookup 'Newcastle Upon Tyne'<br>  at any node from the root downwards. There may be multiple hits.<br><br>- not esssential, but ideally it can understand names can have synonyms/aliases,<br>  e.g. UK->SW England is an alias to UK->South West England or UK->Cymru to UK->Wales<br>  (however if we walk the tree, only the set of unique canonical names should get returned)<br>  (Fail that, I can manually merge nodes.)<br><br>- efficiency (memory or CPU) is not a concern in this application, but I'd like to know<br>  which packages are efficient so I use a decent one.<br><br>- later on I may want to import geolocations and postcodes, then figure out which regions are close, query-by-proximity. But that's a nice-to-have.<br><br>Does any package spring to mind?<br><br>Thanks for all suggestions,<br>Stephen<br>                                        </div></body>
</html>