A graph < V, E> is a set V of vertices (or nodes) together with a set E of edges (pairs of vertices from V). If the pairs are unordered, the graph is undirected; such a graph is usually called a graph. If the pairs are ordered, the graph is called a directed graph or digraph.

The notion of edge may be generalized from pairs (connecting two vertices at once) to hyperedges (connecting n vertices at once). The generalization of the graph with hyperedges is a hypergraph.