a graph is an ordered pair
, where
is a set whose elements are called vertices, and
is a set of paired vertices, whose elements are called edges
consider the graph
usually a graph is stored in computer memory using an adjacency list, this is the assumption here
consider the following algorithm which receives an undirected graph and returns a list of its edges
the time complexity of this algorithm is
the maximum number of edges in a simple undirected graph is
in a complete graph, the rank of each vertex is
, and it follows trivially that the sum of ranks is
, and since each vertex touches 2 edges, the number of edges is
let
be a path in a graph
- if
, then
is a cycle
- a path
is simple if no vertex appears in
more than once
- a cycle
is simple if no vertex except for the first one appears in
more than once
- let
be two paths in the graph
, the concatenation of
is
- the graph
is connected if between every two vertices
there's a path
- a graph
is acyclic if in
there's no cycles
- a graph
is a tree if it is connected and acyclic