def serialize(VE, name="G", **kw):
    highattr = ',color=red,fontcolor=red,style=filled,fillcolor="#ffeeee"'
    highlight = kw.get('highlight') or []
    V, E = VE[:2]

    s = "digraph \"%s\" {\n" % (name,)

    for v in sorted(V.values()):
        x = highattr if v[0] in highlight else ''
        s += "  \"%s\" [label=\"%s\"%s];\n" % (
            v[0], (v[1] or '').replace('\n', ' '), x)

    s += "\n"

    for e in sorted(E.values()):
        x = highattr if e[0] in highlight else ''
        s += "  \"%s\" -> \"%s\" [label=\"%s\"%s];\n" % (
            e[2], e[3], (e[1] or '').replace('\n', ' '), x)

    s += "}\n"

    return s
dataset/ETHPy150Open spotify/python-graphwalker/graphwalker/dot.py/serialize/original