A simple algorithm to construct a consistent extension of a partially oriented graph

A Partially directed acyclic graph, (pdag), is a graph which contains both directed and undirected edges, with no directed cycle in its directed subgraph. An oriented extension of a pdag G is a fully directed acyclic graph (dag) on the same underlying set of edges, with the same orientation on the directed subgraph ofG and the same set of vee-structures. A vee-structure is formed by two edges, directed toward a common head, while their tails are nonadjacent. A simple polynomial-time algorithm is presented, to solve the following problem: Given a pdag, does it admit an oriented extension? The problem was stated by Verma and Pearl, while studying the existence of causal explanation to a given set of observed independencies.