There are two main meanings of the word graph in Mathematics:

• A mathematical object consisting of nodes and edges.
• Such a graph is often represented by a diagram consisting of dots (representing nodes) and lines (representing edges).
• A diagram illustrating the relationship between two or more variables.
• Such a diagram is often used to draw the graph of a function

For a graph in the first sense - points and edges - we can define a distance function between vertices x and y of a graph by taking the length of the shortest path from x to y. Such a distance function defines a metric on the vertices, and thus we get a metric space. If we put non-negative weights on the edges and define the function d(x,y) to be the minimal sum of weights taken over all possible paths from x to y we again get a metric space with the elements being the vertices of the graph.