title: Oracle / reciprocal path
body: <p>I have a query that get the path between two points:</p>
  
  <pre><code>with nodes (node) as (
      select 'A' from dual union all
      select 'B' from dual union all
      select 'C' from dual union all
      select 'D' from dual
  ),
  connected_nodes (node_1,node_2 ) as
  (
      select 'A','B' from dual union all
      select 'B','C' from dual union all
      select 'B','D' from dual union all
      select 'A','C' from dual union all
      select 'A','D' from dual union all
      select 'D','C' from dual union all
      select 'C','D' from dual
  )
  select ltrim(sys_connect_by_path(node_1, '-&gt;'), '-&gt;') as path,
         level -1 as hops
  from
      (
      select node as node_1, node_2
      from nodes
             left join connected_nodes
               on(node = node_1)
      )         
  where node_1 = 'C'               
  connect by nocycle prior node_2 = node_1
                 and prior node_1 is not null
  start with node_1 = 'A'         
  </code></pre>
  
  <p>it works just fine so if I need to get the path from A to C, it gives :</p>
  
  <pre><code>PATH             HOPS
  ---------- ----------
  A-&gt;B-&gt;C             2
  A-&gt;B-&gt;D-&gt;C          3
  A-&gt;C                1
  A-&gt;D-&gt;C             2
  </code></pre>
  
  <p>what I need is that to have the path reciprocal , meaning getting from A to C is the same as getting from C to A , but it's not the case in the above query , as if I request the path from C to A it doesn't return data.</p>
  
  <p>can you please help me adjust the query to fulfill my needs ?</p>