Maths - Concrete Category - Graphs

A step up in complexity from a category of sets we can look at the category of graphs.

Objects in Grf are a collection of vertices and edges related in certain ways. However category theory tends not to look inside objects. diagram

Morphisms in Grf sends vertices to vertices and edges to edges, such that,

if a->b is an arrow
then F a -> F b is an arrow.

Again category theory tends not to look inside these morphisms.


Relating category theoretic view to set theory view.

There is a representable object in Grf (see Yoneda lemma page). This might help us relate the internal and external views of Grf.

This representable object is a graph with two vertices and an arrow between them.

Arrows into this object can be thought of as picking out all the edges in the other object. This gives a homset with an arrow for each edge.


Given a morphism 'F' between two graph objects. If both these objects have hom functors to the representable object then there is a function 'f' between these two sets.

This function goes in the opposite direction.


It is easier to see this contravarience from this diagram.

If 'F' is given we can derive 'h' from 'g' by composing with 'F' but we can't derive 'g' from 'h'.

So if we want to get the usual functions in set we need to start with Grfop



Objects in Grfop are the same as the objects in Grf. diagram

Morphisms in Grfop go in the opposite direction to the morphisms in Grf. So this time:

if F a-> F b is an arrow
then a -> b is an arrow.

In Grf these functions can be surjective or injective as with set. diagram
surjective function
injective function

In Grfop these arrows can be the reverse of these.



So this embedding is given by:

hX = homC(_,X) : Grf op-> Set

Internal View

Although category theory does not tend to look inside objects it is helpful to relate this to a more set theoretical approach.

The objects in Grf consist of a set together with some internal structure.

Directed Graph

graph object diagram
Two functions, source and target) from the set of edges to the set of vertices.

graph arrow diagram
Two functions, between the source and target objects, which respect the graph structure.

An example of a functor category.

These maps between the source and target imply functors of the verticies and edges.

So what does it mean for the arrows to respect the graph structure?

For instance, if we look inside the functions, the diagram on the right is valid.

inside arrow diagram

If we look at parts of this arrow we see:

edges map to edges

graph arrow respect edge diagram
Where the vertex function is surjective edges may be reduced to a loop.
Both the vertex function and the edge function may be injective.

Functors Between Graphs

Lets look at the possible diagrams for graphs.

  External diagram Internal mapping for a specific example
category diagram: endomap external endomap internal
simpler diagram which we can use in the case of endomaps: endomap external endomap internal

An endomap is a mapping from a object to itself. A category diagram for this case is shown in the higher row in the table above, we can see that it is an endomap because both the domain and the codomain are labled 'A', and hence are the same.

However, because this is an endomap, we can simplify the diagram by showing 'A' as one object.

Graph Categories

So lets start with Grf, a category of graphs, these have a bit more structure than sets and so will allow us to explore the relationships between objects which are sets+structure. I find it helpful to adapt the diagrams as bit, to get us started, so that we can include some of the normally hidden structure beneath. This is just to get us started, we won't always do this as the nature of category theory is to abstract as much as possible. Lets start with sets, which are perhaps the simplest objects, because they don't have the structure of operations like multiplications and additions.

set category Sets may just be any set of elements, or some or all of these sets may themselves be sets (and these inner sets may also contain sets and so on). Also these elements may all have a common type or not. So we could show the structure inside the set instead of representing them as single characters.
group category In the case of structures like groups with a group operation then we could show that, perhaps by combining with a Cayley graph.


I find that including this further information helps even more with arrows:

set arrow category Here I have showed individual arrows going from each element of the two objects rather than the more usual single arrow between the two objects.
group arrow category In the case of groups we may be able to give an indication of how the group operation is changed by the arrow.

We will call the object at the start of the arrow the 'domain' and the object at the end of the arrow the 'codomain'

Subcategories of Grf

Two important subcategories are idempotent and invertible endomaps:

idempotent endomap

Idempotent Endomap

All arrows lead to fixed points.

invertable endomap

Invertible Endomap (permutation).

contains only 2-cycles and fixed points


The dual of graph is a category with the same objects as Grf but with the arrows reversed.

normal function

The blue arrows are intended to show inside an arrow between two grf objects.

Multiple vertices can be compressed down to a single point (surjective), for example, 'a' and 'b' both map to 'w'. Some vertices in the codomain don't have incoming arrows, for example, 'y' and 'z'.

inside arrow diagram

reversed function

When the arrows are reversed it is possible for a vertex, for example, 'w' to be mapped to multiple vertices 'a' and 'b'.

grap op arrow diagram

That defines Grfop but it would be better if the revered arrow behaved like a function, that is, if we could change the structure of the objects instead of the arrows (as we did for sets on page here).

Is this possible?

Irriflexive Graphs

Endomaps (mappings from an object to itself) are related to two parallel maps between different objects.

  External diagram Internal mapping for a specific example
Irriflexive Graph: irriflexive external irriflexive internal
related endomap: endomap external endomap internal

The endomap is given by the difference between the red and blue mappings.

Adjunctions in Graphs

Adjunctions in Graphs

Adjunctions are described on page here.

Between reflexive graph and set.

In reflexive graph: every node has loop to itself.

graph example

reflexive graph


Between irreflexive graph and set.

In irreflexive graph: every node does not have loop to itself.

Between dynamical system graph and set.

In dynamical system graph: every node has one outgoing arrow.

dynamical systems graph
dynamical systems and fixpoints

Different dynamical system graph and set.

This time the morphism to set defines the fixpoints.

Exponential Objects in Graph

There is a homset that shows all the ways an object can be mapped into another object: exponential object diagram
This is related to the Cartesian product by Currying: Hom(A×B,C)≡Hom(A,CB)
The related product might look like this: product diagram

See page here about Cartesian Closed Category structures in graphs.


If we overlay multiple graphs (shown in different colours) then we get a Cayley graph as discussed on this page. This gives us a way to move onto monoids and groups in terms of category theory on this page.


See page here about Cartesian Closed Category structures in graphs.


metadata block
see also:

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

cover Modern Graph Theory (Graduate Texts in Mathematics, 184)

Terminology and Notation

Specific to this page here:


This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.