Data-structure for multiway associativity in Python

qrious mittra at juno.com
Sat Jan 27 13:01:47 EST 2018



I need a data structure and a corresponding (hopefully fast) mechanism associated with it to do the following. While I am looking for the concept first, my preference for implementation of this will be in Python.

[c1, c2,..., cn] is a list of strings (for my own implementation, but could be any other type for the generic problem). There will be many hundreds, if not thousands, of such lists with no shared member.

The method getAssocList(e) will return lists of the lists for which e is an element.

Here a hash may be a way to go, but need help in figuring it out. Also, can there be a faster and more memory efficient solution other than hashes?



More information about the Python-list mailing list