public StringGraph(String filename, String delim)
	{
		In in = new In(filename);

		// Create the index
		st = new HashMap<String, Integer>();
		while (in.hasNextLine())
		{
			StringTokenizer tokenizer = new StringTokenizer(in.readLine(), delim);
			while (tokenizer.hasMoreTokens())
			{
				String s = tokenizer.nextToken();
				if (!contains(s))
					st.put(s, st.size());
			}
		}

		// Create the reverse index
		keys = new String[st.size()];
		for (String name : st.keySet())
			keys[st.get(name)] = name;

		// Create the graph
		G = new Graph(st.size());
		in = new In(filename);
		while (in.hasNextLine())
		{
			String names[] = in.readLine().split(delim);
			for (int i = 1; i < names.length; i++)
				try
				{
					G.addEdge(st.get(names[0]), st.get(names[i]));
				}
				catch (Exception e)
				{
					System.out.println(e);
					System.exit(1);
				}
		}

	}