Tracing relationships between items in a dictionary : <p>I have a dictionary that defines a set of relationships, for example:</p>

<pre><code>relationships = {"Fred": ["Mary, John"],
                 "Mary": ["Fred", "Alex"],
                 "John": ["Fred"]
                 "Alex": ["Mary"]}
</code></pre>

<p>I'd like to build some functionality that, given a name I return a list of all the relationships associated with that name. </p>

<p>A direct relationship is signaled by a Key: Value pair (so Mary is directly related to Fred) and a second level relationship is signaled through a "friend of a friend" type relationship. So Alex and Fred have a relationship through Mary. Alex --> Mary --> Fred.</p>

<p>For example:
Input: Fred, 
Output: Mary, John, Alex</p>

<p>Input: Alex, 
Output: Mary, Fred, John</p>

<p>I'm using this example to try an learn recursion, so I have a recursion solution in mind, but am not sure if this can be done iteratively or how to build the proper recursion to solve this.</p>
