adplus-dvertising
frame-decoration

Question

Complete the given snippet of code for the adjacency list representation of a weighted directed graph.
class neighbor
        {
  int vertex, weight;
  ____ next;
 }
 
 class vertex
        {
  string name;
  _____ adjlist;
 }
 
 vertex adjlists[101];

a.

vertex, vertex

b.

neighbor, vertex

c.

neighbor, neighbor

d.

vertex, neighbor

Answer: (c).neighbor, neighbor

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Complete the given snippet of code for the adjacency list representation of a weighted directed graph.

Similar Questions

Discover Related MCQs

Q. In which case adjacency list is preferred in front of an adjacency matrix?

Q. To create an adjacency list C++’s map container can be used.

Q. Given a plane graph, G having 2 connected component, having 6 vertices, 7 edges and 4 regions. What will be the number of connected components?

Q. Number of vertices with odd degrees in a graph having a eulerian walk is ________

Q. How many of the following statements are correct?
i) All cyclic graphs are complete graphs.

ii) All complete graphs are cyclic graphs.

iii) All paths are bipartite.

iv) All cyclic graphs are bipartite.

v) There are cyclic graphs which are complete.

Q. All paths and cyclic graphs are bipartite graphs.

Q. What is the number of vertices of degree 2 in a path graph having n vertices,here n>2.

Q. All trees with n vertices consists of n-1 edges.

Q. What would the time complexity to check if an undirected graph with V vertices and E edges is Bipartite or not given its adjacency matrix?

Q. Dijkstra’s Algorithm will work for both negative and positive weights?

Q. A graph having an edge from each vertex to every other vertex is called a ___________

Q. What is the number of unlabeled simple directed graph that can be made with 1 or 2 vertices?

Q. Floyd Warshall Algorithm used to solve the shortest path problem has a time complexity of __________

Q. All Graphs have unique representation on paper.

Q. Assuming value of every weight to be greater than 10, in which of the following cases the shortest path of a directed weighted graph from 2 vertices u and v will never change?

Q. What is the maximum possible number of edges in a directed graph with no self loops having 8 vertices?

Q. What is the maximum number of edges present in a simple directed graph with 7 vertices if there exists no cycles in the graph?

Q. Every Directed Acyclic Graph has at least one sink vertex.

Q. With V(greater than 1) vertices, how many edges at most can a Directed Acyclic Graph possess?

Q. The topological sorting of any DAG can be done in ________ time.