summaryrefslogtreecommitdiffstats
path: root/math/py-gato/files/patch-GraphUtil.py
diff options
context:
space:
mode:
authorwjv <wjv@FreeBSD.org>2001-09-03 10:45:18 +0000
committerwjv <wjv@FreeBSD.org>2001-09-03 10:45:18 +0000
commitff15e86d6fdb4f1a0ab2c720f8e0f4fc18cb80d3 (patch)
tree8ddaab1a6068be93f5cb02120cb3d64fa57d829e /math/py-gato/files/patch-GraphUtil.py
parentf4a130a180c2541da4426ff65890fe2f1b688238 (diff)
downloadFreeBSD-ports-ff15e86d6fdb4f1a0ab2c720f8e0f4fc18cb80d3.zip
FreeBSD-ports-ff15e86d6fdb4f1a0ab2c720f8e0f4fc18cb80d3.tar.gz
Add py-gato 0.96.g, a Python-based toolbox to visualise algorithms
on graphs.
Diffstat (limited to 'math/py-gato/files/patch-GraphUtil.py')
-rw-r--r--math/py-gato/files/patch-GraphUtil.py85
1 files changed, 85 insertions, 0 deletions
diff --git a/math/py-gato/files/patch-GraphUtil.py b/math/py-gato/files/patch-GraphUtil.py
new file mode 100644
index 0000000..8c652aa
--- /dev/null
+++ b/math/py-gato/files/patch-GraphUtil.py
@@ -0,0 +1,85 @@
+--- GraphUtil.py.orig Wed May 16 13:16:58 2001
++++ GraphUtil.py Mon Sep 3 12:21:49 2001
+@@ -31,7 +31,7 @@
+ #
+ ################################################################################
+
+-from regsub import split
++from re import split
+ from GatoGlobals import *
+ from Graph import Graph
+ from DataStructures import Point2D, VertexLabeling, EdgeLabeling, EdgeWeight, VertexWeight, Queue
+@@ -223,13 +223,13 @@
+ break
+
+ if lineNr == 2: # Read directed and euclidian
+- splitLine = split(line[:-1],';')
+- G.directed = eval(split(splitLine[0],':')[1])
+- G.simple = eval(split(splitLine[1],':')[1])
+- G.euclidian = eval(split(splitLine[2],':')[1])
+- intWeights = eval(split(splitLine[3],':')[1])
+- nrOfEdgeWeights = eval(split(splitLine[4],':')[1])
+- nrOfVertexWeights = eval(split(splitLine[5],':')[1])
++ splitLine = split(';',line[:-1])
++ G.directed = eval(split(':',splitLine[0])[1])
++ G.simple = eval(split(':',splitLine[1])[1])
++ G.euclidian = eval(split(':',splitLine[2])[1])
++ intWeights = eval(split(':',splitLine[3])[1])
++ nrOfEdgeWeights = eval(split(':',splitLine[4])[1])
++ nrOfVertexWeights = eval(split(':',splitLine[5])[1])
+ for i in xrange(nrOfEdgeWeights):
+ G.edgeWeights[i] = EdgeWeight(G)
+ for i in xrange(nrOfVertexWeights):
+@@ -237,33 +237,33 @@
+
+
+ if lineNr == 5: # Read nr of vertices
+- nrOfVertices = eval(split(line[:-2],':')[1]) # Strip of "\n" and ;
++ nrOfVertices = eval(split(':',line[:-2])[1]) # Strip of "\n" and ;
+ firstVertexLineNr = lineNr + 1
+ lastVertexLineNr = lineNr + nrOfVertices
+
+ if firstVertexLineNr <= lineNr and lineNr <= lastVertexLineNr:
+- splitLine = split(line[:-1],';')
++ splitLine = split(';',line[:-1])
+ v = G.AddVertex()
+- x = eval(split(splitLine[1],':')[1])
+- y = eval(split(splitLine[2],':')[1])
++ x = eval(split(':',splitLine[1])[1])
++ y = eval(split(':',splitLine[2])[1])
+ for i in xrange(nrOfVertexWeights):
+- w = eval(split(splitLine[3+i],':')[1])
++ w = eval(split(':',splitLine[3+i])[1])
+ G.vertexWeights[i][v] = w
+
+ E[v] = Point2D(x,y)
+
+ if lineNr == lastVertexLineNr + 1: # Read Nr of edges
+- nrOfEdges = eval(split(line[:-2],':')[1]) # Strip of "\n" and ;
++ nrOfEdges = eval(split(':',line[:-2])[1]) # Strip of "\n" and ;
+ firstEdgeLineNr = lineNr + 1
+ lastEdgeLineNr = lineNr + nrOfEdges
+
+ if firstEdgeLineNr <= lineNr and lineNr <= lastEdgeLineNr:
+- splitLine = split(line[:-1],';')
+- h = eval(split(splitLine[0],':')[1])
+- t = eval(split(splitLine[1],':')[1])
++ splitLine = split(';',line[:-1])
++ h = eval(split(':',splitLine[0])[1])
++ t = eval(split(':',splitLine[1])[1])
+ G.AddEdge(t,h)
+ for i in xrange(nrOfEdgeWeights):
+- G.edgeWeights[i][(t,h)] = eval(split(splitLine[3+i],':')[1])
++ G.edgeWeights[i][(t,h)] = eval(split(':',splitLine[3+i])[1])
+
+ lineNr = lineNr + 1
+
+@@ -345,7 +345,7 @@
+ if not line:
+ return retval
+
+- token = filter(lambda x: x != '', split(line[:-1],"[\t ]*"))
++ token = filter(lambda x: x != '', split("[\t ]*",line[:-1]))
+
+ if len(token) == 1 and token[0] == ']':
+ return retval
OpenPOWER on IntegriCloud