In functional analysis, the closed graph theorem asserts that if a linear map $T: X \to Y$ between two Banach spaces $X, Y$ has a closed graph $S := \{ (x,Tx): x \in X \}$, then the map is continuous. Thus, it gives a criterion for regularity of a map in terms of regularity of the graph of that map.
I am curious as to whether there is any analogous statement in algebraic geometry. The naive formulation would be: if $T: X \to Y$ was a function (in the set-theoretic sense) between algebraic varieties $X, Y$ over an algebraically closed field $k$ whose graph $S := \{ (x,Tx): x \in X \}$ was also an algebraic variety, then $T$ would be a regular map. (Here I will be vague as to whether I want varieties to be affine, projective, quasiprojective, or abstract.) But this is false, even in characteristic zero: for instance, the coordinate function $(t^2,t^3) \mapsto t$ from the cuspidal curve $\{ (t^2,t^3): t \in k \}$ to $k$ has a graph which is an algebraic variety, but is not a regular map (it is not given by a rational function in a neighbourhood of the origin). In characteristic $p$, the inverse of the Frobenius map $x \mapsto x^p$ provides another counterexample. Somehow the difficulty is that regular functions in $S$ need not come from pullback from regular functions in $X$, even though the vertical line test suggests that such maps should be "degree 1" in some sense.
Still, I feel like there should be some positive statement to be made here, though I was not able to find one after searching through a few algebraic geometry texts. For instance, if one demands that $X, Y, S$ are all smooth and that the field has characteristic zero, does the claim now hold? Ideally, I would like to only have conditions on the varieties $X,Y,S$ and not on the various maps between these varieties; for instance, I would prefer not to have to assume that the projection map from $S$ to $X$ is finite (though perhaps this is automatic?).