title: igraph --- find shortest path including weight at turns
body: <p>The following example gives shortest path 1-2-6-7-3-4, where only the weight of edges is considered; and the weight of turn at vertices is not counted for. Can someone suggest a procedure to include the weight at each vertex that is no-turn, right-turn, or left-turn?  We can assume the weight for (NT, RT, LT)=(0,0.5,1). When edge weight is combined with turn effect, the shortest path would become 1-2-3-4. Below is the example in question.  Thank you.</p>
  
  #
  
  <pre><code>library(igraph)
  n &lt;- c(1,2,3,4,5,6,7,8)
  x &lt;- c(1,4,7,10,1,4,7,10)
  y &lt;- c(1,1,1,1,4,4,4,4)
  node &lt;- data.frame(n,x,y)
  fm &lt;- c(1,2,3,5,6,7,1,2,3,4)
  to&lt;-c(2,3,4,6,7,8,5,6,7,8)
  weight&lt;- c(1,4,1,1,1,2,5,1,1,1)
  link &lt;- data.frame(fm,to,weight)
  g &lt;- graph.data.frame(link,directed=FALSE,vertices=node)
  sv &lt;- get.shortest.paths(g,1,4,weights=NULL,output="vpath")
  sv
  E(g)$color &lt;- "pink"
  E(g, path=sv[[1]])$width &lt;- 8
  plot(g,edge.color="red") 
  plot(g,edge.label=weight,edge.label.color="blue",edge.label.cex=2)
  </code></pre>