Definition: A set of items connected by edges. Each item is called a vertex or node. Formally, a graph is a set of vertices and a binary relation between vertices, adjacency.
References
Black, Paul E. (2019-10-1). Pieterse, Vreda; Black, Paul E. (eds.). "dictionary".Dictionary of Algorithms and Data Structures. National Institute of Standards and Technology. Retrieved from: https://www.nist.gov/dads/HTML/dictionary.html
A node that features a String label.
class Node { String label; Node(String label) { this.label = label; } }
Here's how we can implement a graph as an adjacency list.
class Graph { private Map> adjVertices; }