title: Highlight all connected paths from start to end in Sankey graph using R
body: <p>I want to highlight the whole path when i click on the node to know the whole story of specific node and here's an example- <a href="http://bl.ocks.org/git-ashish/8959771" rel="noreferrer">http://bl.ocks.org/git-ashish/8959771</a> .</p>
  
  <p>Please check this link and you will find the function that highlight the path in javscript, but take care please , this function doesn't do what i want, it highlight links related to the clicked node and the links related to the target nodes. what i want is to highlight all links related to the clicked node.</p>
  
  <p><a href="https://stackoverflow.com/questions/19195888/d3-sankey-highlight-all-connected-paths-from-start-to-end">d3 Sankey - Highlight all connected paths from start to end</a></p>
  
  <p>Here's an example of what i need,
  <a href="https://i.stack.imgur.com/qM7gl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qM7gl.png" alt="enter image description here"></a>
  This is the whole graph,what i need is, when i click on Bangkok, it highlight all the nodes that in the same raw with Bangkok in the dataframe , like highlight the link to ClimateChange and EnergyShortage, .... then highlight Infrastructure&amp;Ecosystems, and Leadership&amp;strategy, and .... 
  That's what i want.
  Here's another picture showing the nodes that related to Bangkok using shiny to analyze it .</p>
  
  <p><a href="https://i.stack.imgur.com/OJxeX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OJxeX.png" alt="enter image description here"></a></p>
  
  <p>Here's what happens when i use highlight_node_links which in the bl.ocks and the linked question, and that's wrong, and doesn't show the relation between nodes and Bangkoks.
  <a href="https://i.stack.imgur.com/BzjD9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/BzjD9.png" alt="enter image description here"></a></p>
  
  <p>Here's the data for Bangkok to show you how the columns related to each other, and when you use this data, it gonna generate the second picture only. </p>
  
  <pre><code>structure(list(City = c("Bangkok", "Bangkok", "Bangkok", "Bangkok", 
  "Bangkok", "Bangkok", "Bangkok", "Bangkok", "Bangkok", "Bangkok", 
  "Bangkok", "Bangkok", "Bangkok", "Bangkok", "Bangkok", "Bangkok"
  ), ResiliencyChallenge = c("ClimateChange", "ClimateChange", 
  "ClimateChange", "ClimateChange", "ClimateChange", "InfrastructureFaliure", 
  "EnergyShortage", "Pollution", "Pollution", "Pollution", "TransportationSystemFailure", 
  "TransportationSystemFailure", "TransportationSystemFailure", 
  "TransportationSystemFailure", "TransportationSystemFailure", 
  "TransportationSystemFailure"), CRI.Dimesnsion.1 = c("Infrastructure &amp; Ecosystems", 
  "Infrastructure &amp; Ecosystems", "Infrastructure &amp; Ecosystems", 
  "Infrastructure &amp; Ecosystems", "Infrastructure &amp; Ecosystems", 
  "Infrastructure &amp; Ecosystems", "Infrastructure &amp; Ecosystems", 
  "Leadership &amp; Strategy", "Leadership &amp; Strategy", "Infrastructure &amp; Ecosystems", 
  "Infrastructure &amp; Ecosystems", "Infrastructure &amp; Ecosystems", 
  "Infrastructure &amp; Ecosystems", "Infrastructure &amp; Ecosystems", 
  "Infrastructure &amp; Ecosystems", "Leadership &amp; Strategy"), Implementation.time.frame = c("Short-term", 
  "Short-term", "Short-term", "Short-term", "Short-term", "Mid-term", 
  "Long-term", "Short-term", "Short-term", "Mid-term", "Mid-term", 
  "Short-term", "Short-term", "Short-term", "Short-term", "Short-term"
  ), Goal = c("Goal13", "Goal13", "Goal13", "Goal13", "Goal13", 
  "Goal12", "Goal12", "Goal11", "Goal11", "Goal11", "Goal11", "Goal11", 
  "Goal11", "Goal11", "Goal11", "Goal11")), .Names = c("City", 
  "ResiliencyChallenge", "CRI.Dimesnsion.1", "Implementation.time.frame", 
  "Goal"), class = "data.frame", row.names = c(NA, -16L))
  </code></pre>