public static List<String> topologicalSort(Graph graph)
	{
		if(!graph.getDirected())
			throw new UnsupportedOperationException();
		
		ConcurrentLinkedQueue<Vertex> q = new ConcurrentLinkedQueue<Vertex>();
		List<String> result = new LinkedList<String>();
		
		for(Vertex v : graph.getVertices().values()){
			if(v.getInDegree() == 0)
				q.add(v);
		}
		
		while(q.size() != 0){
			Vertex n = q.remove();
			if(n.getVisited())
				throw new UnsupportedOperationException();
			result.add(n.getName());
			for(Edge mark : n.getEdges()){
				mark.getOtherVertex().decInDegree();
				if(mark.getOtherVertex().getInDegree() == 0)
					q.add(mark.getOtherVertex());
			}
			n.setVisited(true);
			
		}

		if(result.size() != graph.getVertices().size())
			throw new UnsupportedOperationException();
		return result;
	}