Idea

Just as the graph of a functionf:X→Yf : X \to Y, or more generally that of a relationR⊂X×YR \subset X \times Y for X,Y∈Set=0CatX,Y \in Set = 0 Cat is nothing but the category of elements of the corresponding characteristic function χR:X×Y→(−1)Cat={0,1}\chi_R : X \times Y \to (-1)Cat = \{0,1\}, so the graph of a functor F:C→DF\colon C \to D, or more generally that of a profunctorχ:Cop×D→0Cat=Set\chi : C^{op} \times D \to 0 Cat = Set, is nothing but its category of elements.

Definition

For n≤∞n \leq \infty let (n−1)Cat(n-1) Cat and nCatn Cat be a realization of the notions of nn-category of (n−1)(n-1)-categories and of the (n+1)(n+1)-category of nn-categories, respectively, such that standard constructions of category theory work, in particular a version of the Yoneda lemma. See higher category theory.

The graph of ff is the fibration Graph(f)→Cop×DGraph(f) \to C^{op} \times D classified by χf\chi_f.

Mike Shulman: It’s not obvious to me that this is the best thing to call the graph of a functor; there are lots of other graphy things one can construct from a functor that all reduce to the usual notion of the graph of a function. To start with, there is of course also the induced opfibration oven C×DopC\times D^{op}, would you call that the “opgraph”? But actually, the two-sided fibration D←P→CD \leftarrow P \to C (an opfibration over CC and a fibration over DD) looks to me more like a graph. And then there is of course the other profunctor induced by ff, which gives a fibration over C×DopC\times D^{op}, an opfibration over Cop×DC^{op}\times D, and a two-sided fibration from CC to DD.

Urs Schreiber: I would be inclined to loosely say “graph” for all of these and to introduce terminology like “opgraph” when it really matters which specific realization we mean. Because all these seem to be so similar to me that I am not sure if it is worth distinguishing them a lot. For instance, wouldn’t an analogous discussion be possible concerning what we call Fop:Cop→DopF^{op} : C^{op} \to D^{op} given a functor F:C→DF : C \to D? I don’t actually know what a standard term is, does one say “opfunctor” for this? But I’d say it doesn’t matter much either way, calling FopF^{op} just a functor which effectively is the functor FF doesn’t do much harm.

Colin Zwanziger: Aren’t we better off defining graph of a function as a span to avoid an arbitrary choice of ⟨1,f⟩\langle 1, f\rangle or ⟨f,1⟩\langle f, 1\rangle and then treating the two-sided fibration as the graph of a functor?Edit: Actually, we would still have to choose whether we were taking the graph of the representable or corepresentable profunctor induced by the functor, since these yield different spans. But we have that two functors F and G are adjoint iff (Lawvere's definition) the (graph of F)_A and (graph of G)_B agree. One level down we would have two functions f and g are adjoint (=inverse) iff (graph of f)_A and (graph of g)_B agree, but the two notions of graph turn out to be the same at this level.

Examples

Graphs of 0-functors

To reproduce the ordinary notion of graph of a function let (n,r)=(0,0)(n,r) = (0,0). then (n,r)(n,r)-categories X,YX,Y are just sets and a functor f:X→Yf : X \to Y is just a function between sets. Moreover, the category of (n−1,r)=(−1,0)(n-1,r) = (-1,0)-categories is the set {0,1}\{0,1\} of truth values, as described at (-1)-category. The profunctor corresponding to f:X→Yf : X \to Y is therefore the characteristic function

If we regard CC and DD as 2-categories under the embedding 1Cat↪2Cat1Cat \hookrightarrow 2Cat then the profunctor χf\chi_f corresponding to ff is of the form χf:Cop×D→Cat\chi_f : C^{op} \times D \to Cat and in this context Graph(f)→Cop×DGraph(f) \to C^{op} \times D is the Grothendieck construction on χf\chi_f.