; iDc@sdkTdklZlZlZlZdklZdkZdfdYZ dfdYZ dfd YZ d e fd YZ d fd YZ de fdYZdefdYZdefdYZdfdYZdfdYZdefdYZdefdYZdefdYZdefdYZd fd!YZd"fd#YZd$efd%YZd&efd'YZd(fd)YZd*d+Zd,fd-YZd.fd/YZdS(0(s*(sVertexLabelingsQueuesStacks PriorityQueue(sSubGraphNsAnimatorcBs tZdZdZdZRS(sb *Debugging* Text only Animator providing animation functions which only print to console cCsdG|GdG|GHdS(Ns set color ofs to (svscolor(sselfsvscolor((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysSetVertexColor0scCsdG|GdG|GdG|GHdS(Nsset color of edge (s,s) to (stailsheadscolor(sselfstailsheadscolor((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys SetEdgeColor3s(s__name__s __module__s__doc__sSetVertexColors SetEdgeColor(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysAnimator,s  sAnimatedNeighborhoodcBs/tZdZgedZdZdZRS(s9 Visualizes visiting of neighbors by calling the Neighborhood method of graph for v and allowing to iterate over it, while coloring (v,w) cTraversedEdge unless (v,w) is colored with one of the colors in leaveColors. #Neighborhood = lambda v,a=A,g=G: AnimatedNeighborhood(a,g,v,['red']) # #for w in Neighborhood(v): # doSomething will color all edges cTraversedEdge unless the edge has been colored 'red' at some point if a blinkColor is specified the edge will blink cCsk||_|i||_||_||_||_t |_ t |_ d|_ |ii |iddS(s> theAnimator will usually be the GraphDisplay(Frame/Toplevel) syellowiN(s theAnimatorsselfsAnimatorsGs Neighborhoodsvsnbhs leaveColorss blinkColorsNoneslastEdges lastColors travColorsSetVertexFrameWidth(sselfs theAnimatorsGsvs leaveColorss blinkColor((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__Gs       cCsy|ii|id|id|ijof|i|ijo(|ii|id|idtq|ii|id|id|inWn t nX|t |i jo|i |i |f|_|ii|i |i ||_|ii|i |i ||i|it jo'|ii|i |i ||in|i |Sn#|ii|i |iitdS(Nii(sselfsAnimators GetEdgeColorslastEdges travColors lastColors leaveColorss SetEdgeColorscTraversedEdgesNonesislensnbhsvs blinkColors BlinkEdgesSetVertexFrameWidthsgVertexFrameWidths IndexError(sselfsi((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys __getitem__Ss -(/"#'cCst|iSdS(N(slensselfsnbh(sself((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__len__gs(s__name__s __module__s__doc__sNones__init__s __getitem__s__len__(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysAnimatedNeighborhood7s  sBlinkingNeighborhoodcBs)tZdZdZdZdZRS(s  Visualizes visiting blinking (v,w) for all w when iterating over the Neighborhood #Neighborhood = lambda v,a=A,g=G: BlinkingNeighborhood(a,g,v,c) # #for w in Neighborhood(v): # doSomething will blink all edgescCs1||_|i||_||_||_dS(s> theAnimator will usually be the GraphDisplay(Frame/Toplevel) N( s theAnimatorsselfsAnimatorsGs Neighborhoodsvsnbhscscolor(sselfs theAnimatorsGsvsc((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__us   cCsR|t|ijo2|ii|i|i||i|i|SntdS(N( sislensselfsnbhsAnimators BlinkEdgesvscolors IndexError(sselfsi((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys __getitem__|s#cCst|iSdS(N(slensselfsnbh(sself((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__len__s(s__name__s __module__s__doc__s__init__s __getitem__s__len__(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysBlinkingNeighborhoodks   sBlinkingTrackLastNeighborhoodcBs)tZdZeZddZdZRS(s Visualizes visiting blinking (v,w) for all w when iterating over the Neighborhood. It also temporarily keeps the the last blinked edge grey #Neighborhood = lambda v,a=A,g=G: BlinkingTrackLastNeighborhood(a,g,v,c,track) # #for w in Neighborhood(v): # doSomething will blink all edges with color c, the last blinked is tracked with color track sgreycCs&ti|||||||_dS(N( sBlinkingNeighborhoods__init__sselfs theAnimatorsGsvscstracks trackColor(sselfs theAnimatorsGsvscstrack((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__scCstitjo|t|ijo/ti}|ii|d|d|dn|i |i||ii |i |i|ft_t i ||}|ii|i |i||i|SdS(Niii(sBlinkingTrackLastNeighborhoodsoldsNonesislensselfsnbhsAnimators SetEdgeColorsvs GetEdgeColorsBlinkingNeighborhoods __getitem__sretVals trackColor(sselfsisoldsretVal((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys __getitem__s& &5#(s__name__s __module__s__doc__sNonesolds__init__s __getitem__(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysBlinkingTrackLastNeighborhoods  sBlinkingContainerWrappercBs,tZdZedZdZdZRS(s Visualizes iterating over a list of vertices and/or edges by blinking. #List = lambda l, a=A: BlinkingContainerWrapper(a,l,color) # #for w in List: # doSomething cCs(||_ti||_||_dS(N(s theAnimatorsselfsAnimatorscopyslslistscolor(sselfs theAnimatorslscolor((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__s cCs|t|ijoi|i|}t|tdjo|ii||in"|ii |d|d|i|Snt dS(Niii( sislensselfslistsitemstypesAnimators BlinkVertexscolors BlinkEdges IndexError(sselfsisitem((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys __getitem__s !cCst|iSdS(N(slensselfslist(sself((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__len__s(s__name__s __module__s__doc__scOnQueues__init__s __getitem__s__len__(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysBlinkingContainerWrappers   sContainerWrappercBs#tZdZedZdZRS(s* Visualizes iterating over a list of vertices and/or edges by coloring. If color has changed in the meantime the original color will not be set again. #List = lambda l, a=A: ContainerWrapper(a,l,color) # #for w in List: # doSomething cCs,ti||||t|_t|_dS(N( sBlinkingContainerWrappers__init__sselfs theAnimatorslscolorsNoneslastitems lastcolor(sselfs theAnimatorslscolor((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__s cCs|t|ijog|i|}t|tdjo|ii|}|i t jo|ii|i |i jo|ii |i |i n|ii ||i ||_ n|ii|d|d}|i t jo*|ii|i d|i d|i jo+|ii|i d|i d|i n|ii|d|d|i ||_ ||_ |SntdS(Niii(sislensselfslistsitemstypesAnimatorsGetVertexColorsdummyslastitemsNonescolorsSetVertexColors lastcolors GetEdgeColors SetEdgeColors IndexError(sselfsisdummysitem((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys __getitem__s  / =+!  (s__name__s __module__s__doc__scOnQueues__init__s __getitem__(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysContainerWrappers  sVisibleVertexLabelingcBstZdZdZRS(NcCsti|||_dS(N(sVertexLabelings__init__sselfs theAnimatorsA(sselfs theAnimator((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__s cCsYti||||tjo d}n|t jo d}n|ii||dS(NsInfinitys -Infinity(sVertexLabelings __setitem__sselfsvsvals gInfinitysAsSetVertexAnnotation(sselfsvsval((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys __setitem__s    (s__name__s __module__s__init__s __setitem__(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysVisibleVertexLabelings sAnimatedVertexLabelingcBs&tZdZdddZdZRS(sC Visualizes changes of values of the VertexLabeling by changing vertex colors appropriately. E.g., #d = AnimatedVertexLabeling(A) #d[v] = 0 will color v cInitial. The coloring used for d[v] = val - cInitial if val = 0,None,gInfinity - "blue" else isbluecCs,ti|||_||_||_dS(s~ theAnimator will usually be the GraphDisplay(Frame/Toplevel) initial is the value to cause coloring in cInitial N(sVertexLabelings__init__sselfs theAnimatorsAnimatorsinitialscolor(sselfs theAnimatorsinitialscolor((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__s    cCsnti|||||ijp|tjp |tjo|ii |t n|ii ||i dS(N( sVertexLabelings __setitem__sselfsvsvalsinitialsNones gInfinitysAnimatorsSetVertexColorscInitialscolor(sselfsvsval((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys __setitem__ s*(s__name__s __module__s__doc__s__init__s __setitem__(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysAnimatedVertexLabelings sAnimatedSignIndicatorcBs)tZdZdZdZdZRS(sr Visualizes sign of vertex or edge: weight > 0 : green = 0 : grey < 0 : red cCs||_h|_dS(N(s theAnimatorsselfsAnimatorsweight(sselfs theAnimator((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__s cCs||i| theAnimator will usually be the GraphDisplay(Frame/Toplevel) N(sVertexLabelings__init__sselfs theAnimatorsAnimator(sselfs theAnimator((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__Vs cCsHti||||djo|ii|n|ii|dS(Ni(sVertexLabelings __setitem__sselfsvsvalsAnimators BlinkVertex(sselfsvsval((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys __setitem__[s (s__name__s __module__s__doc__s__init__s __setitem__(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysBlinkingVertexLabelingRs  sAnimatedVertexQueuecBs8tZdZeedZdZdZdZRS(s Visualizes status of vertices in relation to the Queue by coloring them - cOnQueue if they are in the queue - cRemovedFromQueue if they have been on the queue and were removed cCs5ti|||_||_||_t |_ dS(s> theAnimator will usually be the GraphDisplay(Frame/Toplevel) N( sQueues__init__sselfs theAnimatorsAnimatorscolorOnsColorOnscolorOffsColorOffsNones lastRemoved(sselfs theAnimatorscolorOnscolorOff((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__ks     cCs*ti|||ii||idS(N(sQueuesAppendsselfsvsAnimatorsSetVertexColorsColorOn(sselfsv((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysAppendsscCsyti|}|ii||i|itj o |ii |i|ii n|ii |d||_|SdS(Ni( sQueuesTopsselfsvsAnimatorsSetVertexColorsColorOffs lastRemovedsNonesSetVertexFrameWidthsgVertexFrameWidth(sselfsv((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysTopws  cCstx'|iD]}|ii||iq Wti||it j o)|ii |i|ii t |_ndS(N( sselfscontentssvsAnimatorsSetVertexColorsColorOffsQueuesClears lastRemovedsNonesSetVertexFrameWidthsgVertexFrameWidth(sselfsv((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysClears  ( s__name__s __module__s__doc__scOnQueuescRemovedFromQueues__init__sAppendsTopsClear(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysAnimatedVertexQueuecs   sAnimatedVertexPriorityQueuecBs8tZdZeedZdZdZdZRS(s Visualizes status of vertices in relation to the PriorityQueue by coloring them - cOnQueue if they are in the queue - cRemovedFromQueue if they have been on the queue and were removed cCs5ti|||_||_||_t |_ dS(s> theAnimator will usually be the GraphDisplay(Frame/Toplevel) N( s PriorityQueues__init__sselfs theAnimatorsAnimatorscolorOnsColorOnscolorOffsColorOffsNones lastRemoved(sselfs theAnimatorscolorOnscolorOff((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__s     cCs-ti||||ii||idS(N(s PriorityQueuesInsertsselfsvaluessortKeysAnimatorsSetVertexColorsColorOn(sselfsvaluessortKey((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysInsertscCs'ti||||ii|dS(N(s PriorityQueues DecreaseKeysselfsvalues newSortKeysAnimators BlinkVertex(sselfsvalues newSortKey((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys DecreaseKeyscCsyti|}|ii||i|itj o |ii |i|ii n|ii |d||_|SdS(Ni( s PriorityQueues DeleteMinsselfsvsAnimatorsSetVertexColorsColorOffs lastRemovedsNonesSetVertexFrameWidthsgVertexFrameWidth(sselfsv((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys DeleteMins  ( s__name__s __module__s__doc__scOnQueuescRemovedFromQueues__init__sInserts DecreaseKeys DeleteMin(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysAnimatedVertexPriorityQueues   sAnimatedVertexStackcBs8tZdZeedZdZdZdZRS(s Visualizes status of vertices in relation to the Stack by coloring them - cOnQueue if they are in the queue - cRemovedFromQueue if they have been on the queue and were removed cCs5ti|||_||_||_t |_ dS(s> theAnimator will usually be the GraphDisplay(Frame/Toplevel) N( sStacks__init__sselfs theAnimatorsAnimatorscolorOnsColorOnscolorOffsColorOffsNones lastRemoved(sselfs theAnimatorscolorOnscolorOff((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__s     cCs*ti|||ii||idS(N(sStacksPushsselfsvsAnimatorsSetVertexColorsColorOn(sselfsv((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysPushscCsyti|}|ii||i|itj o |ii |i|ii n|ii |d||_|SdS(Ni( sStacksPopsselfsvsAnimatorsSetVertexColorsColorOffs lastRemovedsNonesSetVertexFrameWidthsgVertexFrameWidth(sselfsv((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysPops  cCstx'|iD]}|ii||iq Wti||it j o)|ii |i|ii t |_ndS(N( sselfscontentssvsAnimatorsSetVertexColorsColorOffsStacksClears lastRemovedsNonesSetVertexFrameWidthsgVertexFrameWidth(sselfsv((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysClears  ( s__name__s __module__s__doc__scOnQueuescRemovedFromQueues__init__sPushsPopsClear(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysAnimatedVertexStacks   sAnimatedVertexSetcBsStZdZeedZdZdZdZdZ dZ dZ RS(s Visualizes status of vertices in relation to the Set by coloring them - cVisited if they have been in the set and were removed cCs9|tjo g|_n ||_||_||_dS(s> theAnimator will usually be the GraphDisplay(Frame/Toplevel) N(s vertexSetsNonesselfsverticess theAnimatorsAnimatorscolor(sselfs theAnimators vertexSetscolor((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__s     cCs||_dS(s+ Sets the set equal to a copy of vertexSet N(s vertexSetsselfsvertices(sselfs vertexSet((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysSetscCs*|ii||i|ii|dS(N(sselfsAnimatorsSetVertexColorsvscolorsverticessremove(sselfsv((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysRemovescCs|ii|dS(s Add a single vertex v N(sselfsverticessappendsv(sselfsv((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysAddscCst|idjSdS(Ni(slensselfsvertices(sself((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys IsNotEmptyscCst|idjSdS(Ni(slensselfsvertices(sself((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysIsEmptyscCs||ijSdS(N(svsselfsvertices(sselfsv((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysContainss( s__name__s __module__s__doc__sNonescVisiteds__init__sSetsRemovesAdds IsNotEmptysIsEmptysContains(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysAnimatedVertexSets      sAnimatedEdgeSetcBsYtZdZedZdZdZdZdZdZ dZ dZ RS( s Visualizes status of edges in relation to the Set by coloring them - 'blue' if they are added to the set - cVisited if they have been in the set and were removed cCs0|tjo g|_n ||_||_dS(s> theAnimator will usually be the GraphDisplay(Frame/Toplevel) N(sedgeSetsNonesselfsedgess theAnimatorsAnimator(sselfs theAnimatorsedgeSet((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__s    cCst|iSdS(N(slensselfsedges(sself((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__len__scCs|i|SdS(N(sselfsedgesskey(sselfskey((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys __getitem__scCs||_dS(s) Sets the set equal to a copy of edgeSet N(sedgeSetsselfsedges(sselfsedgeSet((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysSet scCs2|ii|d|dd|ii|dS(Niisblue(sselfsAnimators SetEdgeColorsesedgessappend(sselfse((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysAddEdge$scCsP|ii|d|dt|ii|d|dt|ii|dS(Nii(sselfsAnimators BlinkEdgesescVisiteds SetEdgeColorsedgessremove(sselfse((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysRemove(scCst|idjSdS(Ni(slensselfsedges(sself((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys IsNotEmpty-scCs||ijSdS(N(sesselfsedges(sselfse((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysContains0s( s__name__s __module__s__doc__sNones__init__s__len__s __getitem__sSetsAddEdgesRemoves IsNotEmptysContains(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysAnimatedEdgeSet s        sAnimatedSubGraphcBsYtZdZddZdZedZdZedZddZ d Z RS( s Visualizes status of vertices and edges in relation to the SubGraph by coloring them - color (default is 'blue') if they are added to the SubGraph sbluecCs&ti||||_||_dS(s color is used to color vertices and edges in the subgraph. theAnimator will usually be the GraphDisplay(Frame/Toplevel) N(sSubGraphs__init__sselfsGs theAnimatorsAnimatorscolorsColor(sselfsGs theAnimatorscolor((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__9s cCsUy7ti|||ii||i|iiWntj o dSnXdS(N( sSubGraphs AddVertexsselfsvsAnimatorsSetVertexColorsColors DefaultInfosNoSuchVertexError(sselfsv((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys AddVertex@s cCs|tjot|djo|d}|d}n |}|}ykti||||i i |||i |i i ||\}}|i i|||i iWntj o }dSnXdS(Niii(sheadsNoneslensedgestshsSubGraphsAddEdgesselfsAnimators SetEdgeColorsColors superGraphsEdgesttshhs RaiseEdges DefaultInfosNoSuchVertexErrorsNoSuchEdgeError(sselfsedgesheadshsNoSuchEdgeErrorshhststt((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysAddEdgeHs  cCsOxH|iD]:\}}|ii||\}}|ii ||q WdS(N( sselfsEdgesstshs superGraphsEdgesttshhsAnimators RaiseEdge(sselfshsttshhst((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys RaiseEdgesZs cCs|tjot|djo|d}|d}n |}|}y-ti||||i i ||dWnt j o }dSnXdS(Niiisblack( sheadsNoneslensedgestshsSubGraphs DeleteEdgesselfsAnimators SetEdgeColorsNoSuchVertexErrorsNoSuchEdgeError(sselfsedgesheadshsNoSuchEdgeErrorst((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys DeleteEdge`s  sgreycCsW|ii|||ii||g|_h|_h|_d|_d|_ dS(sv Delete all vertices and edges from the animated subgraph. and color them with 'color' (grey is default) iN( sselfsAnimatorsSetAllVerticesColorscolorsSetAllEdgesColorsverticessadjListss invAdjListsssizes totalWeight(sselfscolor((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysClearms    cCs]y=ti||||ii|||i|iiWnt j o }dSnXdS(N( sSubGraphsAddEdgesselfstailsheadsAnimators SetEdgeColorsColors DefaultInfosNoSuchVertexErrorsNoSuchEdgeError(sselfstailsheadsNoSuchEdgeError((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysAddEdgeByVertices|s ( s__name__s __module__s__doc__s__init__s AddVertexsNonesAddEdges RaiseEdgess DeleteEdgesClearsAddEdgeByVertices(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysAnimatedSubGraph4s      sAnimatedPredecessorcBs8tZdZeddZdZdZdZRS(s Animates a predecessor array by - coloring edges (pred[v],v) 'red' - coloring edges (pred[v],v) 'grey' if the value of pred[v] is changed sredcCs,ti|||_||_||_dS(N(sVertexLabelings__init__sselfs theAnimatorsAnimators leaveColorss predColor(sselfs theAnimators leaveColorss predColor((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__s   cCsyqti||}|tjoN|itjp|ii|||ij o|ii ||dqpnWnnX|tjo_yQ|itjp|ii|||ij o|ii |||i nWqqXnti |||dS(Nsgrey( sVertexLabelings __getitem__sselfsvsoldValsNones leaveColorssAnimators GetEdgeColors SetEdgeColorsvals predColors __setitem__(sselfsvsvalsoldVal((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys __setitem__s 0" 0!cCs ||_dS(s8 NOTE: This does not recolor assigned (pred[v],v) edges N(scolorsselfs predColor(sselfscolor((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys SetPredColorscCs4|itjo|g|_n|ii|dS(N(sselfs leaveColorssNonescolorsappend(sselfscolor((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysAppendLeaveColors(s__name__s __module__s__doc__sNones__init__s __setitem__s SetPredColorsAppendLeaveColor(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysAnimatedPredecessors   sComponentMakercBs)tZdZdZdZdZRS(sb Subsequent calls of method NewComponent() will return differently colored subgraphs of G cCsU||_||_ddddddddd d d d d ddg|_d|_dS(Ns#FF0000s#00FF00s#0000FFs#009999s#990099s#999900s#996666s#669966s#666699s#0066CCs#6600CCs#66CC00s#00CC66s#CC0066s#CC6600i(sgsselfsGsasAscolorss lastColor(sselfsgsa((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__s  6cCs`t|i|i|i|i}|id|_|it|ijo d|_n|SdS(Nii(sAnimatedSubGraphsselfsGsAscolorss lastColorscompslen(sselfscomp((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys NewComponents " cCs.|idjo|i|idSntSdS(Nii(sselfs lastColorscolorssNone(sself((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysLastComponentColors(s__name__s __module__s__doc__s__init__s NewComponentsLastComponentColor(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysComponentMakers  sredcCs|}|g}xz||tjo|||joW|i|||i||||||}||jodSq|i |qW|i||dS(s Visualizes a path from source to sink in a graph G displayed in A. The path is specified in terms of the predecessor array pred and will be colored with color (default is 'red') N( ssinksvsseenspredsNonesAsSetVertexColorscolors SetEdgeColorsappend(ssourcessinkspredsAscolorsvsseen((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysshowPathByPredecessorArrays "  s FlowWrappercBs,tZdZedZdZdZRS(sD This class visualizes the flow in a directed graph G with animator GA and it's residual network R with animator RA. flow = FlowWrapper(G,A,R,RA,G.edgeWeights[0],R.edgeWeights[0]) or flow = FlowWrapper(G,A,R,RA,G.edgeWeights[0],R.edgeWeights[0],G.vertexWeights[0]) c Csd|_||_||_||_||_||_ti||_ ||_ ||_ |i t jo1h|_ x%|ii D]} d|i | 0 green =0 grey <0 red cCs||_||_||_dS(N(scostsselfspotsA(sselfsAscostspot((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys__init__As  cCs||i|<|i||i|d|i|d}y|djo"|ii|d|ddnN|djo"|ii|d|ddn|ii|d|ddWn tnXdS(Niisredsgreysgreen( svalsselfscostsespotsrcsAs SetEdgeColorsNone(sselfsesvalsrc((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys __setitem__Fs + " ""cCs|i|SdS(N(sselfscostse(sselfse((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys __getitem__Ss(s__name__s __module__s__doc__s__init__s __setitem__s __getitem__(((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pysReducedCostsWrapper;s   (s GatoGlobalssDataStructuressVertexLabelingsQueuesStacks PriorityQueuesGraphsSubGraphscopysAnimatorsAnimatedNeighborhoodsBlinkingNeighborhoodsBlinkingTrackLastNeighborhoodsBlinkingContainerWrappersContainerWrappersVisibleVertexLabelingsAnimatedVertexLabelingsAnimatedSignIndicatorsAnimatedPotentialsBlinkingVertexLabelingsAnimatedVertexQueuesAnimatedVertexPriorityQueuesAnimatedVertexStacksAnimatedVertexSetsAnimatedEdgeSetsAnimatedSubGraphsAnimatedPredecessorsComponentMakersshowPathByPredecessorArrays FlowWrappersReducedCostsWrapper(sVertexLabelingsshowPathByPredecessorArraysSubGraphsContainerWrappersQueuesBlinkingTrackLastNeighborhoodsBlinkingContainerWrappersAnimatedSignIndicatorsAnimatedVertexPriorityQueuesVisibleVertexLabelings FlowWrappersBlinkingVertexLabelingsAnimatedVertexStacksStacksBlinkingNeighborhoodsComponentMakersAnimatedPredecessorsAnimatedEdgeSets PriorityQueuesAnimatedSubGraphscopysAnimatedVertexQueuesAnimatorsAnimatedVertexLabelingsAnimatedNeighborhoodsAnimatedPotentialsReducedCostsWrappersAnimatedVertexSet((sC/mnt/gmirror/ports/math/py-gato/work/Gato/AnimatedDataStructures.pys?&s2   4$  %":&*R( S