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 ...
Become an OโReilly member and get unlimited access to this title plus top books and audiobooks from OโReilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access