Representations of graphs
A graph is a structure that represents data in terms of vertices and edges. A graph is represented as aGraph = (π₯, π), where π₯ represents a set of vertices and π represents a set of edges. Note that aGraph has |π₯| vertices and |π| edges.
A vertex, π β π₯, represents a real-world object, such as a person, a computer, or an activity. An edge, π β π, connects two vertices in a network:
e(π1, π2) | e β π & πi β π₯
The preceding equation indicates that in a graph, all edges belong to a set, π, and all vertices belong to a set, π₯.
An edge connects two vertices and so represents a relationship between them. For example, it can represent the following relationships:
Friendships between people
A person connected to a friend ...