public List<List<String>> checkCycle() {
		List<String> erdRel = new ArrayList<String>();
		erdRel.addAll(relationshipTypes.keySet());
		for (int i = 0; i < erdRel.size() - 1; i++) {
			String s = erdRel.get(i);
			for (int j = i + 1; j < erdRel.size(); j++) {
				String curr = erdRel.get(j);
				List<String> cycleToBeSplit = isMatch(
						relationshipTypes.get(s).getLinks(), relationshipTypes
								.get(curr).getLinks());
				if (cycleToBeSplit != null) {
					boolean dependsOnRoot = true;
					String doNotSplit = null;
					for (int z = 0; z < cycleToBeSplit.size(); z++) {
						// if there is one entity linked to other relationships,
						// split all other entity but keep this one
						if (entityTypes.get(cycleToBeSplit.get(z)).getLinks().size() > 2) {
							doNotSplit = cycleToBeSplit.get(z);
							dependsOnRoot = false;
							break;
						}
					}
					
					if (dependsOnRoot == true) {
						cycles.add(cycleToBeSplit);
					} else {
						List<String> notARoot = new ArrayList<String>();
						notARoot.add("0");
						notARoot.add(doNotSplit);
						// put everything else in the
						for (int z = 0; z < cycleToBeSplit.size(); z++) {
							String e = cycleToBeSplit.get(z);
							if (!e.equals(doNotSplit)) {		
								notARoot.add(e);
							}
						}
						cycles.add(notARoot);
					}
					List<String> relInCycle = new ArrayList<String>();
					relInCycle.add(s);
					relInCycle.add(curr);
					relationshipInCycle.add(relInCycle);
				}
					
					/*String e1 = cycleToBeSplit.get(0);
					String e2 = cycleToBeSplit.get(1);
					int sizeE1 = entityTypes.get(e1).getLinks().size();
					int sizeE2 = entityTypes.get(e2).getLinks().size();
					if (sizeE1 > 2 && sizeE2 == 2) {
						//split E2
						setEntityToBeSplitted(e2, -1);
						List<String> notARoot = new ArrayList<String>();
						notARoot.add(e2);
						cycles.add(notARoot);
					} else if (sizeE1 == 2 && sizeE2 > 2) {
						//split E1
						setEntityToBeSplitted(e1, -1);
						List<String> notARoot = new ArrayList<String>();
						notARoot.add(e1);
						cycles.add(notARoot);
					} else {
						// if both does not have links
						cycles.add(cycleToBeSplit);
						List<String> relInCycle = new ArrayList<String>();
						relInCycle.add(s);
						relInCycle.add(curr);
						relationshipInCycle.add(relInCycle);
					}*/
				
			}
		}
		return cycles;
	}