###### 图中两个点之间的路线

for s = B and t = E, return true

for s = D and t = C, return false

class DirectedGraphNode:
def __init__(self, x):
self.label = x
self.neighbors = []

# Definition for a Directed graph node
# class DirectedGraphNode:
#     def __init__(self, x):
#         self.label = x
#         self.neighbors = []

class Solution:
"""
@param graph: A list of Directed graph node
@param s: the starting Directed graph node
@param t: the terminal Directed graph node
@return: a boolean value
"""
def hasRoute(self, graph, s, t):

# visited表示已经访问了的节点
visited = [s]
return self.bfs(graph, s, t, visited)

def bfs(self, graph, s, t, visited):
queue = [s]
while len(queue) != 0:
temp = queue.pop(0)
if temp == t:
return True
visited.append(temp)
for ele in temp.neighbors:
if ele not in visited:
queue.append(ele)
return False

#### LintCode-图中两个点之间的路线

2015-05-17 18:33:20

#### 176 - 图中两个点之间的路线

2017-10-19 09:37:16

#### lintcode-图中两个点之间的路线-176

2015-09-19 20:22:44

#### LintCode:图中两个点之间的路线

2016-05-12 14:50:51

#### 题目：图中两个点之间的路线

2015-09-11 23:32:08

#### 图中两个点之间的路线

2015-12-06 00:15:39

#### lintcode 图中两个点之间的路线 广度优先搜索

2016-10-26 10:25:08

#### 【Java】给定有向图，设计一个算法，找出两个结点之间是否存在一条路径

2015-07-14 14:01:53

#### Chapter 4 | Trees and Graphs--判断有向图两节点之间是否存在路径

2014-07-24 15:10:05

#### 程序员面试金典： 9.4树与图 4.2给定有向图，设计一个算法，找出两个节点之间是否存在一条路径。

2016-12-27 15:38:40