A graph is a structure consisting of a pair of sets
Connectivity describes whether vertices in a graph can reach each other through a sequence of edges.
A graph is connected if there exists a path between every pair of vertices. In other words, you can travel from any vertex to any other vertex by following edges.
Formally, a graph
In a directed graph, a graph is weakly connected if replacing all of its directed edges with undirected edges produces a connected (undirected) graph.
In a directed graph, a graph is strongly connected if there is a directed path from every vertex to every other vertex.
A graph is considered sparse if the number of edges is much less than the maximum number of possible edges. Conversely, a graph is dense if the number of edges is close to the maximum number of possible edges.
Formally, for a graph with