  Causal DAGs (also known as Bayesian networks) are a popular tool for encoding
conditional dependencies between random variables. In a causal DAG, the random
variables are modeled as vertices in the DAG, and it is stipulated that every
random variable is independent of its ancestors conditioned on its parents. It
is possible, however, for two different causal DAGs on the same set of random
variables to encode exactly the same set of conditional dependencies. Such
causal DAGs are said to be Markov equivalent, and equivalence classes of Markov
equivalent DAGs are known as Markov Equivalent Classes (MECs). Beautiful
combinatorial characterizations of MECs have been developed in the past few
decades, and it is known, in particular that all DAGs in the same MEC must have
the same "skeleton" (underlying undirected graph) and v-structures (induced
subgraph of the form $a\rightarrow b \leftarrow c$).
  These combinatorial characterizations also suggest several natural
algorithmic questions. One of these is: given an undirected graph $G$ as input,
how many distinct Markov equivalence classes have the skeleton $G$? Much work
has been devoted in the last few years to this and other closely related
problems. However, to the best of our knowledge, a polynomial time algorithm
for the problem remains unknown.
  In this paper, we make progress towards this goal by giving a fixed parameter
tractable algorithm for the above problem, with the parameters being the
treewidth and the maximum degree of the input graph $G$. The main technical
ingredient in our work is a construction we refer to as shadow, which lets us
create a "local description" of long-range constraints imposed by the
combinatorial characterizations of MECs.
