# Diagrams (category theory) as indexing “shapes”

From Wikipedia https://en.wikipedia.org/wiki/Diagram_(category_theory), it says that "diagram is the categorical analogue of an indexed family in set theory." I'm wondering how it works.

Suppose we have a diagram of type $\mathcal{J}$ in a category $\mathcal{C}$. So this means that $\mathcal{J}$ encodes the "shape" we are interested in $\mathcal{C}$. This is analogous to an indexed family in set theory in the following sense: the functors $D_i : \mathcal{J} \rightarrow \mathcal{C}$ index the shape in $\mathcal{C}$. Is this correct?

As an simple example, we just consider the trivial functors $D_X : \mathcal{J} \rightarrow \mathcal{C}$ where all the objects in $\mathcal{J}$ are mapped to the object $X$ in $\mathcal{C}$, and all arrows in $\mathcal{J}$ are mapped to the identity arrow $\text{id}_X$ in $\mathcal{C}$. Then we can have an "indexing set" $\{D_X\}_{X\in Obj(\mathcal{C})}$.

The idea to keep in mind is that an indexed family of sets can be described as a functor $F:\mathcal{I}\to\mathbf{Set}$ where $\mathcal{I}$ is a discrete category (one where the only morphisms are identities). Since this case is really simple, it's enough to write $\{F_I\}_{I\in Obj(\mathcal{I})}$, or even ignore the category structure on $\mathcal{I}$ and just think of it as a set. (Here I've written "$F_I$" for $F(I)$ to make the notation familiar.)
The way that a diagram generalizes this is in allowing $\mathcal{I}$ to be a category that is not discrete, and the codomain of $F$ to be an arbitrary category $\mathcal{C}$. Then part of this diagram still the family $\{F_I\}_{I\in Obj(\mathcal{I})}$, but now there's an additional family $\{F_f:F_I\to F_J\}_{f:I\to J\in Arr(\mathcal{I})}$ that obeys the additional conditions induced by the structure of $\mathcal{I}$ and the functoriality of $F$. That's what it means to say that a diagram picks out objects and morphisms in the "shape" of $\mathcal{I}$: the diagram gives you an indexed structure of objects and morphisms in $\mathcal{C}$ which, to phrase things loosely, must obey all the identities that hold in $\mathcal{I}$.