public String toDSLText() {
		StringBuilder graphText = new StringBuilder();
		List<Node> unvisitedNodes = new ArrayList<>();
		List<Link> unfollowedLinks = new ArrayList<>();
		unvisitedNodes.addAll(nodes);
		unfollowedLinks.addAll(links);

		Node start = findNodeByName("START");
		unvisitedNodes.remove(start);
		Node end = findNodeByName("END");
		unvisitedNodes.remove(end);
		Node fail = findNodeByName("FAIL");
		if (fail != null) {
			unvisitedNodes.remove(fail);
		}
		if (start == null || end == null) {
			throw new IllegalStateException("Graph is malformed - problems finding START and END nodes");
		}

		List<Link> toFollow = findLinksFrom(start, false);
		// This will build the main part of the DSL text based on walking the graph
		followLinks(graphText, toFollow, null, unvisitedNodes, unfollowedLinks);

		// This will follow up any loose ends that were not reachable down the regular path
		// from the START node (eg. reachable only by transition).
		// For example: aa | foo=bb | '*' = cc || bb || cc
		// There is no implied link from aa to bb because aa is mapping the exit space
		// so there is no implied transition 'COMPLETED=bb'. bb can only be reached via
		// transition. For that case unvisitedNodes here will contain bb
		if (unvisitedNodes.size() != 0) {
			int loopCount = 0;
			while (unvisitedNodes.size() != 0 && loopCount < 10000) {
				Node nextHead = findAHead(unvisitedNodes, unfollowedLinks);
				unvisitedNodes.remove(nextHead);
				toFollow = findLinksFrom(nextHead, false);
				// If the new head we find has no links to anything, we don't need to mention it in the DSL.
				// Transitions will refer to it and it will get a step in the XML but there is no need
				// to explicitly mention in the DSL. This might change once the job references support properties.
				if (toFollow.size() != 0) {
					graphText.append(" || ");
					printNode(graphText, nextHead, unvisitedNodes);
					followLinks(graphText, toFollow, null, unvisitedNodes, unfollowedLinks);
				}
				loopCount++; // Just a guard on malformed input - a good graph will not trigger this
			}
		}

		if (properties != null) {
			for (Map.Entry<String, String> property : properties.entrySet()) {
				graphText.append(" --").append(property.getKey()).append("=").append(property.getValue());
			}
		}

		return graphText.toString();
	}
Produce the DSL representation of the graph.
To make this process easier we can assume there is a START and an END node.

@return DSL string version of the graph
spring-xd-dirt/src/main/java/org/springframework/xd/dirt/job/dsl/Graph.java