Definition

With the conventions chosen above we can define a graph as a finite 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 the study of relations on finite sets, but the questions we ask when considering such a relation as a graph are different from the ones we normally ask about relations.

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 ) }\).

This definition is easily adapted to infinite graphs–you just drop the assumption that the set of vertices is finite–but it would require more serious modifications to cope with multiple edges from one vertex to another.