Solutions not posted because we will continue to work on this problem outside lab
yEd is a tool for creating, importing, and sharing graphs.
Download yEd to your computer in lab, and on your own computer.
Today, we will start writing an
We'll use yEd to create graphs and then save these graphs as .tgf files.
class will interact with .tgf files.
Below is a snapshot of yEd with a graph with 4 nodes and various edges.
Follow these steps to get a feel for how yEd works.
Start yEd. Click on the
New Document icon.
Shape Nodespalette to the main window.
AdjListsGraph class will interact with
files in two ways:
Start by drawing a simple graph, like the one below, and filling in the Data Structures that are needed to represent it.
lab9folder. It contains the
AdjListsGraphclass, to implement the Graph interface.
verticesto hold the vertices, and
arcs. Each LinkedList will hold the set of adjacent vertices to a certain vertex, according to the Adjacent Lists Graph implementation.
constructorwith no inputs, to create an empty graph, and test it right away.
toString()method so that it returns a reasonable String representation of a graph. For the graph earlier, it should return something like this:
Vertices: [A, B, C, D] Edges: from A: [B, C] from B:  from C: [B] from D: 
toString()method with an empty graph.
saveToTGF()method, to save the invoking graph to the input file, in the
public boolean isEmpty() // returns true iff a graph is empty
public int getNumVertices() // returns the number of vertices in a graph
public int getNumArcs() // returns the number of arcs in a graph
Now work on adding and deleting a vertex . As always, make sure you test your code very often!
Continue with the rest of the methods in the
Graph Interface, as time permits.