Definition

With the conventions chosen above we can define a graph as a set, the set of vertices, and a relation on that set, the set of order pairs of vertices for which there is an edge connecting the left component of the pair to the right component. From this point of view graph theory is just the study of relations on sets, but the questions we ask when considering such a relation as a graph are different from the ones we normally ask about relations. It is sometimes helpful though to recast problems about relations as problems about graphs, to take advantage of our spatial intuition.

With this definition a graph is undirected if and only if it is symmetric, i.e. if and only if \({ ( x , y ) }\) belongs to the edge relation whenever \({ ( y , x ) }\) does. Self loops are just pairs of the form \({ ( x , x ) }\).

If we allowed multiple edges from one vertex to another we would have to adopt a different set of definitions. The usual way to to this is to have two sets, for vertices and relations, and two relations, each of which applies to a vertex and an edge. The first is the “is the initial vertex of” relation and the second is the “is the final vertex of” relation.