Graphs

What are graphs?

Graphs are non-linear data structures made up of nodes connected by edges. More formally a Graph is composed of a set of vertices( V ) and a set of edges( E ). The graph is denoted by G(E, V).

Terminology

Weight: A weight can be assigned to an edge, representing the cost or distance between two vertices. A weighted graph is a graph where the edges have weights.

Degree: The degree of a vertex is the number of edges that connect to it. In a directed graph, the in-degree of a vertex is the number of edges that point to it, and the out-degree is the number of edges that start from it.

Path: A path is a sequence of vertices that are connected by edges. A simple path does not contain any repeated vertices or edges.

Cycle: A cycle is a path that starts and ends at the same vertex. A simple cycle does not repeat a node or an edge

Connectedness: A graph is said to be connected if there is a path between any two vertices. The opposite of a connected graph is called disconnected.

Planarity: A graph is planar if it can be drawn without any edges crossing each other.

Bipartiteness: A graph is said to be bipartite if its vertices can be divided into two disjoint sets such that no two vertices in the same set are connected by an edge.

Full course
Next Lesson