在Nutshell算法(第2版)中深度优先搜索(DFS)的解释中,作者使用了3个状态用于顶点,比如白色(未访问),灰色(具有未访问的邻居),黑色(访问).
两个状态(白色和黑色)足以进行遍历.为什么要添加灰色状态?它用于什么?
algorithm depth-first-search graph-algorithm
algorithm ×1
depth-first-search ×1
graph-algorithm ×1