public void compute(HashMap<MessageGid, LogRecord> comp)
	{
		DirectedAcyclicGraph<LogRecord, DefaultEdge> comp_dag = new DirectedAcyclicGraph<>(DefaultEdge.class);

		LogRecord outer_log_record = null;
		LogRecord inner_log_record = null;

		/**
		 * Check each pair of log records in comp and construct a dag for them
		 */
		for (Map.Entry<MessageGid, LogRecord> outer_mid_logrecord_entry : comp.entrySet())
		{
			outer_log_record = outer_mid_logrecord_entry.getValue();

			for (Map.Entry<MessageGid, LogRecord> inner_mid_logrecord_entry: comp.entrySet())
			{
				inner_log_record = inner_mid_logrecord_entry.getValue();

				if (outer_log_record != inner_log_record
						&& outer_log_record.getTs().compareTo(inner_log_record.getPrev()) <= 0)
					try
					{
						comp_dag.addDagEdge(outer_log_record, inner_log_record);
					} catch (CycleFoundException cfe)
					{
						cfe.printStackTrace();
					}
			}
		}

		/**
		 * Apply all the {@link UpdateMessage} in topological order such that
		 * record r is earlier than record s if r.ts <= s.prev.
		 */
		Iterator<LogRecord> comp_iter = comp_dag.iterator();
		LogRecord log_record = null;
		MessageGid umid = null;

		while (comp_iter.hasNext())
		{
			log_record = (LogRecord) comp_iter.next();
			umid = log_record.getUmid();

			if (! Replica.INSTANCE.getInval().contains(umid))
			{
				System.out.println("----- Applying log record: " + log_record.toString() + " -----");
				// val = apply(val, r.op);
				Replica.INSTANCE.getInval().addUmid(umid);
				
				// delete from waiting queue
				Replica.INSTANCE.removeUpdateMessage(log_record.getUpdateMessage());
				
				// TODO: for experiment: delete deps
				Replica.INSTANCE.removeDepsOn(umid);
			}

			Replica.INSTANCE.getValTs().merge(log_record.getTs());
		}
	}