Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the constructors in Table 10.1 TABLE 10.1The Edge Class Data Field Attribute private int dest The destination vertex for an edge private int source

Use the constructors in Table 10.1

TABLE 10.1The Edge Class

Data Field Attribute
private int dest The destination vertex for an edge
private int source The source vertex for an edge
private double weight The weight
Constructor Purpose
public Edge(int source, int dest) Constructs an Edge from source to dest. Sets the weight to 1.0
public Edge(int source, int dest, double w) Constructs an Edge from source to dest. Sets the weight to w
Method Behavior
public boolean equals(Object o) Compares two edges for equality. Edges are equal if their source and destination vertices are the same. The weight is not considered
public int getDest() Returns the destination vertex
public int getSource() Returns the source vertex
public double getWeight() Returns the weight
public int hashCode() Returns the hash code for an edge. The hash code depends only on the source and destination
public String toString() Returns a string representation of the edge

to create the Edge objects connecting vertices 9 through 12 for the graph in Figure 10.8.

FIGURE 10.8 Example of an Unconnected Graph

image text in transcribed

Document the breadth-first search trees

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

Students also viewed these Databases questions