function getTopMostNodes(nodes) {
		var nodesMap = {};

		for (var i = 0; i < nodes.length; i++) {
			nodesMap[nodes[i].id()] = true;
		}

		var roots = nodes.filter(function (ele, i) {
            if(typeof ele === "number") {
              ele = i;
            }
            
			var parent = ele.parent()[0];
			while (parent != null) {
				if (nodesMap[parent.id()]) {
					return false;
				}
				parent = parent.parent()[0];
			}
			return true;
		});

		return roots;
	}
Find geometric alignment lines and draw them
@param type: horizontal or vertical
@param node: the node to be aligned