1. Home
  2. Explore
  3. Computer Science
  4. Graph Theory Introduction

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Graph Theory Introduction

  • 85Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Graph Types
An undirected graph is one where edges have no
.

85 questions

  1. 1
    An undirected graph is one where edges have no
    _____
    .
    Hint

    Think about whether the edge can be traveled in both directions or only one.

    Answer

    orientation

  2. 2
    A directed graph is also called a
    _____
    .
    Hint

    This is a common abbreviation in graph theory.

    Answer

    digraph

  3. 3
    In a weighted graph, edges contain arbitrary values such as cost, distance, or
    _____
    .
    Hint

    Think of what else can be represented besides cost and distance.

    Answer

    quantity

  4. 4
    A tree is an undirected graph with no
    _____
    .
    Hint

    Trees are acyclic by definition.

    Answer

    cycles

  5. 5
    A rooted tree has a designated
    _____
    node.
    Hint

    This is the node where all edges either point away from or towards.

    Answer

    root

  6. 6
    Every tree with nnn nodes has exactly
    _____
    edges.
    Hint

    Consider the relationship between nodes and edges in a tree.

    Answer

    n−1n-1n−1

  7. 7
    A directed acyclic graph has directed edges and no
    _____
    .
    Hint

    Think about the cycle condition that would prevent a topological ordering.

    Answer

    cycles

  8. 8
    A topological ordering is possible only for
    _____
    .
    Hint

    What type of graph guarantees no cyclic dependencies?

    Answer

    directed acyclic graphs

  9. 9
    A bipartite graph is one whose vertices can be split into two independent groups such that every edge connects between
    _____
    .
    Hint

    Edges only exist between the partitions, not within them.

    Answer

    the two groups

  10. 10
    A complete graph with nnn vertices is denoted as
    _____
    .
    Hint

    This notation uses the letter K and the number of vertices as a subscript.

    Answer

    KnK_nKn​

  11. 11
    In a complete graph, there is a unique edge between
    _____
    .
    Hint

    It's the densest possible simple graph.

    Answer

    every pair of nodes

  12. 12
    The simplest way to represent a graph is inside a 2D
    _____
    matrix.
    Hint

    This matrix directly shows connections between nodes.

    Answer

    adjacency

  13. 13
    In an adjacency matrix, the cell M[i][j]M[i][j]M[i][j] represents the
    _____
    of going from node iii to node jjj.
    Hint

    This value could be a cost, distance, or a boolean.

    Answer

    edge weight

  14. 14
    Adjacency matrix requires
    _____
    space.
    Hint

    Think about how many entries are needed for a matrix of size VVV.

    Answer

    O(V2)O(V^2)O(V2)

  15. 15
    Adjacency list is a way to represent a graph as a map of nodes to list of
    _____
    .
    Hint

    Each node keeps track of its outgoing connections.

    Answer

    edges

  16. 16
    Adjacency list is great for
    _____
    graphs.
    Hint

    Consider where most entries would be empty in a matrix.

    Answer

    sparse

  17. 17
    Edge list represents a graph as an unordered list of
    _____
    .
    Hint

    Each entry is a triplet representing a directed edge.

    Answer

    edges

  18. 18
    An edge list representation lacks
    _____
    .
    Hint

    Think about what makes it different from an adjacency list or matrix.

    Answer

    structure

  19. 19
    A depth first search runs in time complexity of
    _____
    .
    Hint

    It visits each node and edge at most once.

    Answer

    O(V+E)O(V+E)O(V+E)

  20. 20
    During DFS, we label nodes with an increasing
    _____
    .
    Hint

    This is a unique number assigned to each node as it is explored.

    Answer

    ID

  21. 21
    The low link value of a node is defined as the smallest node ID reachable from that node including
    _____
    .
    Hint

    It starts as the node's own ID and may decrease.

    Answer

    itself

  22. 22
    DFS can be used to count connected components by starting a DFS at every node except if that node has already been
    _____
    .
    Hint

    We skip nodes that have already been assigned to a component.

    Answer

    visited

  23. 23
    DFS can be used to find bridges by checking if the ID of the node the edge comes from is less than the low link value of the node the edge goes to, which indicates a
    _____
    .
    Hint

    This condition means there is no back edge connecting the component to an earlier part.

    Answer

    bridge

  24. 24
    DFS can be extended to find articulation points, which are nodes whose removal increases the number of
    _____
    in the graph.
    Hint

    Think about the effect of removing that node on the graph's connectivity.

    Answer

    connected components

  25. 25
    The BFS algorithm explores nodes in
    _____
    .
    Hint

    It visits all nodes at the same distance before moving further.

    Answer

    layers

  26. 26
    BFS maintains a
    _____
    to track which node to visit next.
    Hint

    This data structure ensures first-in, first-out order.

    Answer

    queue

  27. 27
    BFS is particularly useful for finding the shortest path on an
    _____
    graph.
    Hint

    When all edges have equal cost, BFS finds the shortest path in terms of number of edges.

    Answer

    unweighted

  28. 28
    In BFS on a grid, we can use direction vectors for north, south, east, and
    _____
    .
    Hint

    The four cardinal directions cover all possible moves.

    Answer

    west

  29. 29
    In a grid, we need to check that the new coordinate is within bounds and not a
    _____
    cell.
    Hint

    This type of cell is impassable, like a wall.

    Answer

    rock

  30. 30
    A topological ordering is an ordering of nodes where for each edge from node AAA to BBB, node AAA appears
    _____
    node BBB.
    Hint

    The ordering respects the direction of edges.

    Answer

    before

  31. 31
    Graphs with directed cycles do not have a topological ordering because there is no place to
    _____
    .
    Hint

    Every node in a cycle depends on another, so there is no node without prerequisites.

    Answer

    start

  32. 32
    In topological sort using DFS, we add nodes to the ordering on the
    _____
    call.
    Hint

    This is when the DFS backtracks from a node.

    Answer

    recursive callback

  33. 33
    The shortest path on a DAG can be found in
    _____
    time.
    Hint

    This is faster than Dijkstra's algorithm on general graphs.

    Answer

    linear

  34. 34
    To find the longest path on a DAG, we can negate all edges and find the
    _____
    .
    Hint

    Negating transforms the problem into a shortest path problem.

    Answer

    shortest path

  35. 35
    Dijkstra's algorithm is a single source shortest path algorithm for graphs with
    _____
    edge weights.
    Hint

    This constraint ensures no negative cycles.

    Answer

    non-negative

  36. 36
    In the lazy implementation of Dijkstra, duplicate key-value pairs are inserted and later
    _____
    .
    Hint

    Outdated entries are skipped when popped from the priority queue.

    Answer

    ignored

  37. 37
    The eager implementation uses an
    _____
    priority queue to avoid duplicates.
    Hint

    This data structure supports key-value updates efficiently.

    Answer

    indexed

  38. 38
    Dijkstra's algorithm can stop early if the destination node has been
    _____
    .
    Hint

    Once a node is processed, its shortest distance is final.

    Answer

    visited

  39. 39
    With a D-ary heap, the optimal degree ddd is equal to the number of edges divided by the number of
    _____
    .
    Hint

    This balances insertion and removal operations.

    Answer

    nodes

  40. 40
    Bellman-Ford is used when the graph has
    _____
    edge weights.
    Hint

    Dijkstra cannot handle these.

    Answer

    negative

  41. 41
    Bellman-Ford relaxes each edge
    _____
    times.
    Hint

    This is the minimum number of iterations needed to propagate distances.

    Answer

    V−1V-1V−1

  42. 42
    To detect negative cycles, we run the algorithm a second time and mark nodes that can still be relaxed with the value
    _____
    .
    Hint

    This indicates that the distance can be improved indefinitely.

    Answer

    negative infinity

  43. 43
    A negative cycle is a cycle where the sum of edge weights is
    _____
    .
    Hint

    The total weight around the cycle is less than zero.

    Answer

    negative

  44. 44
    Floyd-Warshall is an
    _____
    -pairs shortest path algorithm.
    Hint

    It computes distances between every pair of nodes.

    Answer

    all

  45. 45
    It runs in time complexity $O(
    _____
    )$.
    Hint

    The algorithm uses three nested loops.

    Answer

    V3V^3V3

  46. 46
    It stores the shortest path between all pairs of nodes in a 2D
    _____
    matrix.
    Hint

    This matrix holds the optimal distances.

    Answer

    distance

  47. 47
    The recurrence for Floyd-Warshall updates the distance from iii to jjj by considering routing through node
    _____
    .
    Hint

    The outer loop iterates over this intermediate node.

    Answer

    kkk

  48. 48
    To reconstruct paths, we maintain a
    _____
    matrix.
    Hint

    This matrix stores the next node to go to from iii to jjj.

    Answer

    next

  49. 49
    A bridge is an edge whose removal increases the number of
    _____
    in the graph.
    Hint

    It disconnects the graph if removed.

    Answer

    connected components

  50. 50
    An articulation point is a node whose removal increases the number of
    _____
    .
    Hint

    It is a critical vertex for connectivity.

    Answer

    connected components

  51. 51
    Bridges can be found by checking if the ID of the node the edge starts at is less than the low link value of the node it ends at, indicating no alternative path back to the
    _____
    .
    Hint

    This means the edge is the only connection to that part of the graph.

    Answer

    start (or root)

  52. 52
    For a node to be an articulation point via a cycle, its ID must be equal to the low link value of a child, and it must have more than
    _____
    outgoing edges.
    Hint

    A single outgoing edge might not make it an articulation point.

    Answer

    one

  53. 53
    Tarjan's algorithm finds
    _____
    components in a directed graph.
    Hint

    These are self-contained cycles within the graph.

    Answer

    strongly connected

  54. 54
    It uses a stack to maintain valid nodes from which to update
    _____
    values.
    Hint

    These values help identify SCCs.

    Answer

    low link

  55. 55
    A node starts a strongly connected component if its ID is equal to its
    _____
    .
    Hint

    This condition indicates the root of an SCC.

    Answer

    low link value

  56. 56
    When a strongly connected component is found, all nodes in that component are popped from the
    _____
    .
    Hint

    They are removed from the stack as they form a complete SCC.

    Answer

    stack

  57. 57
    The Traveling Salesman Problem asks for the shortest route that visits each city exactly once and returns to the
    _____
    .
    Hint

    The tour must start and end at the same city.

    Answer

    origin (or starting city)

  58. 58
    The naive brute force approach runs in $O(
    _____
    )$ time.
    Hint

    It tries all permutations of cities.

    Answer

    n!n!n!

  59. 59
    The dynamic programming solution runs in $O(
    _____
    )$ time.
    Hint

    This involves subsets of cities.

    Answer

    n22nn^2 2^nn22n

  60. 60
    The dynamic programming state consists of the set of visited nodes and the index of the
    _____
    node.
    Hint

    This determines which city to extend the tour from.

    Answer

    last visited

  61. 61
    The set of visited nodes is represented as a
    _____
    integer.
    Hint

    It uses bits to indicate which nodes have been visited.

    Answer

    32-bit

  62. 62
    An Eulerian path visits every
    _____
    exactly once.
    Hint

    It uses each edge exactly once, not necessarily each vertex.

    Answer

    edge

  63. 63
    For an undirected graph to have an Eulerian circuit, every node must have
    _____
    degree.
    Hint

    This ensures you can enter and leave each node the same number of times.

    Answer

    even

  64. 64
    For a directed graph to have an Eulerian circuit, every node must have equal in-degree and
    _____
    .
    Hint

    The number of incoming edges must match the number of outgoing edges.

    Answer

    out-degree

  65. 65
    In a directed Eulerian path, at most one node has out-degree minus in-degree equal to one, and at most one node has in-degree minus out-degree equal to
    _____
    .
    Hint

    These are the start and end nodes of the path.

    Answer

    one

  66. 66
    The algorithm to find an Eulerian path uses a depth first search that continues while the current node has
    _____
    outgoing edges.
    Hint

    It explores all edges by repeatedly following unused edges.

    Answer

    unvisited

  67. 67
    A minimum spanning tree connects all nodes while minimizing total
    _____
    .
    Hint

    It seeks the cheapest set of edges to connect the graph.

    Answer

    edge cost

  68. 68
    Prim's algorithm is a
    _____
    algorithm that always selects the next best edge.
    Hint

    It makes locally optimal choices to achieve a global optimum.

    Answer

    greedy

  69. 69
    In the lazy implementation of Prim's, we use a priority queue to sort edges by
    _____
    .
    Hint

    The priority queue always gives the smallest edge.

    Answer

    minimum edge cost

  70. 70
    The eager implementation uses an indexed priority queue to track node-edge pairs and runs in $O(
    _____
    \log V)$.
    Hint

    The complexity depends on the number of edges.

    Answer

    EEE

  71. 71
    For dense graphs, representing the graph with an
    _____
    matrix may perform better.
    Hint

    This representation has fast edge lookups.

    Answer

    adjacency

  72. 72
    The maximum flow problem asks how much flow can be pushed from source to sink without exceeding edge
    _____
    .
    Hint

    Each edge has a limit on the amount of flow it can carry.

    Answer

    capacities

  73. 73
    The Ford-Fulkerson method repeatedly finds
    _____
    paths in the residual graph.
    Hint

    These paths allow increasing flow.

    Answer

    augmenting

  74. 74
    An augmenting path is a path from source to sink with positive
    _____
    capacity.
    Hint

    It uses edges that still have capacity left.

    Answer

    remaining

  75. 75
    The bottleneck value of an augmenting path is the smallest
    _____
    along the path.
    Hint

    This limits how much flow can be pushed.

    Answer

    edge capacity

  76. 76
    Edmonds-Karp uses
    _____
    first search to find the shortest augmenting path.
    Hint

    This ensures the path has the fewest edges.

    Answer

    breadth

  77. 77
    Capacity scaling pushes flow through larger edges first, using a parameter
    _____
    that decreases over time.
    Hint

    This threshold determines which edges are considered.

    Answer

    delta

  78. 78
    Dinic's algorithm uses a
    _____
    graph built via BFS and multiple DFS searches until a blocking flow is reached.
    Hint

    This graph guides edges toward the sink.

    Answer

    level

  79. 79
    In Dinic, a blocking flow is when no more augmenting paths exist in the current
    _____
    graph.
    Hint

    The level graph has been saturated.

    Answer

    level

  80. 80
    To find a maximum cardinality bipartite matching using max flow, we add a source and sink with edges of capacity
    _____
    .
    Hint

    Each node in the left and right sets can be matched at most once.

    Answer

    one

  81. 81
    Each edge from source to left nodes has capacity one to ensure each left node is matched at most
    _____
    .
    Hint

    It prevents multiple matches from the same left node.

    Answer

    once

  82. 82
    The maximum flow value equals the size of the maximum
    _____
    .
    Hint

    The flow through the middle edges represents matches.

    Answer

    matching

  83. 83
    In the mice and owls problem, we draw an edge between a mouse and a hole if the mouse can reach the hole within a radius
    _____
    .
    Hint

    This is the maximum distance a mouse can run.

    Answer

    rrr

  84. 84
    The elementary math problem can be reduced to a bipartite matching where left nodes are input pairs and right nodes are
    _____
    .
    Hint

    Each input pair can produce up to three possible answers.

    Answer

    answers (or results)

  85. 85
    To handle multiple repeated input pairs in the elementary math problem, we set the capacity from the source to the input pair node to the
    _____
    of that pair.
    Hint

    If a pair appears multiple times, it can be matched to multiple distinct answers.

    Answer

    frequency

1 of 85
Question 1 of 85

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent