You'd want to use a vertical line test.
1st image: Every vertical line cuts the graph at at most one point
2nd image: The vertical line x = 1 cuts the graph at more than one point
3rd image: The vertical line x = 1 cuts the graph at 2 points
4th image: The vertical line x = -2 cuts the graph at 2 points
Hence, graph 1 (1st image) is a function.