How to convert a Push Down Automata to Context Free Grammar?


Given a push down automaton

M = (K, Σ, Γ, Δ, s, F) where K = {p, q, r}, Σ = {a, b, c}, Γ = {a}, s = p, and F = {r}, with the transitions

((p, b, ε), (q, ε)), ((q, a, e,), (p, a)), ((p, c, a), (r, ε)), ((r, c, a), (r, ε))

How can I construct a context-free grammar for the set of strings accepted by M?

From my understanding, I have to draw an equivalent diagram and minimize it? What is the relationship between PDA and CFG?