Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 28.5, Problem 28.5.2CP
Program Plan Intro
Given scenario:
The object “graph1” is created for “GraphView” class in “TestGraph.java” is as follows:
GraphView view=new GraphView(graph1);
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Complete the implementation of the LinkedStack class by providing the definitions for the peek, size, isEmpty, and toString methods.
Awesome! the program is running perfectly! Lastly, instead of using a Hashmap, can this be done just using a LinkedList where the output should stay the same, but not using a Hashmap?
1- CREATE JAVA CODE TO BUILD A GRAPH ( import from file )?
2-PRINT THE TOPOLOGICAL ORDER CRILE
3- GIVEN A SOURCE NODE PRINT THE CONTENTS USING BREADTH FIRST AND DEPTH traversal ?
4- CHECK THE GRAPH IS CONNECTED OR NOT
5- PRINT THE ADJACENCY MATRIX FOR THE GRAPH
Chapter 28 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Ch. 28.2 - What is the famous Seven Bridges of Knigsberg...Ch. 28.2 - Prob. 28.2.2CPCh. 28.2 - Prob. 28.2.3CPCh. 28.2 - Prob. 28.2.4CPCh. 28.3 - Prob. 28.3.1CPCh. 28.3 - Prob. 28.3.2CPCh. 28.4 - Prob. 28.4.1CPCh. 28.4 - Prob. 28.4.2CPCh. 28.4 - Show the output of the following code: public...Ch. 28.4 - Prob. 28.4.4CP
Ch. 28.5 - Prob. 28.5.2CPCh. 28.6 - Prob. 28.6.1CPCh. 28.6 - Prob. 28.6.2CPCh. 28.7 - Prob. 28.7.1CPCh. 28.7 - Prob. 28.7.2CPCh. 28.7 - Prob. 28.7.3CPCh. 28.7 - Prob. 28.7.4CPCh. 28.7 - Prob. 28.7.5CPCh. 28.8 - Prob. 28.8.1CPCh. 28.8 - When you click the mouse inside a circle, does the...Ch. 28.8 - Prob. 28.8.3CPCh. 28.9 - Prob. 28.9.1CPCh. 28.9 - Prob. 28.9.2CPCh. 28.9 - Prob. 28.9.3CPCh. 28.9 - Prob. 28.9.4CPCh. 28.10 - Prob. 28.10.1CPCh. 28.10 - Prob. 28.10.2CPCh. 28.10 - Prob. 28.10.3CPCh. 28.10 - If lines 26 and 27 are swapped in Listing 28.13,...Ch. 28 - Prob. 28.1PECh. 28 - (Create a file for a graph) Modify Listing 28.2,...Ch. 28 - Prob. 28.3PECh. 28 - Prob. 28.4PECh. 28 - (Detect cycles) Define a new class named...Ch. 28 - Prob. 28.7PECh. 28 - Prob. 28.8PECh. 28 - Prob. 28.9PECh. 28 - Prob. 28.10PECh. 28 - (Revise Listing 28.14, NineTail.java) The program...Ch. 28 - (Variation of the nine tails problem) In the nine...Ch. 28 - (4 4 16 tails problem) Listing 28.14,...Ch. 28 - (4 4 16 tails analysis) The nine tails problem in...Ch. 28 - (4 4 16 tails GUI) Rewrite Programming Exercise...Ch. 28 - Prob. 28.16PECh. 28 - Prob. 28.17PECh. 28 - Prob. 28.19PECh. 28 - (Display a graph) Write a program that reads a...Ch. 28 - Prob. 28.21PECh. 28 - Prob. 28.22PECh. 28 - (Connected rectangles) Listing 28.10,...Ch. 28 - Prob. 28.24PECh. 28 - (Implement remove(V v)) Modify Listing 28.4,...Ch. 28 - (Implement remove(int u, int v)) Modify Listing...
Knowledge Booster
Similar questions
- Add comments to the code and display outputInt main(void)//Input array containing edges of the graph//(X,Y,W)tuple represents an edge from 'x' to y' having weight w'struct Edge edges I= {0,1,4.).(1,2,4).(2,0,4),(2,1,4)int n=size of (edges)/size of (edges|0]);struct Graph *graph=createGraph(edges,n);return 0; static int minsum=100000;static voidgetMinPathSum(Dictionary<int,ArrayList>graph,bool[visited,ArrayLinecessary,int source,int dest,int currsum)if(src==dest) bool flag=true;for each(int i in necessary)if(!visitedi])flag=false;break: if (flag )minsum=Math. Min(minsum,currsum);return;elselvisited[src]=true;for(auto node:graph[src]) if (Ivisited[node.first])visited [node.first])=true;getMinPathSum(graph, visited,necessary,node.first,dest,currsum+node.second);visited [node.first]=false;arrow_forwardWrite a full program to create this following linkedlist and display it, then display only the EVEN numbers. You need to write the classes and only 3 method to insert,display and display the even numbers. (in java)arrow_forwardIn the given java code, below, help with the two methods. public boolean connected() and public Graph kruskalMST() ? import java.util.*; public class Graph { static class Vertex implements Comparable<Vertex> { int value; Vertex(int val) { value = val; } public String toString() { return Integer.toString(value); } //This is not a great hashCode public int hashCode() { return value; } //Compare vertices…arrow_forward
- Write a program in the Java language that includes: 1. A class for books, taking into account the encapsulation and getter, setter. 2. Entering books by the user using Scanner 3. LinkedList class for: (Adding a new book - Inserting a book- Searching for a book using the ISBN Number - Viewing all books,delete book). 4. Serial number increases automatically with each book that is entered. 5. Printing the names of books is as follows: Serial - ISBN - Name - PubYear - Price - Notes. 6-Design a main menu that includes: • Add Book • Insert Book • Delete Book • Search . Display . Exitarrow_forwardWrite detailed java programming language code for hashmap. Take example of hashmap and give output screenshot with code.arrow_forwardImplement the following JavaScript function (SEE ATTACHED PHOTO FOR THE PROBLEM)arrow_forward
- The code using only the LinkedList doesn't produce the right output now, it gives this again. Refer to image The output should produce the amount made from the shares using only the LinkedList instead of the Hashmap.arrow_forwardPython. Given the code below (or a modified version of it) for gift wrapping/convex hull. Does anybody know how to make a GUI in tkinter where the user can add points by clicking the left mouse button, and remove points by clicking the right mouse button? Then the "graph"/"line" around the points will be updated class Point: def __init__(self, x, y): self.x = x self.y = y def Left_index(points): minn = 0 for i in range(1,len(points)): if points[i].x < points[minn].x: minn = i elif points[i].x == points[minn].x: if points[i].y > points[minn].y: minn = i return minn def orientation(p, q, r): val = (q.y - p.y) * (r.x - q.x) - \ (q.x - p.x) * (r.y - q.y) if val == 0: return 0 elif val > 0: return 1 else: return 2 def convexHull(points, n): if n < 3: return l = Left_index(points) hull = [] p = l q = 0 while(True): hull.append(p) q = (p + 1) % n for i in range(n): if(orientation(points[p], points[i], points[q]) == 2): q = i p = q if(p == l): break for each in hull:…arrow_forwardAdd a method to the Parking Office to return the collection of permit ids for a specific customer (getPermitIds(Customer)) I have already coded the permit id class, but I attached the class diagram for you to see. Current Java Code: package parkingsystem4;import java.util.LinkedList;import java.util.List; public class ParkingOffice { String name; String address; List<Car> cars = new LinkedList<Car>(); List<Customer> customers = new LinkedList<Customer>(); List<ParkingLot> lots = new LinkedList<ParkingLot>(); List<ParkingCharge> charges = new LinkedList<ParkingCharge>(); // Default constructor ParkingOffice(){ } // Parameterized constructor ParkingOffice(String name, String address, List<Car> parkedCars, List<ParkingLot> lots, List<ParkingCharge> charges){ this.name = name; this.address = address; this.cars = parkedCars; this.lots = lots;…arrow_forward
- Create a class MapTester (either in your current project or in a new project). In it, use a HashMap to implement a contacts list similar to the one in the example above. (Remember that you must import java.util.HashMap.) In this class, implement two methods: public void enterNumber(String name, String number) and public String lookupNumber(String name) The methods should use the put and get methods of the HashMap class to implement their functionality.arrow_forwardJava programming This class is going to be used to represent an individual node in our graph1. Create a new class in your project, called Vertex2. This class must have the following attributes:• vertexNumber, which is an integer• colour, which is an integer• adjacencies, which is a LinkedList containing Vertex objects. These are the Vertex objects that are connected to the current Vertex by an edge.3. It must also have a constructor that takes in an integer in order to set the vertexNumber property.4. Note that the edge here is unweighted and undirected. This means that an edge between vertex 2 and vertex 5 is equally an edge between vertex 5 and vertex 2.5. In addition to the constructor, the Vertex class must have the following methods:• addAdjacency - takes in a Vertex object and adds it to the adjacencies LinkedList• isAdjacent - takes in a Vertex object and returns true if the given Vertex is adjacent to thecurrent Vertex object, and false otherwise• getDegree - returns the degree…arrow_forwardin java processing , Given the number of edges “numEdge", implement a method which draws a green star on a black background with numEdge edges: void drawStar(int numEdge){ .....} note : ( write the code over here )arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- COMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE L
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L