Counting and uniform sampling of directed acyclic graphs (DAGs) from a Markov\nequivalence class are fundamental tasks in graphical causal analysis. In this\npaper, we show that these tasks can be performed in polynomial time, solving a\nlong-standing open problem in this area. Our algorithms are effective and\neasily implementable. Experimental results show that the algorithms\nsignificantly outperform state-of-the-art methods.\n