2 # AUTOMATICALLY GENERATED
3 # Defines wrapper methods that can be used as shortcuts in the interpreter
8 def makeFromGDF(filename
):
9 g
.makeFromGDF(filename
)
11 def centerAfterLayout(state
):
12 g
.centerAfterLayout(state
)
14 def removeNodeComplete(n
):
15 g
.removeNodeComplete(n
)
17 def initConnection(*d
):
19 r
.initConnection(d
[0])
23 raise ValueError("Incorrect number of arguments")
26 def showTitle(title
,time
):
27 vf
.showTitle(title
,time
)
29 def sugiyamaLayout(*d
):
33 g
.sugiyamaLayout(d
[0])
35 raise ValueError("Incorrect number of arguments")
38 def getAppletContext():
39 return Guess
.getAppletContext()
41 def generateColors(*d
):
43 return Colors
.generateColors(d
[0],d
[1],d
[2])
45 return Colors
.generateColors(d
[0],d
[1],d
[2],d
[3])
47 raise ValueError("Incorrect number of arguments")
50 def makeFromGML(filename
):
51 g
.makeFromGML(filename
)
53 def searchOverlap(range):
54 return DefaultRangeManager
.searchOverlap(range)
56 def exportPS(filename
):
59 def compressOverlapping():
60 g
.compressOverlapping()
62 def exportSWF(filename
):
65 def exportPDF(filename
):
70 return g
.groupBy(d
[0],d
[1])
72 return g
.groupBy(d
[0])
74 raise ValueError("Incorrect number of arguments")
77 def jSpringLayout(*d
):
83 raise ValueError("Incorrect number of arguments")
86 def setDisplayBackground(c
):
87 v
.setDisplayBackground(c
)
89 def setNodeDisappearBy(nodeDisBy
):
90 Morpher
.setNodeDisappearBy(nodeDisBy
)
98 raise ValueError("Incorrect number of arguments")
101 def setTitleColor(aColor
):
102 vf
.setTitleColor(aColor
)
104 def averageColor(c1
,c2
):
105 return Colors
.averageColor(c1
,c2
)
107 def makeErdosRenyiRandom(nodes
,p
):
108 g
.makeErdosRenyiRandom(nodes
,p
)
112 db
.loadState(d
[0],d
[1])
116 raise ValueError("Incorrect number of arguments")
119 def exportGDF(filename
):
120 g
.exportGDF(filename
)
122 def getNodeAppearAfter():
123 return Morpher
.getNodeAppearAfter()
125 def weightedKKLayout(*d
):
129 g
.weightedKKLayout(d
[0])
131 raise ValueError("Incorrect number of arguments")
134 def removeEdgeComplete(e
):
135 g
.removeEdgeComplete(e
)
143 g
.kkLayout(d
[0],d
[1])
145 g
.kkLayout(d
[0],d
[1],d
[2])
147 raise ValueError("Incorrect number of arguments")
150 def addNodeField(fieldName
,sqlType
,defaultValue
):
151 return g
.addNodeField(fieldName
,sqlType
,defaultValue
)
153 def exportCGM(filename
):
154 v
.exportCGM(filename
)
156 def createConvexHull(seq
,c
):
157 return vf
.createConvexHull(seq
,c
)
160 return r
.isConnected()
165 def makeLattice1DRandom(nodes
,tor
):
166 g
.makeLattice1DRandom(nodes
,tor
)
168 def removeComplete(seq
):
169 g
.removeComplete(seq
)
171 def setEdgeAppearAfter(edgeAppearAfter
):
172 Morpher
.setEdgeAppearAfter(edgeAppearAfter
)
174 def makeFromDL(filename
):
175 g
.makeFromDL(filename
)
181 return g
.removeEdge(e
)
184 return g
.getNodeSchema()
186 def getEdgeDisappearBy():
187 return Morpher
.getEdgeDisappearBy()
189 def addRange(o
,range):
190 DefaultRangeManager
.addRange(o
,range)
195 def addEdge(node1
,node2
):
196 return g
.addEdge(node1
,node2
)
199 return Guess
.getMTF()
201 def getSynchronous():
202 return Guess
.getSynchronous()
204 def setBackgroundImage(*d
):
206 v
.setBackgroundImage(d
[0])
208 v
.setBackgroundImage(d
[0],d
[1],d
[2])
210 raise ValueError("Incorrect number of arguments")
219 raise ValueError("Incorrect number of arguments")
222 def setNodeAppearAfter(nodeAppearAfter
):
223 Morpher
.setNodeAppearAfter(nodeAppearAfter
)
225 def removeDisconnected():
226 return g
.removeDisconnected()
231 def expandOverlapping():
232 g
.expandOverlapping()
237 def getEdgeAppearAfter():
238 return Morpher
.getEdgeAppearAfter()
253 return g
.removeNode(n
)
255 def hideDisconnected():
259 return vf
.getDirected()
261 def springLayout(*d
):
267 raise ValueError("Incorrect number of arguments")
270 def setDirected(dir):
276 def setPageRankBias(bias
):
277 g
.setPageRankBias(bias
)
279 def setFrozen(state
):
282 def makeEppsteinRandom(nodes
,edges
,r
):
283 g
.makeEppsteinRandom(nodes
,edges
,r
)
285 def circleLayout(*d
):
289 g
.circleLayout(d
[0],d
[1])
291 g
.circleLayout(d
[0],d
[1],d
[2],d
[3])
293 raise ValueError("Incorrect number of arguments")
296 def weakComponentClusters():
297 return g
.weakComponentClusters()
302 def translateLayout(newX
,newY
):
303 g
.translateLayout(newX
,newY
)
305 def removeBackgroundImage():
306 v
.removeBackgroundImage()
308 def getSubgraph(name
):
309 return Subgraph
.getRootSubgraph(name
)
311 def groupAndSortBy(*d
):
313 return g
.groupAndSortBy(d
[0])
315 return g
.groupAndSortBy(d
[0],d
[1])
317 raise ValueError("Incorrect number of arguments")
320 def searchContained(range):
321 return DefaultRangeManager
.searchContained(range)
323 def physicsLayout(*d
):
327 g
.physicsLayout(d
[0])
329 raise ValueError("Incorrect number of arguments")
333 return r
.getGraphMap()
337 return g
.sortBy(d
[0],d
[1])
339 return g
.sortBy(d
[0])
341 raise ValueError("Incorrect number of arguments")
345 return r
.evalString(s
)
347 def removeConvexHulls(seq
):
348 vf
.removeConvexHulls(seq
)
350 def randomLayout(*d
):
354 g
.randomLayout(d
[0],d
[1])
356 raise ValueError("Incorrect number of arguments")
361 return Colors
.randomColor()
363 return Colors
.randomColor(d
[0])
365 raise ValueError("Incorrect number of arguments")
368 def moveLayout(newX
,newY
):
369 g
.moveLayout(newX
,newY
)
374 def morph(state
,duration
):
375 g
.morph(state
,duration
)
377 def makeSimpleDirectedRandom(nodes
,edges
):
378 g
.makeSimpleDirectedRandom(nodes
,edges
)
380 def exportJPG(filename
):
381 v
.exportJPG(filename
)
383 def radialLayout(center
):
384 g
.radialLayout(center
)
389 def overrideArrowLength(length
):
390 Arrow
.overrideArrowLength(length
)
392 def rescaleLayout(*d
):
394 g
.rescaleLayout(d
[0],d
[1])
396 g
.rescaleLayout(d
[0])
398 raise ValueError("Incorrect number of arguments")
401 def setSynchronous(state
):
402 Guess
.setSynchronous(state
)
404 def weightedSpringLayout(*d
):
406 g
.weightedSpringLayout(d
[0],d
[1])
408 g
.weightedSpringLayout(d
[0],d
[1],d
[2])
410 raise ValueError("Incorrect number of arguments")
413 def resizeLinear(f
,start
,end
):
414 g
.resizeLinear(f
,start
,end
)
416 def exportGIF(filename
):
417 v
.exportGIF(filename
)
419 def binPackLayout(*d
):
423 g
.binPackLayout(d
[0])
425 raise ValueError("Incorrect number of arguments")
428 def getJythonConsole():
429 return Guess
.getJythonConsole()
435 g
.colorize(d
[0],d
[1],d
[2])
437 g
.colorize(d
[0],d
[1],d
[2],d
[3])
439 raise ValueError("Incorrect number of arguments")
446 g
.frLayout(d
[0],d
[1])
448 raise ValueError("Incorrect number of arguments")
451 def setEdgeDisappearBy(edgeDisBy
):
452 Morpher
.setEdgeDisappearBy(edgeDisBy
)
460 raise ValueError("Incorrect number of arguments")
463 def getDisplayBackground():
464 return v
.getDisplayBackground()
466 def edgeBetweennessClusters(numEdgesToRemove
):
467 return g
.edgeBetweennessClusters(numEdgesToRemove
)
469 def exportPNG(filename
):
470 v
.exportPNG(filename
)
472 def exportSVG(filename
):
473 v
.exportSVG(filename
)
478 def overrideArrowWidth(width
):
479 Arrow
.overrideArrowWidth(width
)
481 def addEdgeField(fieldName
,sqlType
,defaultValue
):
482 return g
.addEdgeField(fieldName
,sqlType
,defaultValue
)
484 def getPageRankBias():
485 return g
.getPageRankBias()
487 def resizeRandom(f
,start
,end
):
488 g
.resizeRandom(f
,start
,end
)
490 def sugiyamaLayout2():
493 def setQuality(requestedQuality
):
494 v
.setQuality(requestedQuality
)
496 def removeConvexHull(c
):
497 vf
.removeConvexHull(c
)
499 def exportJAVA(filename
):
500 v
.exportJAVA(filename
)
502 def getConvexHulls():
503 return vf
.getConvexHulls()
506 return g
.getEdgeSchema()
510 v
.startMovie(d
[0],d
[1])
512 v
.startMovie(d
[0],d
[1],d
[2])
514 raise ValueError("Incorrect number of arguments")
517 def exportEPS(filename
):
518 v
.exportEPS(filename
)
520 def makeKleinbergRandom(nodes
,clust
):
521 g
.makeKleinbergRandom(nodes
,clust
)
523 def makeBarabasiAlbertRandom(vert
,edges
,evolve
):
524 g
.makeBarabasiAlbertRandom(vert
,edges
,evolve
)
532 raise ValueError("Incorrect number of arguments")
535 def exportEMF(filename
):
536 v
.exportEMF(filename
)
538 def makeFromPajek(filename
):
539 g
.makeFromPajek(filename
)
547 raise ValueError("Incorrect number of arguments")
550 def setRankerWeightField(f
):
551 g
.setRankerWeightField(f
)
559 def searchContains(range):
560 return DefaultRangeManager
.searchContains(range)
562 def makeLattice2DRandom(nodes
,tor
):
563 g
.makeLattice2DRandom(nodes
,tor
)
574 raise ValueError("Incorrect number of arguments")
578 return g
.complement(seq
)
580 def removeSelfLoops():
581 return g
.removeSelfLoops()
583 def biComponentClusters():
584 return g
.biComponentClusters()
586 def getNodeDisappearBy():
587 return Morpher
.getNodeDisappearBy()
589 def searchExact(range):
590 return DefaultRangeManager
.searchExact(range)
592 def makeSimpleRandom(nodes
,edges
):
593 g
.makeSimpleRandom(nodes
,edges
)
596 return db
.getStates()
600 __FUNCTION_DICTIONARY
= {"execfile" : "void execfile(String s);\n", "makeFromGDF" : "void makeFromGDF(String filename) throws java.io.IOException \n load a graph from a GDF format file\n \tparam filename the file to load\n", "centerAfterLayout" : "void centerAfterLayout(boolean state) \n should we center after doing a layout\n disable this to control it yourself\n", "removeNodeComplete" : "void removeNodeComplete(Node n) \n removes a node completely (node, and all edges connected to it, \n will likely be unrecoverable). Removes from all states.\n \tparam n the node to remove\n", "initConnection" : "void initConnection(String server) \n\nvoid initConnection() \n", "showTitle" : "void showTitle(String title, long time) \n Shows a title in the frame\n", "sugiyamaLayout" : "void sugiyamaLayout() \n Sugiyama\n\nvoid sugiyamaLayout(boolean bends) \n Sugiyama\n", "getAppletContext" : "static AppletContext getAppletContext() \n get the applet context\n", "generateColors" : "static ArrayList<Object> generateColors(String startC, String endC, int inBetween) \n\nstatic ArrayList<Object> generateColors(String startC, String middleC, String endC, int inBetween) \n percent;\n percent;\n", "makeFromGML" : "void makeFromGML(String filename) \n load a graph from a GML file\n \tparam filename the GML filename to load\n", "searchOverlap" : "static Collection searchOverlap(String range) \n", "exportPS" : "void exportPS(String filename);\n", "compressOverlapping" : "void compressOverlapping() \n", "exportSWF" : "void exportSWF(String filename);\n", "exportPDF" : "void exportPDF(String filename);\n", "groupBy" : "Collection<SortableHashSet> groupBy(PySequence seq, Field field) \n genererates a set of sets grouped by some field that defined equivalence\n \tparam seq the thing to group by\n \tparam field the field to sort by\n\nCollection<SortableHashSet> groupBy(Field field) \n generates a set of sets on all graph objects, guesses type by field\n \tparam field the field that defined equivalence\n", "jSpringLayout" : "void jSpringLayout() \n the JUNG Spring Layout (seems a little broken). Asks\n every 30 seconds if you want to keep running\n\nvoid jSpringLayout(int max) \n run the JUNG spring layout for max iterations\n \tparam max the number of iterations\n", "setDisplayBackground" : "void setDisplayBackground(Color c);\n", "setNodeDisappearBy" : "static void setNodeDisappearBy(float nodeDisBy) \n", "gemLayout" : "void gemLayout() \n GEM Layout\n\nvoid gemLayout(long seed) \n GEM Layout\n \tparam seed the seed for the random number generator, useful\n for getting the same layout every time.\n", "setTitleColor" : "void setTitleColor(Color aColor) \n Sets the Color of the title text\n", "averageColor" : "static String averageColor(String c1, String c2) \n", "makeErdosRenyiRandom" : "void makeErdosRenyiRandom(int nodes, double p) \n", "ls" : "void loadState(Graph g, int state);\n\nvoid loadState(String state);\n", "exportGDF" : "void exportGDF(String filename) \n generate a GDF representation of the file\n \tparam filename the filename to output\n", "getNodeAppearAfter" : "static float getNodeAppearAfter() \n", "weightedKKLayout" : "void weightedKKLayout() \n a weighted JUNG Kamada-Kawai (regular)\n\nvoid weightedKKLayout(int iters) \n a weighted JUNG Kamada-Kawai (regular) with user defined iterations\n \tparam iters\n", "removeEdgeComplete" : "void removeEdgeComplete(Edge e) \n removes an edge completely. Removes from all states.\n \tparam e the node to remove\n", "kkLayout" : "void kkLayout() \n Kamada-Kawai, puts nodes in 1000 x 1000 square\n\nvoid kkLayout(int passes) \n Kamada-Kawai, puts nodes in 1000 x 1000 square\n \tparam passes\n\nvoid kkLayout(int width, int height) \n Kamada-Kawai into a width x height grid\n \tparam width\n \tparam height\n\nvoid kkLayout(int width, int height, int passes) \n Kamada-Kawai into a width x height grid and some number of iterations\n \tparam width\n \tparam height\n \tparam passes\n", "addNodeField" : "Field addNodeField(String fieldName, int sqlType, Object defaultValue) \n Create a new node field\n \tparam fieldname the name of the field\n \tparam sqlType the type of the node (see java.sql)\n \tparam defaultValue the default this field should take\n", "exportCGM" : "void exportCGM(String filename);\n", "createConvexHull" : "ConvexHull createConvexHull(PySequence seq, String c) \n", "isRConnected" : "boolean isConnected() \n", "mdsLayout" : "void mdsLayout() \n Multidimensional scaling layout based on edge weight\n", "makeLattice1DRandom" : "void makeLattice1DRandom(int nodes, boolean tor) \n", "removeComplete" : "void removeComplete(PySequence seq) \n remove nodes and edges completely from the system (all states)\n \tparam seq the nodes + edges\n", "setEdgeAppearAfter" : "static void setEdgeAppearAfter(float edgeAppearAfter) \n", "makeFromDL" : "void makeFromDL(String filename) \n", "remove" : "Set remove(PySequence seq) \n remove nodes and edges from the graph\n \tparam seq the nodes + edges\n", "removeEdge" : "Set<AbstractElement> removeEdge(Edge e) \n remove an edge from the graph\n \tparam e the edge to remove\n", "getNodeSchema" : "NodeSchema getNodeSchema() \n grab the node schema\n", "getEdgeDisappearBy" : "static float getEdgeDisappearBy() \n", "addRange" : "static void addRange(Object o, String range) \n", "stopMovie" : "void stopMovie() \n basically dumps the movie to disk\n", "addEdge" : "UndirectedEdge addEdge(Node node1, Node node2) \n user's API shortcut for adding a new undirected edge.\n", "getMTF" : "static boolean getMTF() \n Are objects being moved to the front when they change\n", "getSynchronous" : "static boolean getSynchronous() \n thread management\n", "setBackgroundImage" : "void setBackgroundImage(String filename);\n\nvoid setBackgroundImage(String filename, double x, double y);\n", "jkkLayout1" : "void jkkLayout1() \n the JUNG Kamada-Kawai (regular)\n\nvoid jkkLayout1(int iters) \n the JUNG Kamada-Kawai (regular) with user defined iterations\n \tparam iters\n", "setNodeAppearAfter" : "static void setNodeAppearAfter(float nodeAppearAfter) \n", "removeDisconnected" : "Set removeDisconnected() \n removes disconnected nodes\n", "dagLayout" : "void dagLayout() \n DAG\n", "expandOverlapping" : "void expandOverlapping() \n", "dragwindow" : "static void create() \n", "getEdgeAppearAfter" : "static float getEdgeAppearAfter() \n", "stoplog" : "void stoplog();\n", "setMTF" : "static void setMTF(boolean state) \n should objects in the visualization be moved to the front\n when they change\n", "add" : "void add(PySequence seq) \n add nodes and edges from the graph\n \tparam seq the nodes + edges\n", "drawwindow" : "static void create() \n", "removeNode" : "Set<AbstractElement> removeNode(Node n) \n remove a node from the graph\n \tparam n the node to remove\n", "hideDisconnected" : "void hideDisconnected() \n hides disconnected nodes\n", "getDirected" : "boolean getDirected() \n", "springLayout" : "void springLayout() \n spring layout, runs for 30 seconds and asks if you want\n to continue\n\nvoid springLayout(int max) \n spring layout for max iterations\n \tparam max number of iterations\n", "setDirected" : "void setDirected(boolean dir) \n", "jfrLayout" : "void jfrLayout() \n the JUNG Fructerman-Rheingold Layout\n", "setPageRankBias" : "void setPageRankBias(double bias) \n sets the page rank bias\n \tparam bias the bias\n", "setFrozen" : "void setFrozen(boolean state);\n", "makeEppsteinRandom" : "void makeEppsteinRandom(int nodes, int edges, int r) \n", "circleLayout" : "void circleLayout() \n places all nodes in a circle\n\nvoid circleLayout(Field f, Node c) \n places all nodes in a circle with node c in the middle\n and its neighbors around that center with a radius\n proportional to field f (all nodes that are not neighbors\n of c will be left as is)\n \tparam f the field to use to calc the radius\n \tparam c the node to put in the center\n\nvoid circleLayout(Field f, Node c, double xorigin, double yorigin) \n places all nodes in a circle with node c in the middle\n and its neighbors around that center with a radius\n proportional to field f (all nodes that are not neighbors\n of c will be left as is)\n \tparam f the field to use to calc the radius\n \tparam c the node to put in the center\n \tparam xorigin the x location for the center node\n \tparam yorigin the y location for the center node\n", "weakComponentClusters" : "Set weakComponentClusters() \n do weak component clustering\n \treturn a set of sets\n", "rshutdown" : "void shutdown() throws Exception \n", "translateLayout" : "void translateLayout(int newX, int newY) \n moves the nodes to a new origin\n \tparam newX\n \tparam newY\n", "removeBackgroundImage" : "void removeBackgroundImage();\n", "getSubgraph" : "static Subgraph getRootSubgraph(String name) \n", "groupAndSortBy" : "Collection<SortableHashSet> groupAndSortBy(Field field) \n simulatenous sort and group\n \tparam field the field to group and sort by\n\nCollection groupAndSortBy(PySequence seq, Field field) \n simulatenous group annd sort\n \tparam seq the set to group and sort\n \tparam field the field\n", "searchContained" : "static Collection searchContained(String range) \n", "physicsLayout" : "void physicsLayout() \n physics layout, asks every 30 seconds if you want to keep running\n\nvoid physicsLayout(int max) \n run physics layout for max steps\n \tparam max the number of steps\n", "getGraphMap" : "GraphMap getGraphMap() \n", "sortBy" : "Collection<GraphElement> sortBy(PySequence seq, Field field) \n sort some set by some field\n \tparam seq the set to sort\n \tparam field the field to sort by\n\nCollection<GraphElement> sortBy(Field field) \n sort all graph elements by some field, guesses a the type\n of object you want to sort by based on the field type\n \tparam field the field to sort by\n", "reval" : "Object evalString(String s) \n", "removeConvexHulls" : "void removeConvexHulls(PySequence seq) \n", "randomLayout" : "void randomLayout() \n randomly places nodes in a 1000 x 1000 grid\n\nvoid randomLayout(int width, int height) \n randomly places nodes in a width x height grid\n \tparam width width\n \tparam height height\n", "randomColor" : "static String randomColor() \n\nstatic String randomColor(int alpha) \n", "moveLayout" : "void moveLayout(int newX, int newY) \n moves the nodes to a new origin\n \tparam newX\n \tparam newY\n", "sql" : "synchronized void q(String expression) throws SQLException \n", "morph" : "void morph(String state, long duration) \n morph from the current state to some other state over a time\n \tparam state the state to morph to \n \tparam duration the time to morph over\n", "makeSimpleDirectedRandom" : "void makeSimpleDirectedRandom(int nodes, int edges) \n make a random directed graph\n \tparam nodes the number of nodes\n \tparam edges the number of edges\n", "exportJPG" : "void exportJPG(String filename);\n", "radialLayout" : "void radialLayout(Node center) \n places all nodes in a growing radius around center\n \tparam center the node to put in the center\n", "density" : "double density() \n calculate the graph density\n", "overrideArrowLength" : "static void overrideArrowLength(int length) \n", "rescaleLayout" : "void rescaleLayout(int width, int height) \n rescales nodes to fit into width x height\n \tparam width the rescale width\n \tparam height the rescale height\n\nvoid rescaleLayout(double percent) \n rescales the layout to %percent\n \tparam percent the percent to shrink/grow\n", "setSynchronous" : "static void setSynchronous(boolean state) \n should layouts run in their own threads?\n", "weightedSpringLayout" : "void weightedSpringLayout(int min, int max) \n spring layout, runs for 30 seconds and asks if you want\n to continue\n\nvoid weightedSpringLayout(int minL, int maxL, int max) \n spring layout for max iterations\n \tparam max number of iterations\n", "resizeLinear" : "void resizeLinear(Field f, double start, double end) \n", "exportGIF" : "void exportGIF(String filename);\n", "binPackLayout" : "void binPackLayout() \n packs all nodes\n\nvoid binPackLayout(boolean rescale) \n packs all nodes\n", "getJythonConsole" : "static TextPaneJythonConsole getJythonConsole() \n gets a reference to the existing GUI console object, or\n null if it doesn't exist\n", "colorize" : "void colorize(Field f) \n color nodes or edges by some field, nodes/edges with\n equal field values take on the same (randomly chosen) color\n \tparam f the field to color by\n\nvoid colorize(Field f, Color start, Color end) \n\nvoid colorize(Field f, Color start, Color middle, Color end) \n", "frLayout" : "void frLayout() \n Fruchterman-Rheingold, puts nodes in 1000 x 1000 square\n\nvoid frLayout(int width, int height) \n Fruchterman-Rheingold into a width x height grid\n \tparam width\n \tparam height\n", "setEdgeDisappearBy" : "static void setEdgeDisappearBy(float edgeDisBy) \n", "infowindow" : "static void create() \n\nstatic void create() \n", "getDisplayBackground" : "Color getDisplayBackground();\n", "edgeBetweennessClusters" : "Set edgeBetweennessClusters(int numEdgesToRemove) \n do Edge betweenness clustering\n \tparam numEdgesToRemove edges to remove\n \treturn a set of sets\n", "exportPNG" : "void exportPNG(String filename);\n", "exportSVG" : "void exportSVG(String filename);\n", "ss" : "void saveState(int state);\n", "overrideArrowWidth" : "static void overrideArrowWidth(int width) \n", "addEdgeField" : "Field addEdgeField(String fieldName, int sqlType, Object defaultValue) \n Create a new edge field\n \tparam fieldname the name of the field\n \tparam sqlType the type of the node (see java.sql)\n \tparam defaultValue the default this field should take\n", "getPageRankBias" : "double getPageRankBias() \n returne the pagerank bias\n", "resizeRandom" : "void resizeRandom(Field f, double start, double end) \n", "sugiyamaLayout2" : "void sugiyamaLayout2() \n Sugiyama\n", "setQuality" : "void setQuality(int requestedQuality);\n", "removeConvexHull" : "void removeConvexHull(ConvexHull c) \n", "exportJAVA" : "void exportJAVA(String filename);\n", "getConvexHulls" : "Collection<ConvexHull> getConvexHulls() \n", "getEdgeSchema" : "EdgeSchema getEdgeSchema() \n grab the edge schema\n", "startMovie" : "void startMovie(int fps, String filename) \n\nvoid startMovie(int fps, String filename, boolean auto) \n", "exportEPS" : "void exportEPS(String filename);\n", "makeKleinbergRandom" : "void makeKleinbergRandom(int nodes, double clust) \n", "makeBarabasiAlbertRandom" : "void makeBarabasiAlbertRandom(int vert, int edges, int evolve) \n", "isomLayout" : "void isomLayout() \n ISOM Layout, asks every 30 seconds if you want to continue\n\nvoid isomLayout(int max) \n ISOM Layout for max steps\n \tparam max the number of iterations\n", "exportEMF" : "void exportEMF(String filename);\n", "makeFromPajek" : "void makeFromPajek(String filename) \n load a graph from pajek\n \tparam filename the pajek file to load\n", "center" : "void center();\n\nvoid center(Object o);\n", "setRankerWeightField" : "void setRankerWeightField(Field f) \n which field to use for weighting\n \tparam f the field\n", "help" : "static void help(String tohelp) \n", "log" : "void log(String filename);\n", "searchContains" : "static Collection searchContains(String range) \n", "makeLattice2DRandom" : "void makeLattice2DRandom(int nodes, boolean tor) \n", "readjustEdges" : "void readjustEdges() \n moves edges so they don't overlap\n", "jkkLayout2" : "void jkkLayout2() \n the JUNG Kamada-Kawai (int)\n\nvoid jkkLayout2(int iters) \n the JUNG Kamada-Kawai (int) with user defined iterations\n \tparam iters\n", "complement" : "Set complement(PySequence seq) \n returns the complement (e.g. all nodes/edges in the\n graph that are not in the set). If the set contains only nodes\n only nodes will be returned. Likewise for edges. If the set contains\n both, both nodes and edges will be returned.\n \tparam seq the nodes and/or edges\n", "removeSelfLoops" : "Set removeSelfLoops() \n removes self loops\n", "biComponentClusters" : "Set biComponentClusters() \n do Bi-Component Clustering\n \treturn a set of sets\n", "getNodeDisappearBy" : "static float getNodeDisappearBy() \n", "searchExact" : "static Collection searchExact(String range) \n", "makeSimpleRandom" : "void makeSimpleRandom(int nodes, int edges) \n generate a random graph\n \tparam nodes the number of nodes\n \tparam edges the number of edges\n", "getStates" : "Set<?> getStates();\n"}
602 def addNode(_name
,**_extra
):
603 _temp
= g
.addNode(_name
)
604 if not isinstance(_name
,Class
.forName("com.hp.hpl.guess.Node")):
606 for _toset
in _extra
.keys():
607 _temp
.__setattr
__(_toset
,_extra
[_toset
])
610 def copyNode(_template
,_name
,**_extra
):
611 if not isinstance(_template
,Class
.forName("com.hp.hpl.guess.Node")):
612 raise TypeError,'First argument nust be a template Node'
613 if not isinstance(_name
,Class
.forName("org.python.core.PyString")):
614 raise TypeError,'Second argument must be a name'
615 _temp
= g
.addNode(_name
)
616 for _field
in Node
.fieldNames():
617 if (_field
!= "name"):
618 _temp
.__setattr
__(_field
,_template
.__getattr
__(_field
))
619 for _toset
in _extra
.keys():
620 _temp
.__setattr
__(_toset
,_extra
[_toset
])
623 def addEdge(*d
,**_extra
):
624 return addUndirectedEdge(*d
,**_extra
)
626 def addDirectedEdge(*d
,**_extra
):
629 _temp
= g
.addEdge(d
[0])
630 elif d
.__len
__() == 2:
631 return g
.addDirectedEdge(d
[0],d
[1])
632 for _toset
in _extra
.keys():
633 _temp
.__setattr
__(_toset
,_extra
[_toset
])
634 if not _extra
.has_key("label"):
635 _temp
.label
= str(_temp
.weight
)
638 def addUndirectedEdge(*d
,**_extra
):
641 _temp
= g
.addEdge(d
[0])
642 elif d
.__len
__() == 2:
643 return g
.addUndirectedEdge(d
[0],d
[1])
644 for _toset
in _extra
.keys():
645 _temp
.__setattr
__(_toset
,_extra
[_toset
])
646 if not _extra
.has_key("label"):
647 _temp
.label
= str(_temp
.weight
)
650 # Some demo functions that manipulate the graph in various ways
652 from java
.lang
import Math
654 # iteratively removes all nodes that have
655 # a total degree of 1
656 # assumes self loops have been removed
658 g
.nodes
[0].totaldegree
659 _m
= (totaldegree
<= 1)
661 while _m
.__len
__() > 0:
663 _m
= (totaldegree
<= 1)
668 # iteratively removes nodes that have an outdegree
669 # of introduces a new edge
670 # assumes self loops have been removed
672 g
.nodes
[0].totaldegree
673 _m
= (totaldegree
== 2)
678 _pot
= _z
.getNeighbors()
680 if len(_pot
[0]-_pot
[1]) == 0:
681 _added
+= [addEdge(_pot
[0],_pot
[1])]
682 _toRet
+= removeNode(_z
)
683 _m
= (totaldegree
== 2)
684 _temp
= intersectionHelper(_toRet
,_added
)
685 return [_temp
[0],_temp
[1]]
687 # iteratively call removeLeaves and shortcutNodes to
692 _toRet
+= removeDisconnected()
693 _toRet
+= removeSelfLoops()
694 g
.nodes
[0].totaldegree
695 _t1
= (totaldegree
<= 1)
696 _t2
= (totaldegree
== 2)
697 while (_t1
.__len__() > 0) |
(_t2
.__len__() > 0):
698 _toRet
+= removeLeaves()
699 _scr
= shortcutNodes()
702 _t1
= (totaldegree
<= 1)
703 _t2
= (totaldegree
== 2)
704 _temp
= intersectionHelper(_toRet
,_added
)
705 return [_temp
[0],_temp
[1]]
707 def intersectionHelper(_l1
,_l2
):
708 _templist
= _l1
& _l2
712 if _elem
not in _templist
:
715 if _elem
not in _templist
:
719 # does a "skitter" plot which lays out nodes around a circle based on the
720 # ordering given an input field (lexical for text, numerical for numbers).
721 # The radius is defined by the totaldegree of the node
723 _maxangle
= 2 * Math
.PI
724 _ordering
= sortBy(_field
)
725 _increment
= _maxangle
/ len(_ordering
)
728 _maxdeg
= outdegree
.max + 1.0
730 _radius
= 1 - Math
.log((_n
.outdegree
+ 1.0) / _maxdeg
)
731 _radius
= _radius
* 500.0
732 _x
= 500.0 + _radius
* Math
.cos(_curangle
)
733 _y
= 500.0 + _radius
* Math
.sin(_curangle
)
736 _curangle
+= _increment
738 # colors a given edge the "average" of it's two endpoints
739 def averageEdgeColor(_edge
):
740 _n1
= _edge
.getNode1()
741 _n2
= _edge
.getNode2()
742 _edge
.color
= averageColor(_n1
.color
,_n2
.color
)
744 from com
.hp
.hpl
.guess
.jfreechart
import GChartFrame
745 from com
.hp
.hpl
.guess
.jfreechart
import GHistoChartFrame
746 from com
.hp
.hpl
.guess
.jfreechart
import GPieChartFrame
748 # plots the distribution of values for a given field in a chart
749 def plotDistrib(_field
,_chart
= None, _sortBy
= None, legend
= 1, visible
= 1):
757 _values
+= [_z
.__getattr
__(_field
.getName())]
759 if (_field
.getType() == 1):
760 _xlabel
= "Rank Ordered Nodes"
762 _xlabel
= "Rank Ordered Edges"
764 _chart
= GChartFrame(_field
.getName(),_names
,_values
,_xlabel
,visible
,legend
)
766 _chart
.addToChart(_field
.getName(),_names
,_values
,_xlabel
)
770 return len(_b
) - len(_a
)
773 return len(_b
) - len(_a
)
775 def plotSizes(_field
,legend
=0,visible
=1):
776 _groups
= groupBy(_field
)
777 _groups
.sort(sizecmpd
)
783 _name
= _g
[0].__getattr
__(_field
.getName())
787 _colors
+= [_g
[0].color
]
788 _chart
= GHistoChartFrame(_field
.getName(),_groups
,_values
,_names
,_colors
,visible
,legend
)
791 def plotSizesPie(_field
,legend
=0,visible
=1):
792 _groups
= groupBy(_field
)
793 _groups
.sort(sizecmpd
)
799 _name
= _g
[0].__getattr
__(_field
.getName())
803 _colors
+= [_g
[0].color
]
804 _chart
= GPieChartFrame(_field
.getName(),_groups
,_values
,_names
,_colors
,visible
,legend
)
807 def plotHistogram(_field
,bins
=10,legend
=0,visible
=1):
808 _sorted
= sortBy(_field
)
809 _min
= float(_field
.min)
810 _max
= float(_field
.max)
811 _binsize
= (_max
- _min
)/float(bins
)
812 _binend
= _min
+ _binsize
819 _val
= _e
.__getattr
__(_field
.getName())
821 _groups
+= [_curgroup
]
822 _values
+= [len(_curgroup
)]
823 _names
+= ["<="+str(_binend
)];
825 _binend
= _binend
+ _binsize
828 _groups
+= [_curgroup
]
829 _values
+= [len(_curgroup
)]
830 _names
+= ["<="+str(_max
)];
832 _chart
= GHistoChartFrame(_field
.getName(),_groups
,_values
,_names
,_colors
,visible
,legend
)
836 # calculates the distance between two nodes
837 def distance(_node1
,_node2
):
838 return Math
.sqrt(((_node1
.x
- _node2
.x
) * (_node1
.x
- _node2
.x
)) + ((_node1
.y
- _node2
.y
) * (_node1
.y
- _node2
.y
)))
856 def floatRange(a
, b
, inc
):
859 for i
in range(1, int(math
.ceil((b
- a
) / inc
))):
860 x
. append(a
+ i
* inc
)