def draw(self, filename, attr = {}): """ Draws the graph into a dot file. Unimplemented. """ display.write_dot_desc((self._adjsets.keys(), self.edges()), filename, attr)
def draw(self, filename, attr = {}): """ Draws the graph into a dot file. """ display.write_dot_desc((self.vertices(), self.eges()), filename, attr)
def draw(self, filename, attr = {}): """ Draws the graph into a dot file. """ display.write_dot_desc((self.vertices(), self.edges()), filename, attributes=attr, graphtype='digraph')
stop = random.choice(list(V)) # rendering attributes attr = {"vertex_color":{}, "edge_color":{}} # define a color for start and stop vertex attr["vertex_color"][start]="green" attr["vertex_color"][stop]="red" print("Starting at {}, ending at {}".format(start, stop)) if len(graph.neighbours_of(G, start)) == 0: raise Exception("Bad luck, {} has no neighbours".format(start)) num_steps = 0 display.write_dot_desc(G, dot_file_name, attr) cur = start while cur != stop and num_steps < max_num_steps: display.pause(0) num_steps += 1 print("Step {} at {}".format(num_steps, cur)) # find a random neighbour of cur prev = cur neighbours = graph.neighbours_of(G, cur) cur = random.choice(list(neighbours)) # do some coloring before next graph render attr["vertex_color"][prev]="white" attr["vertex_color"][start]="green"
def draw(self, filename, attr={}): """ Draws the graph into a dot file. """ display.write_dot_desc((self.vertices(), self.eges()), filename, attr)