Suppose I would like to show that for 2 metric spaces $A,B$, a function $f:A\to B$ and the graph of $f$, $G=\{(a,f(a))\in A\times B|a\in A\}$ that
$f$ is continuous IFF $G$ is closed (with an additional condition for the $(\Leftarrow)$ direction -- $B$ is compact)
My thoughts are
$(\Rightarrow) a_k\to a \implies f(a_k)\to f(a)$, therefore $(a_k,f(a_k))\to (a,b)\implies (a,b)\in A\times B$.
My doubts are that do I need to say something about the product metric? As far as I know there isn't a unique definition for it. Also this "proof" seems to be too simple -- I think it might be lacking in something.
$(\Leftarrow) $ Suppose $a_k\to a$, Then since $G$ is compact, given a sequence $(a_k, f(a_k))$, we can find a subsequence $(a_{k_n}, f(a_{k_n}))$ that converges (I am not sure what this law is, I hope I haven't confused the context and that it is really applicable here.) Since the limit is in $G$, therefore $f(a_{k_n})\to f(a)$ for $a_{k_n}\to a$. Therefore $f$ is continuous.
Again, I think there might be holes in my argument, or perhaps even wrong assumptions.
Please teach me to fix it. Thanks!