Graph (discrete mathematics)


In discrete mathematics, particularly in graph theory, a graph is a structure consisting of a set of objects where some pairs of the objects are in some sense "related". The objects are represented by abstractions called vertices and each of the related pairs of vertices is called an edge. Typically, a graph is depicted in diagrammatic form as a set of dots or circles for the vertices, joined by lines or curves for the edges.
The edges may be directed or undirected. For example, if the vertices represent people at a party, and there is an edge between two people if they shake hands, then this graph is undirected because any person A can shake hands with a person B only if B also shakes hands with A. In contrast, if an edge from a person A to a person B means that A owes money to B, then this graph is directed, because owing money is not necessarily reciprocated.
Graphs are the basic subject studied by graph theory. The word "graph" was first used in this sense by J. J. Sylvester in 1878 due to a direct relation between mathematics and chemical structure.

Definitions

Definitions in graph theory vary. The following are some of the more basic ways of defining graphs and related mathematical structures.

Graph

A graph is a pair, where is a set whose elements are called vertices, and is a set of unordered pairs of vertices, whose elements are called edges.
The vertices and of an edge are called the edge's endpoints. The edge is said to join and and to be incident on them. A vertex may belong to no edge, in which case it is not joined to any other vertex and is called isolated. When an edge exists, the vertices and are called adjacent.
A multigraph is a generalization that allows multiple edges to have the same pair of endpoints. In some texts, multigraphs are simply called graphs.
Sometimes, graphs are allowed to contain loops, which are edges that join a vertex to itself. To allow loops, the pairs of vertices in must be allowed to have the same node twice. Such generalized graphs are called graphs with loops or simply graphs when it is clear from the context that loops are allowed.
Generally, the vertex set is taken to be finite. Sometimes infinite graphs are considered, but they are usually viewed as a special kind of binary relation, because most results on finite graphs either do not extend to the infinite case or need a rather different proof.
An empty graph is a graph that has an empty set of vertices. The order of a graph is its number of vertices, usually denoted by. The size of a graph is its number of edges, typically denoted by. However, in some contexts, such as for expressing the computational complexity of algorithms, the term size is used for the quantity . The degree or valency of a vertex is the number of edges that are incident to it; for graphs with loops, a loop is counted twice.
In a graph of order, the maximum degree of each vertex is , and the maximum number of edges is .
The edges of a graph define a symmetric relation on the vertices, called the adjacency relation. Specifically, two vertices and are adjacent if is an edge. A graph is fully determined by its adjacency matrix, which is an square matrix, with specifying the number of connections from vertex to vertex. For a simple graph, is either 0, indicating disconnection, or 1, indicating connection; moreover because an edge in a simple graph cannot start and end at the same vertex. Graphs with self-loops will be characterized by some or all being equal to a positive integer, and multigraphs will be characterized by some or all being equal to a positive integer. Undirected graphs will have a symmetric adjacency matrix.

Directed graph

A [|directed graph] or digraph is a graph in which edges have orientations.
In one restricted but very common sense of the term, a directed graph is a pair comprising:
  • , a set of vertices ;
  • , a set of edges, which are ordered pairs of distinct vertices:.
To avoid ambiguity, this type of object may be called precisely a directed simple graph.
In the edge directed from to, the vertices and are called the endpoints of the edge, the tail of the edge and the head of the edge. The edge is said to join and and to be incident on and on. A vertex may exist in a graph and not belong to an edge. The edge is called the inverted edge of. Multiple edges, not allowed under the definition above, are two or more edges with both the same tail and the same head.
In one more general sense of the term allowing multiple edges, a directed graph is sometimes defined to be an ordered triple comprising:
  • , a set of vertices ;
  • , a set of edges ;
  • , an incidence function mapping every edge to an ordered pair of vertices :.
To avoid ambiguity, this type of object may be called precisely a directed multigraph.
A loop is an edge that joins a vertex to itself. Directed graphs as defined in the two definitions above cannot have loops, because a loop joining a vertex to itself is the edge or is incident on which is not in. So to allow loops the definitions must be expanded. For directed simple graphs, the definition of should be modified to. For directed multigraphs, the definition of should be modified to. To avoid ambiguity, these types of objects may be called precisely a directed simple graph permitting loops and a directed multigraph permitting loops respectively.
The edges of a directed simple graph permitting loops is a homogeneous relation ~ on the vertices of that is called the adjacency relation of. Specifically, for each edge, its endpoints and are said to be adjacent to one another, which is denoted.

Mixed graph

A mixed graph is a graph in which some edges may be directed and some may be undirected. It is an ordered triple for a mixed simple graph and for a mixed multigraph with, , , and defined as above. Directed and undirected graphs are special cases.

Weighted graph

A weighted graph or a network is a graph in which a number is assigned to each edge. Such weights might represent for example costs, lengths or capacities, depending on the problem at hand. Such graphs arise in many contexts, for example in shortest path problems such as the traveling salesman problem.

Types of graphs

Oriented graph

One definition of an oriented graph is that it is a directed graph in which at most one of and may be edges of the graph. That is, it is a directed graph that can be formed as an orientation of an undirected graph.
Some authors use "oriented graph" to mean the same as "directed graph". Some authors use "oriented graph" to mean any orientation of a given undirected graph or multigraph.

Regular graph

A regular graph is a graph in which each vertex has the same number of neighbours, i.e., every vertex has the same degree. A regular graph with vertices of degree k is called a k‑regular graph or regular graph of degree k.

Complete graph

A complete graph is a graph in which each pair of vertices is joined by an edge. A complete graph contains all possible edges.

Finite graph

A finite graph is a graph in which the vertex set and the edge set are finite sets. Otherwise, it is called an infinite graph.
Most commonly in graph theory it is implied that the graphs discussed are finite. If the graphs are infinite, that is usually specifically stated.

Connected graph

In an undirected graph, an unordered pair of vertices is called connected if a path leads from x to y. Otherwise, the unordered pair is called disconnected.
A connected graph is an undirected graph in which every unordered pair of vertices in the graph is connected. Otherwise, it is called a disconnected graph.
In a directed graph, an ordered pair of vertices is called strongly connected if a directed path leads from x to y. Otherwise, the ordered pair is called weakly connected if an undirected path leads from x to y after replacing all of its directed edges with undirected edges. Otherwise, the ordered pair is called disconnected.
A strongly connected graph is a directed graph in which every ordered pair of vertices in the graph is strongly connected. Otherwise, it is called a weakly connected graph if every ordered pair of vertices in the graph is weakly connected. Otherwise it is called a disconnected graph.
A k-vertex-connected graph or k-edge-connected graph is a graph in which no set of vertices exists that, when removed, disconnects the graph. A k-vertex-connected graph is often called simply a k-connected graph.

Bipartite graph

A bipartite graph is a simple graph in which the vertex set can be partitioned into two sets, W and X, so that no two vertices in W share a common edge and no two vertices in X share a common edge. Alternatively, it is a graph with a chromatic number of 2.
In a complete bipartite graph, the vertex set is the union of two disjoint sets, W and X, so that every vertex in W is adjacent to every vertex in X but there are no edges within W or X.

Path graph

A path graph or linear graph of order is a graph in which the vertices can be listed in an order v1, v2, …, vn such that the edges are the where i = 1, 2, …, n − 1. Path graphs can be characterized as connected graphs in which the degree of all but two vertices is 2 and the degree of the two remaining vertices is 1. If a path graph occurs as a subgraph of another graph, it is a path in that graph.