Thanks for the tip about the Map class
How do I initialize the adjacencyList though? When I try to run clear() on the adjacencyList, it comes up saying " variable adjacencyList might not have been initialized"
Code:import java.io.*; import java.util.*; public class Primsmap { public static void main(String args[]) { // initiate new adjacencyList Map<Vertex, List<Edge>> adjacencyList; adjacencyList.clear(); } } class Edge{ // name of vertex Vertex to; // stores the weight int weight; } class Vertex{ // stores the name the vertex points to String name; }




Reply With Quote