about dictionary

Bengt Richter bokr at oz.net
Sun Nov 20 23:31:00 EST 2005


On Sun, 20 Nov 2005 07:12:08 -0800, Shi Mu <samrobertsmith at gmail.com> wrote:

>d is a dictionary.
>>>> d
>{0: [[0, 1], [0, 2]], 1: [[0, 1], [1, 2], [1, 3]], 2: [[0, 2], [1, 2],
>[2, 3]], 3: [[1, 3], [2, 3]]}
>
>for the value under each key, if the possible connection is in the
>dictionary, for example, under key 0. 1 and 2 were found to have a
>pair in some other places so get [0,1,2]
>hence, how to design a dictionary,
>let dicTry=3D
>{0: [[0, 1,2], 2: [[0, 1, 2], [1, 2,3]], 2: [[0, 1,2], [1, 2,3], 3: [1,2,3]=
>}
>Thanks a lot!
Sounds like some graph application? Maybe you can find something useful
in a link from
    http://wiki.python.org/moin/PythonGraphApi

(which I found by googling for "vertex graph site:python.org" (without the quotes) ;-)

Regards,
Bengt Richter



More information about the Python-list mailing list