@classmethod<EOL><INDENT>@transaction.atomic<EOL>def factory(cls, data_class, **kwargs):<DEDENT>
if not issubclass(data_class, BaseNodeData):<EOL><INDENT>raise AttributeError('<STR_LIT>')<EOL><DEDENT>content_type = ContentType.objects.get_for_model(data_class)<EOL>graph = DCCGraph.objects.create(data_content_type=content_type)<EOL>node = Node.objects.create(graph=graph)<EOL>data_class.objects.create(node=node, **kwargs)<EOL>graph.root = node<EOL>graph.save()<EOL>return graph<EOL>
Creates a ``DCCGraph``, a root :class:`Node`: and the node's
        associated data class instance.  This factory is used to get around
        the chicken-and-egg problem of the ``DCCGraph`` and ``Nodes`` within
        it having pointers to each other.

        :param data_class: 
            django model class that extends :class:`BaseNodeData` and is used
            to associate information with the nodes in this graph
        :param kwargs: 
            arguments to pass to constructor of the data class instance that
            is to be created for the root node
        :returns: 
            instance of the newly created ``DCCGraph``