'Return a hash of the entire spec DAG, including connectivity.'

def dag_hash(self, length=None):

    if self._hash:
        return self._hash[:length]
    else:
        yaml_text = syaml.dump(self.to_node_dict(), default_flow_style=True, width=maxint)
        sha = hashlib.sha1(yaml_text.encode('utf-8'))
        b32_hash = base64.b32encode(sha.digest()).lower()
        if (sys.version_info[0] >= 3):
            b32_hash = b32_hash.decode('utf-8')
        if self.concrete:
            self._hash = b32_hash
        return b32_hash[:length]
