To what extent is a scheme morphism determined by its topological map?

I am just beginning to learn scheme theory. This question is aimed at getting a feel for something so apologies in advance for the lack of precision.

I am struck by the following difference from the theory both of varieties and smooth manifolds:

In the categories both of varieties and of smooth manifolds, a morphism is completely specified by what it is doing on the topological spaces, since the elements of the structure sheaf (regular functions for varieties, smooth functions for manifolds) are determined by their pointwise values. But in the category of schemes, to specify a morphism $f:X\rightarrow Y$ we need to separately specify the underlying topological map $f:X\rightarrow Y$ and the sheaf map $f^\#: \mathcal{O}_Y\rightarrow f_*\mathcal{O}_X$.

In spite of this, it seems to me that the topological map puts strong constraints on the sheaf map. For example, if $X=\operatorname{Spec}B,Y=\operatorname{Spec}A$ are affine schemes, the morphism is determined by a ring homomorphism $A\rightarrow B$; the topological map is how the primes contract under that ring homomorphism. If I know how all the primes are contracting, this does not leave the homomorphism a lot of room to wiggle. I request help in thinking about exactly how much room there is:

"How many" different morphisms are possible between schemes $X,Y$ with the same topological map $f:X\rightarrow Y$? "How different" can they get? What kinds of conditions on $X,Y$ limit this flexibility?

(For example, if $X,Y$ are integral, in which case elements of the structure sheaves are "determined by their pointwise values" in the residue fields $\kappa(p)$, does the topological map force a particular sheaf map as it does for varieties and manifolds?)


If $K,L$ are fields (more generally rings with only one prime ideal, i.e. local and $0$-dimensional), then the morphisms $\mathrm{Spec}(L) \to \mathrm{Spec}(K)$ correspond to field homomorphisms $K \to L$. If you are familiar with Galois theory, you already see from this simple example that one can spend a lifetime with morphisms of this type, although the underlying topological spaces have just one point!

On the other hand, the following is true: If $X,Y$ are integral and of finite type over some algebraically closed field $k$, then a $k$-morphism $f : X \to Y$ is, in fact, determined by what it does on the underlying spaces. This is the fully-faithful part of the well-known equivalence of categories between varieties in the modern sense and varieties in the classical sense.

As for the general case, you have already observed that for a continuous map $f : X \to Y$ there are as many extensions to morphisms $(f,f^\#) : X \to Y$ of schemes as sheaf homomorphisms $\mathcal{O}_Y \to f_* \mathcal{O}_X$ (such that the stalk maps are local).

When you start with algebraic geometry you can safely use your intuition about basic constructions of topological spaces, because they all carry over to (locally) ringed spaces. However, algebraic geometry is of course more than topology. Take it literally: Algebra + Geometry. :)


An example : let $\rm X$ be any closed subscheme of $\rm Y$ and let $\mathfrak I$ be its sheaf of ideals, then for any $n > 0$, you have a map $\iota_n : \rm X \to \rm Y$ defined by $\mathfrak I^n$ which are all the same topologically.