Breaks the nodes into layers by grouping the nodes together based on
        their connection scheme.
        
        :param      nodes | [<XNode>, ..]

def generateLayers(self, scene, nodes, connections):
        """
        Breaks the nodes into layers by grouping the nodes together based on
        their connection scheme.
        
        :param      nodes | [<XNode>, ..]
        """
        depth = {}
        for node in nodes:
            depth[node] = (self.calculateDepth(node, connections),
                           len(connections[node][0]))
        
        ordered = depth.keys()
        ordered.sort(key=lambda x: depth[x])
        
        layers = {}
        processed = []
        for node in ordered:
            self.collectLayer(node, connections, layers, recurse=processed)
        
        return [v for _, v in sorted(layers.items())]