Weighted Graphs

Description: This quiz will test your understanding of weighted graphs, including concepts such as weighted edges, adjacency matrices, and shortest paths.
Number of Questions: 14
Created by:
Tags: weighted graphs graph theory shortest paths
Attempted 0/14 Correct 0 Score 0

What is a weighted graph?

  1. A graph in which each edge has a numerical value associated with it.

  2. A graph in which each vertex has a numerical value associated with it.

  3. A graph in which each edge has a color associated with it.

  4. A graph in which each vertex has a color associated with it.


Correct Option: A
Explanation:

A weighted graph is a graph in which each edge has a numerical value associated with it, called the weight of the edge.

What is an adjacency matrix?

  1. A matrix that represents the edges of a graph.

  2. A matrix that represents the vertices of a graph.

  3. A matrix that represents the weights of the edges of a graph.

  4. A matrix that represents the degrees of the vertices of a graph.


Correct Option: A
Explanation:

An adjacency matrix is a matrix that represents the edges of a graph, where the rows and columns correspond to the vertices of the graph and the entries in the matrix represent the weights of the edges between the vertices.

What is a shortest path?

  1. A path between two vertices in a graph with the smallest total weight.

  2. A path between two vertices in a graph with the largest total weight.

  3. A path between two vertices in a graph with the smallest number of edges.

  4. A path between two vertices in a graph with the largest number of edges.


Correct Option: A
Explanation:

A shortest path is a path between two vertices in a graph with the smallest total weight.

Which algorithm is used to find the shortest path between two vertices in a weighted graph?

  1. Dijkstra's algorithm

  2. Prim's algorithm

  3. Kruskal's algorithm

  4. Floyd-Warshall algorithm


Correct Option: A
Explanation:

Dijkstra's algorithm is used to find the shortest path between two vertices in a weighted graph.

What is the time complexity of Dijkstra's algorithm?

  1. O(V^2)

  2. O(E log V)

  3. O(V log V)

  4. O(E)


Correct Option: B
Explanation:

The time complexity of Dijkstra's algorithm is O(E log V), where V is the number of vertices and E is the number of edges in the graph.

Which algorithm is used to find the minimum spanning tree of a weighted graph?

  1. Dijkstra's algorithm

  2. Prim's algorithm

  3. Kruskal's algorithm

  4. Floyd-Warshall algorithm


Correct Option: B
Explanation:

Prim's algorithm is used to find the minimum spanning tree of a weighted graph.

What is the time complexity of Prim's algorithm?

  1. O(V^2)

  2. O(E log V)

  3. O(V log V)

  4. O(E)


Correct Option: B
Explanation:

The time complexity of Prim's algorithm is O(E log V), where V is the number of vertices and E is the number of edges in the graph.

Which algorithm is used to find the all-pairs shortest paths in a weighted graph?

  1. Dijkstra's algorithm

  2. Prim's algorithm

  3. Kruskal's algorithm

  4. Floyd-Warshall algorithm


Correct Option: D
Explanation:

Floyd-Warshall algorithm is used to find the all-pairs shortest paths in a weighted graph.

What is the time complexity of Floyd-Warshall algorithm?

  1. O(V^2)

  2. O(E log V)

  3. O(V log V)

  4. O(E)


Correct Option:
Explanation:

The time complexity of Floyd-Warshall algorithm is O(V^3), where V is the number of vertices in the graph.

What is the difference between a weighted graph and an unweighted graph?

  1. In a weighted graph, each edge has a numerical value associated with it, while in an unweighted graph, each edge has a weight of 1.

  2. In a weighted graph, each vertex has a numerical value associated with it, while in an unweighted graph, each vertex has a weight of 1.

  3. In a weighted graph, each edge has a color associated with it, while in an unweighted graph, each edge has a color of black.

  4. In a weighted graph, each vertex has a color associated with it, while in an unweighted graph, each vertex has a color of black.


Correct Option: A
Explanation:

The difference between a weighted graph and an unweighted graph is that in a weighted graph, each edge has a numerical value associated with it, while in an unweighted graph, each edge has a weight of 1.

What is the difference between a directed weighted graph and an undirected weighted graph?

  1. In a directed weighted graph, the edges have a direction, while in an undirected weighted graph, the edges do not have a direction.

  2. In a directed weighted graph, the vertices have a direction, while in an undirected weighted graph, the vertices do not have a direction.

  3. In a directed weighted graph, the edges have a color, while in an undirected weighted graph, the edges do not have a color.

  4. In a directed weighted graph, the vertices have a color, while in an undirected weighted graph, the vertices do not have a color.


Correct Option: A
Explanation:

The difference between a directed weighted graph and an undirected weighted graph is that in a directed weighted graph, the edges have a direction, while in an undirected weighted graph, the edges do not have a direction.

What is the difference between a simple weighted graph and a multigraph?

  1. In a simple weighted graph, each pair of vertices is connected by at most one edge, while in a multigraph, each pair of vertices can be connected by multiple edges.

  2. In a simple weighted graph, each vertex has a degree of at most 1, while in a multigraph, each vertex can have a degree greater than 1.

  3. In a simple weighted graph, each edge has a weight of 1, while in a multigraph, each edge can have a different weight.

  4. In a simple weighted graph, each vertex has a color, while in a multigraph, each vertex can have a different color.


Correct Option: A
Explanation:

The difference between a simple weighted graph and a multigraph is that in a simple weighted graph, each pair of vertices is connected by at most one edge, while in a multigraph, each pair of vertices can be connected by multiple edges.

What is the difference between a weighted graph and a network?

  1. In a weighted graph, the edges have weights, while in a network, the edges have capacities.

  2. In a weighted graph, the vertices have weights, while in a network, the vertices have capacities.

  3. In a weighted graph, the edges have colors, while in a network, the edges have labels.

  4. In a weighted graph, the vertices have colors, while in a network, the vertices have labels.


Correct Option: A
Explanation:

The difference between a weighted graph and a network is that in a weighted graph, the edges have weights, while in a network, the edges have capacities.

What is the difference between a weighted graph and a matroid?

  1. In a weighted graph, the edges have weights, while in a matroid, the edges have ranks.

  2. In a weighted graph, the vertices have weights, while in a matroid, the vertices have ranks.

  3. In a weighted graph, the edges have colors, while in a matroid, the edges have labels.

  4. In a weighted graph, the vertices have colors, while in a matroid, the vertices have labels.


Correct Option: A
Explanation:

The difference between a weighted graph and a matroid is that in a weighted graph, the edges have weights, while in a matroid, the edges have ranks.

- Hide questions