@staticmethod
def _add_to_graph(graph, init, list):
    """
            add a list of microcodes to a graph. The init node is duplicated as needed
            (because it may be used many times and mess up the diagram. It hurts to have
            very long edges like that.

        """
    source = {}
    dest = {}
    sans = {}
    for vn in init:
        source[vn] = '#INIT'
        dest[vn] = '#OUT'
    for i, record in enumerate(list):
        microcode, kwargs = record[0], record[1]
        graph.node(str(i) + str(id(microcode)), label=microcode.to_label(
            kwargs, html=True))
        for an in microcode.ain:
            vn = kwargs.get(an, an)
            from_init = []
            if vn in source:
                if vn == '':
                    continue
                if source[vn] == '#INIT':
                    from_init.append(vn)
                else:
                    san = sans[vn]
                    dan = an
                    attrs = {}
                    if san != vn:
                        attrs['taillabel'] = san + ':'
                    if dan != vn:
                        attrs['headlabel'] = ':' + dan
                    attrs['label'] = vn
                    graph.edge(source[vn], str(i) + str(id(microcode)), **attrs
                        )
                dest[vn] = str(i) + str(id(microcode))
            if len(from_init) > 0:
                graph.node(str(i) + '#INIT', label='<<b>#</b>>')
                for vn in from_init:
                    graph.edge(str(i) + '#INIT', str(i) + str(id(microcode)
                        ), label=vn)
        for an in microcode.aout:
            vn = kwargs.get(an, an)
            source[vn] = str(i) + str(id(microcode))
            sans[vn] = an
            dest[vn] = '#OUT'
    for vn, node in dest.items():
        if node != '#OUT':
            continue
        graph.node(source[vn] + '#OUT', label='<<b>#</b>>')
        graph.edge(source[vn], source[vn] + '#OUT', label=vn)
