From f9efd6ed614aa0eb66101b158594de506ce2c417 Mon Sep 17 00:00:00 2001 From: "Robert L. Miller" Date: Fri, 20 Feb 2009 18:41:53 -0800 Subject: [PATCH] Don't use symbolic variables for graph plotting --- src/sage/graphs/graph.py | 6 ++++++ src/sage/graphs/graph_plot.py | 12 +++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py index 16f81b0ed5b..2cbce4e05d2 100644 --- a/src/sage/graphs/graph.py +++ b/src/sage/graphs/graph.py @@ -5863,6 +5863,12 @@ def plot(self, **options): sage: g.add_edges([(0,0,'a'),(0,0,'b'),(0,1,'c'),(0,1,'d'), ... (0,1,'e'),(0,1,'f'),(0,1,'f'),(2,1,'g'),(2,2,'h')]) sage: g.plot(edge_labels=True, color_by_label=True, edge_style='dashed') + + sage: S = SupersingularModule(389) + sage: H = S.hecke_matrix(2) + sage: D = DiGraph(H) + sage: P = D.plot() + """ from sage.graphs.graph_plot import GraphPlot return GraphPlot(graph=self, options=options).plot() diff --git a/src/sage/graphs/graph_plot.py b/src/sage/graphs/graph_plot.py index 71674749701..82dc668b7b4 100644 --- a/src/sage/graphs/graph_plot.py +++ b/src/sage/graphs/graph_plot.py @@ -431,8 +431,6 @@ def set_edges(self, **edge_options): elif len(edges_to_draw[(a,b)]) > 1: # Multi-edge local_labels = edges_to_draw.pop((a,b)) - x = SymbolicVariable('x') - d = SymbolicVariable('d') # Compute perpendicular bisector p1 = self._pos[a] @@ -440,12 +438,12 @@ def set_edges(self, **edge_options): M = ((p1[0]+p2[0])/2, (p1[1]+p2[1])/2) # midpoint if not p1[1] == p2[1]: S = (p1[0]-p2[0])/(p2[1]-p1[1]) # perp slope - y = S*x-S*M[0]+M[1] # perp bisector line + y = lambda x : S*x-S*M[0]+M[1] # perp bisector line # f,g are functions of distance d to determine x values # on line y at d from point M - f = Sqrt(d**2/(1+S**2)) + M[0] - g = -Sqrt(d**2/(1+S**2)) + M[0] + f = lambda d : sqrt(d**2/(1+S**2)) + M[0] + g = lambda d : -sqrt(d**2/(1+S**2)) + M[0] odd_x = f even_x = g @@ -453,8 +451,8 @@ def set_edges(self, **edge_options): odd_y = lambda d : M[1] even_y = odd_y else: - odd_y = y(f) - even_y = y(g) + odd_y = lambda x : y(f(x)) + even_y = lambda x : y(g(x)) else: odd_x = lambda d : M[0] even_x = odd_x