title: C# QuikGraph Sort elements by Graph Hiarachie
body: <p>I am using a BidirectionalGraph from QuikGraph to build a directed graph. Here is an example of a graph:</p>
  <pre><code>     CityA
       /   \
    CityB   CityC
       \   /    \
       CityD   CityE
  </code></pre>
  <p>Now I get an unsorted list of cities. I now want to sort this list according to the hierarchy in the graph.</p>
  <p>Example:</p>
  <pre><code>SortCities([&quot;CityC&quot;, &quot;CityA&quot;, &quot;CityB&quot;, &quot;CityD&quot;]) // Returns &quot;CityA&quot;, &quot;CityB&quot;, &quot;CityC&quot;, &quot;CityD&quot;
  </code></pre>