def to_vertex(id_lines): (id, lines) = id_lines outEdges = [Edge(tid, int(v)) for _, tid, v in lines] return (id, Vertex(id, sys.maxint, outEdges, True))
def parse_vertex(line, numV): fields = line.split(' ') title, refs = fields[0], fields[1:] outEdges = [Edge(ref) for ref in refs] return (title, Vertex(title, 1.0 / numV, outEdges, True))