Graphs are an essential data structure in computer science for modeling networks. Let’s review some key terms:

  • vertex: A node in a graph.
  • edge: A connection between two vertices.
  • adjacent: When an edge exists between vertices.
  • path: A sequence of one or more edges between vertices.
  • disconnected: Graph where at least two vertices have no path connecting them.
  • weighted: Graph where edges have an associated cost.
  • directed: Graph where travel between vertices can be restricted to a single direction.
  • cycle: A path which begins and ends at the same vertex.
  • adjacency matrix: Graph representation where vertices are both the rows and the columns. Each cell represents a possible edge.
  • adjacency list: Graph representation where each vertex has a list of all the vertices it shares an edge with.


Graphs are one of the most common data structures in computer science. Modeling complex problems with a graph is essential for a career in software development.

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?