def parse_segments(segments_str):
    """
    Parse segments stored as a string.

    :param vertices: "v1,v2,v3,..."
    :param return: [(v1,v2), (v3, v4), (v5, v6), ... ]
    """
    s = [int(t) for t in segments_str.split(',')]
    return zip(s[::2], s[1::2])