def generate_graph(self, rule_links, out_file):
        graph_label = 'Rule based visualizer'

        graph_attr = {
            'rankdir': 'TD',
            'labelloc': 't',
            'fontsize': '15',
            'label': graph_label
        }
        node_attr = {}
        dot = Digraph(comment='Rule based links visualization',
                      node_attr=node_attr, graph_attr=graph_attr, format='png')

        nodes = sets.Set()
        for _, rule_link in rule_links:
            print rule_link._source_action_ref
            if rule_link._source_action_ref not in nodes:
                nodes.add(rule_link._source_action_ref)
                dot.node(rule_link._source_action_ref, rule_link._source_action_ref)
            if rule_link._dest_action_ref not in nodes:
                nodes.add(rule_link._dest_action_ref)
                dot.node(rule_link._dest_action_ref, rule_link._dest_action_ref)
            dot.edge(rule_link._source_action_ref, rule_link._dest_action_ref, constraint='true',
                     label=rule_link._rule_ref)
        output_path = os.path.join(os.getcwd(), out_file)
        dot.format = 'png'
        dot.render(output_path)
dataset/ETHPy150Open StackStorm/st2/tools/st2-analyze-links.py/Grapher.generate_graph/original