;ò òiýDc@sKdkZdkZdklZdkZdkTdklZdklZlZl Z l Z l Z l Z dk Z e idƒZd„Zd„Zdd „Zd „Zd fd „ƒYZd efd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZd„Zd„Zd„Zd„Zd„Zd„ZdS(N(ssplit(s*(sGraph(sPoint2DsVertexLabelings EdgeLabelings EdgeWeights VertexWeightsQueues GraphUtil.pycCs |iSdS(s- Returns the vertices of G. Hide method call N(sGsvertices(sG((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pysVertices5scCs|iƒSdS(s* Returns the edges of G. Hide method call N(sGsEdges(sG((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pysEdges9ssforwardc Cstƒ}h}h}x|iD]}t||tZdZd„Zd„Zd„Zd„Zdd„ZRS(s} Provides information about edges and vertices of a graph. Used as argument for GraphDisplay.RegisterGraphInformer() cCs||_d|_dS(Ns(sGsselfsinfo(sselfsG((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pys__init__—s cCs |iSdS(sZ Provide an default text which is shown when no edge/vertex info is displayed N(sselfsinfo(sself((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pys DefaultInfo›scCs9|ii|ƒ}d|t|iƒt|iƒfSdS(s# Provide an info text for vertex v sVertex %d at position (%d,%d)N(sselfsGs GetEmbeddingsvstsintsxsy(sselfsvst((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pys VertexInfo scCsd||fSdS(s, Provide an info text for edge (tail,head) s Edge (%d,%d)N(stailshead(sselfstailshead((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pysEdgeInfo¥sscCs ||_dS(N(sinfosself(sselfsinfo((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pysSetDefaultInfo©s(s__name__s __module__s__doc__s__init__s DefaultInfos VertexInfosEdgeInfosSetDefaultInfo(((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pys GraphInformer“s     sWeightedGraphInformercBs#tZdZdd„Zd„ZRS(s† Provides information about weighted edges and vertices of a graph. Used as argument for GraphDisplay.RegisterGraphInformer() sweightcCsti||ƒ||_dS(sv G is the graph we want to supply information about and weightDesc a textual interpretation of the weight N(s GraphInformers__init__sselfsGs weightDesc(sselfsGs weightDesc((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pys__init__±scCsÉ|iiƒdjoNy|iid||ƒ}Wq|tj o|iid||ƒ}q|Xn|iid||ƒ}|iidi ƒod|||i |fSnd|||i |fSdS(s5 Provide an info text for weighted edge (tail,head) isEdge (%d,%d) %s: %dsEdge (%d,%d) %s: %fN( sselfsGs QDirecteds GetEdgeWeightstailsheadswsKeyErrors edgeWeightssQIntegers weightDesc(sselfstailsheadsw((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pysEdgeInfo·s!(s__name__s __module__s__doc__s__init__sEdgeInfo(((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pysWeightedGraphInformer­s  sMSTGraphInformercBstZd„Zd„ZRS(NcCsti||ƒ||_dS(N(sWeightedGraphInformers__init__sselfsGsT(sselfsGsT((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pys__init__ÈscCs$d|iiƒ|iiƒfSdS(sZ Provide an default text which is shown when no edge/vertex info is displayed s%Tree has %d vertices and weight %5.2fN(sselfsTsOrdersWeight(sself((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pys DefaultInfoÌs(s__name__s __module__s__init__s DefaultInfo(((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pysMSTGraphInformerÇs sFlowGraphInformercBs#tZd„Zd„Zd„ZRS(NcCsAti||ƒ||_|i|_|i|_|i|_dS(N(s GraphInformers__init__sselfsGsflowscapsressexcess(sselfsGsflow((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pys__init__Ós    cCs2d|||i||f|i||ffSdS(NsEdge (%d,%d) - flow: %d of %d(svswsselfsflowscap(sselfsvsw((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pysEdgeInfoÚscCsX|i|}|tjo d}n#|t jo d}n d|}d||fSdS(NsInfinitys -Infinitys%dsVertex %d - excess: %s(sselfsexcesssvstmps gInfinitysstr1(sselfsvstmpsstr1((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pys VertexInfoÝs     (s__name__s __module__s__init__sEdgeInfos VertexInfo(((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pysFlowGraphInformerÒs  sResidualGraphInformercBstZd„ZRS(NcCs"d|||i||ffSdS(Ns$Edge (%d,%d) - residual capacity: %d(svswsselfsres(sselfsvsw((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pysEdgeInfoês(s__name__s __module__sEdgeInfo(((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pysResidualGraphInformerèscCs¾tƒ}tƒ}t|ƒ} tƒ} t} t |ƒt i jot |dƒ} nCt |ƒt ijpt|itiƒo |} n tdƒ‚d}d}d} d}d}d}x}nou| iƒ}| oPn|djo"t|d dƒ}tt|ddƒdƒ|_tt|ddƒdƒ|_tt|ddƒdƒ|_ tt|d dƒdƒ}tt|d dƒdƒ}tt|d dƒdƒ}x't#|ƒD]}t|ƒ|i%|vdim:1000; hdim:1000; vlinc:10; hlinc:10; vpinc:50; hpinc:50; s vertices:s; isn:%d; x:%d; y:%d;s w:%d;s sedges:sh:%d; t:%d; e:2;s w:%f;N()sNonesfilestypes_filestypess StringTypessopensFileTypes issubclasss __class__sStringIOs ExceptionslensGs vertexWeightsskeyssnrOfVertexWeightss edgeWeightssnrOfEdgeWeightssQIntegersintegerEdgeWeightsswrites QDirectedssimples QEuclidiansOrderscountssavesverticessvs embeddingsxsysxrangesisintsroundsSizestails OutNeighborsshead( sGs_filesnrOfVertexWeightssfilesheadstailssavescountsisvsnrOfEdgeWeightssintegerEdgeWeights((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pysSaveCATBoxGraphNsP,   2     2 ,   2&cCsõg}xènoà|iƒ}| o|Sntd„t|d dƒƒ}t|ƒdjo|ddjo|Sq t|ƒdjoQ|ddjo!|i|dt |ƒfƒqì|i|d|dfƒq t i d |ƒqWdS( NicCs |djS(Ns(sx(sx((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pysŽsiÿÿÿÿs[ ]*is]is[sSerious format error line %s:( sretvalsfilesreadlineslinesfilterssplitstokenslensappendsParseGMLslogserror(sfilestokenslinesretval((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pysParseGMLƒs $!cCsEh}x4tt|ƒƒD] }||d|||dis%dslabel=("[^"]+")iÿÿÿÿspos="(\d+),(\d+)"s(\d+) -> (\d+)s%0.2f(,sGraphsGsdirectedsVertexLabelingsEs EdgeWeightsWsLsVLabels EdgeLabelingsELabelsresopensfileNamesfiles readlinesslinesscloses dot2graphslsstringssplitsitemsslens AddVertexsvsintsdot_vssearchsmsgroupsxsysPoint2DswsAddEdgesfloatsweights embeddingslabelings nrEdgeWeightss edgeWeightssvertexAnnotationsedgeAnnotation(sfileNamesweightslsfiles dot2graphsresEsGsdot_vsLsmsWsxsitemssELabelslinessVLabelswsvsy((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pys OpenDotGraphësX                   (stypessStringIOsstringssplits GatoGlobalssGraphsDataStructuressPoint2DsVertexLabelings EdgeLabelings EdgeWeights VertexWeightsQueuesloggings getLoggerslogsVerticessEdgessBFSsConnectedComponentss GraphInformersWeightedGraphInformersMSTGraphInformersFlowGraphInformersResidualGraphInformersOpenCATBoxGraphsSaveCATBoxGraphsParseGMLsPairListToDictionarys OpenGMLGraphs OpenDotGraph(sVertexLabelingsPairListToDictionarysGraphsConnectedComponentssFlowGraphInformers GraphInformersSaveCATBoxGraphslogsEdgesssplitsOpenCATBoxGraphs OpenGMLGraphsstringsParseGMLsVerticess VertexWeightsBFSsMSTGraphInformerstypessQueuesloggingsStringIOs EdgeLabelingsWeightedGraphInformers OpenDotGraphsResidualGraphInformers EdgeWeightsPoint2D((s6/mnt/gmirror/ports/math/py-gato/work/Gato/GraphUtil.pys?%s.     +   % *  [ 5   E