data structure design question

Thomas Hamelryck thamelry at
Thu Feb 17 03:45:10 EST 2000

Felix Thibault <felixt at> wrote:
: I'm looking at kjbuckets now, but I have a question about the graphs-
: the documentation says:

: 	[Graphs] relate Python hashable objects to other objects,
: 	 with no significance to order or redundancies on the 
: 	pairings. Technically, kjGraph defines a directed graph 
: 	abstract data type...

: Does this mean that I can use a graph to show which atoms are connected,
: but I need to find some other way to show whether a bond
: is a single or multiple bond...or else have nucleus-nodes inter-connected
: by electron=pair-nodes ?

Yes. You can store the connectivity in a graph, but you need to find another way to store 
the information about the bonds. Everything depends of course on what you are trying
to do. A data structure that will be used to draw simple chemical structures will of 
course be different from one that will be used to refine a protein structure. 

One possible solution is to attach an atom type to each atom. You can then do a look 
up in a dictionary to find the information associated with a bond between two atoms
of a certain type. This is e.g. done in the macromolecular modeling program X-PLOR.
You might want to take a look at MMTK, a molecular modeling package written in Python
by Konrad Hinsen (

BTW, If you want to do heavy numerical stuff like matrix multiplication and vector
operations  you must check out the numerical extension NumPy 


Thomas Hamelryck    Institute of Molecular and Structural Biology
Aarhus University   Gustav Wieds Vej 10C
DK-8000 Aarhus C    Denmark

More information about the Python-list mailing list