Repaso
EspaƱol
Algorithms & DSCoreALG-47

What is a graph in computer science?

Options

  1. A chart with axes, used to plot data
  2. A set of nodes (vertices) connected by edges (Correct option)
  3. A sorted list of values with links
  4. A type of loop that repeats over nodes

Answer

A set of nodes (vertices) connected by edges

Why

A graph models things and connections between them: cities and roads, users and friendships, web pages and links.

Edges can be directed (one-way, like following someone) or undirected (two-way), and weighted (with a cost, like distance) or not.

A tree is a special graph with no cycles.

Remember

Graph = nodes + edges.

Key terms

Practice this question in Repaso