Exemplo n.º 1
0
    def to_digraph(self):
        """Converts this node + its children into a ordered directed graph.

        The graph returned will have the same structure as the
        this node and its children (and tree node metadata will be translated
        into graph node metadata).

        :returns: a directed graph
        :rtype: :py:class:`taskflow.types.graph.OrderedDiGraph`
        """
        g = graph.OrderedDiGraph()
        for node in self.bfs_iter(include_self=True, right_to_left=True):
            g.add_node(node.item, attr_dict=node.metadata)
            if node is not self:
                g.add_edge(node.parent.item, node.item)
        return g
Exemplo n.º 2
0
 def __init__(self, name, retry=None):
     super(Flow, self).__init__(name, retry)
     self._graph = gr.OrderedDiGraph(name=name)
     self._last_item = self._no_last_item