Let be a
simple undirected graph and let consist of all pairs of distinct vertices in . Then the simple
undirected graph is the complement of , where is the
relative complement of in . Let be a
simple directed graph and let consist of all
ordered pairs of distinct vertices in . Then the simple directed graph is the complement of . Let be a simple undirected / directed graph, let be the
complete simple undirected / directed graph on the same number of vertices (i.e., all entries are unity except the diagonal entries which are zero), let \mathbb{A}(G) and \mathbb{A}(K) respectively be the adjacency matrices of and . Then the
adjacency matrix of the complement of is: \mathbb{A}(H) = \mathbb{A}(K) - \mathbb{A}(G). The complement is not defined for
multigraphs. For graphs that allow
self-loops (but not multiple adjacencies), the complement of a graph may be defined by adding a self-loop to every vertex that does not have one in , removing its self-loop from every vertex that has one in , and otherwise using the same formula as above. However, this operation is different from the one for simple graphs, since applying it to a graph with no self-loop results in a graph with self-loops on all vertices. ==Applications and examples==