Extract chain sequences with python
<p>I have a dictionary in Python, that describes some kinds of binaries running on various hosts. Some of them are connected each to other. The question is - how can I construct chains from them? If input and output are the same, then binaries are connected.
For example:</p>

<pre><code>{"binary1": "bin1", "input": "127.0.0.1:2222", "output": "127.0.0.2:3333", "other_stuff": "....1111..."}
{"binary2": "bin2", "input": "127.0.0.2:3333", "output": "", "other_stuff": "....2222..."}
{"binary3": "bin3", "input": "128.0.0.1:5555", "output": "127.0.0.2:7777", "other_stuff": "....3333..."}
{"binary4": "bin4", "input": "127.0.0.2:8888", "output": "127.0.0.2:4444", "other_stuff": "....4444..."}
{"binary5": "bin5", "input": "127.0.0.1:9999", "output": "127.0.0.2:8888", "other_stuff": "....5555..."}
{"binary6": "bin6", "input": "127.0.0.5:1111", "output": "127.0.0.9:1234", "other_stuff": "....6666..."}
{"binary7": "bin7", "input": "", "output": "127.0.0.1:9999", "other_stuff": "....7777..."}
{"binary8": "bin8", "input": "127.0.0.1:2222", "output": "127.0.0.2:3333", "other_stuff": "....8888..."}
{"binary9": "bin9", "input": "", "output": "127.0.0.5:1111", "other_stuff": "....9999..."}
{"binary0": "bin0", "input": "", "output": "", "other_stuff": "....0000..."}
</code></pre>

<p>expected output:</p>

<pre><code>bin1 -&gt; bin2
bin7 -&gt; bin5 -&gt; bin4
bin9 -&gt; bin6
</code></pre>

<p>Inputs and outputs are not necessary for each binary.<br>
Finally I will need to make list of chains and to draw them, but it's a bonus :) Does exist some python module that will help to extract sequences and do it fast enough? (Data size is about 10 thousands of binaries).<br>
Thanks in advance!<br>
P.S. Actually I need links to python modules that will help me to solve it (not algorithm), that's all</p>
