A graph is a mathematical structure that contains a collection of vertices or 'nodes' and a collection of edges that connect pairs of vertices. Graphs can be undirected or directed, where edges are directed, indicating from which vertex they start and to which they lead ( be it other or the same ).
Not to be confused with visual graphs (bar graphs, etc), a graph has a very specific meaning:
Graph G = (V,E)
, where V
is a set of vertices or nodes, and E
is a set of edges or arcs. The set of edges may be directed or undirected, which in turn makes G
directed or undirected.
Example:
Graph theory is a subfield of mathematics and computer science dealing with the representation, implementation, and algorithmic design of graphs.