def sgf_to_postman(filename):
    """
    Converts the SGF graph to list of edge tuples. Corresponding edge label are stored into edgeLabelMap dict.
    """
    edges = []
    edgeLabelMap = {}
    nodes = set()
    with open(filename) as f:
        lines = f.readlines()
        for idx in range(1, len(lines)):
            line = lines[idx]
            s, d, w, l = line.split()
            nodes.add(int(s))
            nodes.add(int(d))
            edge = (int(s), int(d), int(w))
            edges.append(edge)
            edgeLabelMap[edge] = l

    return edges, edgeLabelMap, list(nodes)