I\'m using python, and I have a dictionary which represents connections, something like this:
python
A B - 1 C - 1 B A - 0 C A - 1