FAQ for Assignment 3 ====================== Q. CAN I MODIFY A3Program.java? A. No. --- Q. HOW CAN I ENTER DATA THROUGH THE KEYBOARD? A. You execute the program without using input file redirection (i.e., "java A3Application > myGraph.dot"), simply type in your data, and when you are done enter your computer system's end-of-file character (on Mac's and Unix/Linux this is cntrl-D and on Windows is cntrl-C). --- Q. IS AN Edge OBJECT ALLOWED TO HAVE THE SAME NODE AS BOTH ITS SOURCE NODE AND ITS TARGET NODE? A. Yes, a node can have a directed edge to itself. --- Q. WHAT SHOULD HAPPEN WHEN A USER TRIES TO ENTER A NEW EDGE OR NEW NODE WHEN ITS RESPECTIVE SET (e.g., EdgeSet) IS FULL? A. This assignment will not test for this condition, so you don't have to worry about this. --- Q. IF AN ODD NUMBER OF NODES ARE ENTERED AS INPUT, SHOULD THE LAST NODE BE INCLUDED IN THE TOTAL # OF NODES? A. No. --- Q. WHAT IS THE DIFFERENCE BETWEEN THE Graph.getNodeCount() METHOD AND THE NodeSet.length() METHOD? A. The difference is at the conceptual level, not at the implementation level. Graphs are more than simply a set of nodes. We can't talk about the "length" of a graph, but can talk about the number of nodes in a graph. We can talk about the number of nodes in a set of nodes but it seemed more consistent with the standard Java conventions (e.g., length of strings, arrays, etc.) to talk about the "length" of set. However, at the implementation level, I don't see a difference, Graph.getNodeCount() calls NodeSet.length() to find out how many nodes are in the graph. All this is true similarly for Graph.getEdgeCount() and NodeSet.length(). --- Q. THERE IS A METHOD Node.equals(Node other) BUT NO MENTION OF IT IN A3Program. WHY IS THAT AND WHAT IS IT SUPPOSED TO DO? A. Node.equals(Node other) has to be in the API even though it's not used by A3Program because it is used by NodeSet.addNode(Node) (if it wasn't a public method then NodeSet.addNode(Node) couldn't use it and all public methods should be in the API). What X.equals(X other) does for any class X is to implement a method for determining when two instances of X should be considered the same, even though they are not the same object (we see this in String all the time). --- Q. WHAT ARE THE toString() METHODS SUPPOSED TO DO? IN PARTICULAR, WHAT DOES THE Edge.toString() METHOD DO? A. X.toString() is supposed to create strings that represent instances of the X class in a sensible way. What is sensible depends on the class X. For example, what is a sensible way to represent an edge? One way that seems sensible, especially given this assignment, is for an edge connecting nodes x and y to be printed out as "x -> y". Then EdgeSet.toString() can call Edge.toString() for each edge in the EdgeSet.