title: how to check if there exists a unique shortest path between two vertices in igraph
body: <p>I'd like to identify if there exist a unique shortest path or multiple shortest paths between two vertices with igraph. If I use <code>length(all_shortest_paths(g, i,j)</code>, that actually helps me, but I feel like there are so many redundant operations. I rather prefer first to get one shortest path with <code>get.shortest.paths(g, i,j)</code>, and then see if there is another. However, I could not figure out how to do this. </p>
  
  <p>Can someone help me how to identify whether there is another shortest path different than the first one obtained by <code>get.shortest.paths(g, i,j)</code>?</p>
  
  <p>Here is an example graph</p>
  
  <pre><code>library(igraph)
  data &lt;- read.table(text="
  1 2
  1 4
  1 5
  2 3
  2 4
  3 4
  5 7
  5 8
  3 6", header=FALSE)
  gmatrix &lt;- data.matrix(data, rownames.force = NA) #convert into a matrix to use in igraph
  g &lt;- graph_from_edgelist(gmatrix, directed = FALSE) 
  </code></pre>
  
  <p>For instance, if I'd like to find the shortest path from 1 to 3, I use <code>all_shortest_paths(g, 1,3)</code>, and it gives me the following result.</p>
  
  <pre><code>$res
  $res[[1]]
  + 3/9 vertices, from 634c426:
  [1] 1 4 3
  
  $res[[2]]
  + 3/9 vertices, from 634c426:
  [1] 1 2 3
  
  </code></pre>
  
  <p>What I want is to get the first shortest path. For instance </p>
  
  <pre><code>get.shortest.paths(g, 1,3)
  $vpath
  $vpath[[1]]
  + 3/9 vertices, from 634c426:
  [1] 1 2 3
  </code></pre>
  
  <p>Now, I want to see if there is any other path different than <code>[1] 1 2 3</code>. In a larger graph, since there are tens of possible shortest paths, I don't want to use <code>all_shortest_paths(g, i,j)</code> to make that query.</p>
  
  <p>Overall, my question is: how can I check whether there exists a  unique shortest path between two vertices or not? I will give two vertices as my input, in return I should get TRUE or FALSE indicating if there is a unique shortest path.</p>