예제 #1
0
 def AddEdgeByVertices(self, tail, head):
     try:
         SubGraph.AddEdge(self, tail, head)
         self.Animator.SetEdgeColor(tail, head, self.Color)
         self.Animator.DefaultInfo()
     except NoSuchVertexError, NoSuchEdgeError:
         return
예제 #2
0
 def AddVertex(self, v):
     try:
         SubGraph.AddVertex(self, v)
         self.Animator.SetVertexColor(v, self.Color)
         self.Animator.DefaultInfo()
     except NoSuchVertexError:
         return
예제 #3
0
    def AddSubGraph(self, G):
        """ Add subgraph G to self. Will do nothing if self and G 
            have distinct supergraphs """
        if self.superGraph != G.superGraph:
            log.error("AddSubGraph: distinct superGraphs")
            return

        for v in G.Vertices():
            if G.QIsolated(v):
                SubGraph.AddVertex(self, v)

        for t, h in G.Edges():
            SubGraph.AddEdge(self, t, h)
        self.Animator.SetEdgesColor(G.Edges(), self.Color)
        #print "Just called setEdgesColor animator is ", self.Animator.__class__.__name__
        self.Animator.SetAllVerticesColor(self.Color, graph=G)
        self.RaiseEdges()
        self.Animator.DefaultInfo()
예제 #4
0
 def DeleteEdge(self, edge, head=None):
     if head == None and len(edge) == 2:
         t = edge[0]
         h = edge[1]
     else:
         t = edge
         h = head
     try:
         SubGraph.DeleteEdge(self, t, h)
         self.Animator.SetEdgeColor(t, h, "black")
     except NoSuchVertexError, NoSuchEdgeError:
         return
예제 #5
0
 def AddEdge(self, edge, head=None):
     # Poor mans function overload
     if head == None and len(edge) == 2:
         t = edge[0]
         h = edge[1]
     else:
         t = edge
         h = head
     try:
         SubGraph.AddEdge(self, t, h)
         self.Animator.SetEdgeColor(t, h, self.Color)
         # Raise edges above other
         tt, hh = self.superGraph.Edge(t, h)
         self.Animator.RaiseEdge(tt, hh)
         self.Animator.DefaultInfo()
     except NoSuchVertexError, NoSuchEdgeError:
         return
 def __init__(self, G, theAnimator, color="blue"):
     """ color is used to color vertices and edges in the subgraph.
         theAnimator will usually be the GraphDisplay(Frame/Toplevel) """
     SubGraph.__init__(self, G)
     self.Animator = theAnimator
     self.Color = color
예제 #7
0
 def __init__(self, G, theAnimator, color="blue"):
     """ color is used to color vertices and edges in the subgraph.
         theAnimator will usually be the GraphDisplay(Frame/Toplevel) """
     SubGraph.__init__(self, G)
     self.Animator = theAnimator
     self.Color = color