(self, title=None, roi_state=None)
return fsm_graph
Generate a DOT graph with graphviz
        Args:
            roi_state (str): Optional, show only custom states and edges from roi_state
Generate a DOT graph with graphviz
        Args:
            roi_state (str): Optional, show only custom states and edges from roi_state
Generate a DOT graph with graphviz Args : roi_state ( str ) : Optional show only custom states and edges from roi_state
def generate(self, title=None, roi_state=None):
        """ Generate a DOT graph with graphviz
        Args:
            roi_state (str): Optional, show only custom states and edges from roi_state
        """
        if not pgv:  # pragma: no cover
            raise Exception('AGraph diagram requires graphviz')

        title = self.machine.title if not title else title

        fsm_graph = pgv.Digraph(name=title, node_attr=self.machine.style_attributes['node']['default'],
                                edge_attr=self.machine.style_attributes['edge']['default'],
                                graph_attr=self.machine.style_attributes['graph']['default'])
        fsm_graph.graph_attr.update(**self.machine.machine_attributes)
        fsm_graph.graph_attr['label'] = title
        # For each state, draw a circle
        states, transitions = self._get_elements()
        if roi_state:
            transitions = [t for t in transitions
                           if t['source'] == roi_state or self.custom_styles['edge'][t['source']][t['dest']]]
            state_names = [t for trans in transitions
                           for t in [trans['source'], trans.get('dest', trans['source'])]]
            state_names += [k for k, style in self.custom_styles['node'].items() if style]
            states = _filter_states(states, state_names, self.machine.state_cls)
        self._add_nodes(states, fsm_graph)
        self._add_edges(transitions, fsm_graph)
        setattr(fsm_graph, 'draw', partial(self.draw, fsm_graph))
        return fsm_graph
def generate ( self , title = None , roi_state = None ) : if not pgv : # pragma: no cover raise Exception ( 'AGraph diagram requires graphviz' ) title = self . machine . title if not title else title fsm_graph = pgv . Digraph ( name = title , node_attr = self . machine . style_attributes [ 'node' ] [ 'default' ] , edge_attr = self . machine . style_attributes [ 'edge' ] [ 'default' ] , graph_attr = self . machine . style_attributes [ 'graph' ] [ 'default' ] ) fsm_graph . graph_attr . update ( * * self . machine . machine_attributes ) fsm_graph . graph_attr [ 'label' ] = title # For each state, draw a circle states , transitions = self . _get_elements ( ) if roi_state : transitions = [ t for t in transitions if t [ 'source' ] == roi_state or self . custom_styles [ 'edge' ] [ t [ 'source' ] ] [ t [ 'dest' ] ] ] state_names = [ t for trans in transitions for t in [ trans [ 'source' ] , trans . get ( 'dest' , trans [ 'source' ] ) ] ] state_names += [ k for k , style in self . custom_styles [ 'node' ] . items ( ) if style ] states = _filter_states ( states , state_names , self . machine . state_cls ) self . _add_nodes ( states , fsm_graph ) self . _add_edges ( transitions , fsm_graph ) setattr ( fsm_graph , 'draw' , partial ( self . draw , fsm_graph ) ) return fsm_graph