In the following code to add an edge in the LinkedDirectedGraph class, what is the missing code?
def addEdge(self, fromLabel, toLabel, weight): fromVertex = self.getVertex(fromLabel) fromVertex.addEdgeTo(toVertex, weight) self.edgeCount += 1

A. self.getVertex(toLabel) = fromVertex
B. fromVertex.addEdgeTo(fromVertex, weight)
C. self.weight += 1
D. toVertex = self.getVertex(toLabel)


Answer: D

Computer Science & Information Technology

You might also like to view...

When you start Access, which of the following options are available?

A. create a new database only B. save a database C. open an existing database only D. create a new database or open an existing one

Computer Science & Information Technology

What is a postfix notation?

a. It's a notation used to write arithmetic operations, where the operator is written after the operands. b. It's a notation used to write arithmetic operations, where the operator is written before the operands. c. It's a notation used to write arithmetic operations, where the operator is written between the operands. d. It's a notation used to express algorithm complexity.

Computer Science & Information Technology

A meter reading for a good cable wire shows

A) 0 ohms B) 0 volts C) Infinite ohms D) Infinite volts

Computer Science & Information Technology

Trigger ______ defines which trigger fires when an object within a form object contains the same trigger that the form object contains.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology