Graph theory problem

Правка en2, от typedeftemplate, 2020-04-23 01:09:02

Hi everyone,

I've been learning a lot of graph theory lately, and I've come across the following question, which I am having trouble with:

Suppose you are given a directed acyclic graph $$$G = (V, E)$$$ in which each vertex is colored one of two colors. You are also given two vertices $$$u$$$ and $$$v$$$ in the graph. How can I determine whether there is a path from $$$u$$$ to $$$v$$$ consisting of only one color (each intermediate vertex other than $$$u$$$ and $$$v$$$ are required to have the same color, the colors of $$$u$$$ and $$$v$$$) don't matter.

I thought about applying topological sort since it's a DAG, but then I don't really know how to proceed. Can someone please help me?

Теги #graph, #graph theory, #dfs, #dfs and similar

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский typedeftemplate 2020-04-23 01:09:02 173
en1 Английский typedeftemplate 2020-04-23 01:07:46 655 Initial revision (published)