public SymbolGraph(String name, String delimiter) {
		Scanner scn = null;
		try {
			scn = new Scanner(new File(name));
			st = new ST<String, Integer>();

			// reading the distinct vertices in ST
			while (scn.hasNextLine()) {
				String line = scn.nextLine();
				String[] words = line.split(delimiter);
				for(String w: words) {
					if(!st.contains(w))
						st.put(w, st.size());
				}
			}
			scn.close();
			
			// creating inverted index
			keys = new String[st.size()];
			for (String k: st.keys()) {
				keys[st.get(k)] = k;
			}
			
			//second pass to create a graph
			scn = new Scanner(new File(name));
			G = new Graph(st.size());
			while (scn.hasNextLine()) {
				String line = scn.nextLine();
				String[] words = line.split(delimiter);
				int v = st.get(words[0]);
				for (int i = 0; i < words.length; i++) {
					G.addEdge(v, st.get(words[i]));
				}
			}

		} catch (Exception e) {
			e.printStackTrace();
		}	
	}