logo
Problems

Route Between Two Nodes in Graph

Problem

Given a directed graph, design an algorithm to find out whether there is a route between two nodes.

Example

Given graph:

    A----->B----->C
     \     |
      \    |
       \   |
        \  v
         ->D----->E

for s = B and t = E, return true.

for s = D and t = C, return false.

Online Judge