인접 목록으로 표시된 그래프가 있습니다. 그것을 위해 depth_first_visit 알고리즘을 적용합니다. 모든 것이 거의 정상적으로 작동합니다. 문제는 알고리즘이 시작점 꼭지점과 연결된 꼭지점 만 방문한다는 것입니다. 별도의 정점이 있으면 (연결없이) 통과하지 않습니다. 물론 방문한 정점을 찾은 다음 알고리즘을 시작하여이 문제를 해결했지만 문서에서 이러한 "분리 된"정점도 통과해야한다는 점을 설명합니다. 질문 - 내가 뭔가 잘못하고 있는거야?DFS 방문객이 분리 된 버텍스를 트래버스하지 않습니다.
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, Vertex, Edge > GraphType;
vector<default_color_type> color_map(num_vertices(m_graph));
depth_first_visit(
m_graph,
*vp.first,
custom_dfs_visitor(m_currentPath, visited),
make_iterator_property_map(
color_map.begin(),
get(vertex_index, m_graph),
color_map[0]),
Terminator(m_currentPath)
);