A graph is a representation of a set of objects that's connected by links. The links connect vertices, which are points. The basic operations on a graph are the addition and removal of links and vertices. These are some different types of graphs:
- Directed graph
- Non-directed graph
- Connected graph
- Non-connected graph
- Simple graph
- Multi-graph
An adjacency list consists of adjacent vertices of a graph that have objects or records. An adjacency matrix consists of source and destination vertices. An incidence matrix is a two-dimensional Boolean matrix. The matrix has rows of vertices and columns that represent the links (edges).
Network representation using a graph is shown in the following code. A social graph consists of an array of links:
///main package has examples shown
// in Go Data Structures and algorithms book
package main
// importing...