Example #1
0
File: 5.py Project: fuguohong/algs
 def __init__(self, graph: Graph):
     self._graph = graph
     self._colors = dict()
     self._marked = dict()
     self._flage = True
     for v in graph.vertexes():
         if self._marked.get(v) is not True:
             self._colors[v] = True
             self._search(v)
Example #2
0
 def __init__(self, graph: Graph):
     """
     :param graph: 连通图
     """
     self._graph = graph
     self._briges = []
     self._current = 0
     self._order = dict()  # 记录遍历顺序
     self._low = dict()  # 通过非前导路径能够回到的最小父顶点
     self.start = next(iter(graph.vertexes()))
     self._search(self.start, self.start)