Given an undirected graph $G=(V,E)$ and vertices $s,t,w_1,w_2\in V$, we study finding whether there exists a simple path $P$ from $s$ to $t$ such that $w_1,w_2 \in P$. As a sub-problem, we study the question: given an undirected graph and three of its edges, does there exist a simple cycle containing all those edges? We provide necessary and sufficient conditions for the existence of such paths and cycles, and develop efficient algorithms to solve this and related problems.
翻译:给定无向图$G=(V,E)$及顶点$s,t,w_1,w_2\in V$,我们研究是否存在从$s$到$t$的简单路径$P$使得$w_1,w_2 \in P$。作为子问题,我们探讨以下问题:给定一个无向图及其三条边,是否存在包含所有这些边的简单环?我们给出了此类路径与环存在的充要条件,并开发了求解该问题及相关问题的高效算法。