#!/usr/bin/env python def read_file(filename): with open(filename, 'r') as f: for line in f: yield line.strip() def main(): graph = dict() for line in read_file("connections.txt"): tokens = line.split(" ") tokens[0] = int(tokens[0]) tokens[1] = int(tokens[1]) # add vertex 1 if tokens[0] not in graph: graph[tokens[0]] = set() graph[tokens[0]].add(tokens[2]) # add vertex 2 if tokens[1] not in graph: graph[tokens[1]] = set() graph[tokens[1]].add(tokens[2]) import svg canvas = svg.SVG( width=40, height=40, elements=[ svg.Circle( cx=20, cy=20, r=18, stroke="black", fill="yellow", stroke_width=2, ), ], ) print(canvas) if __name__ == "__main__": main()