Provide functionality to display a graph. Not for direct consumption.
Use
GraphDisplay also provides UI-Interface independent edit operations
and basic animation methods
Methods
|
|
|
|
About
|
About ( self )
Return a HTML-page giving information about the graph
|
|
AddEdge
|
AddEdge (
self,
tail,
head,
)
Internal Add Edge. Note: unless graph is Euclidian weight is set
to 0. No error checking !
|
|
AddVertex
|
AddVertex (
self,
x,
y,
)
Internal Add a new vertex at (x,y)
NOTE: Assumes x,y to be in embedding coordinates edit commands
|
|
AddVertexCanvas
|
AddVertexCanvas (
self,
x,
y,
)
Internal Add a new vertex at (x,y)
NOTE: Assumes x,y to be in canvas coordinates
|
|
Blink
|
Blink (
self,
list,
color=cVertexBlink,
)
Blink all edges or vertices in list with color.
Edges are specified as (tail,head). Number of times, speed, default color is specified in GatoGlobals.py.
No error checking! Handles undirected graphs.
|
|
BlinkEdge
|
BlinkEdge (
self,
tail,
head,
color=cVertexBlink,
)
Blink edge (tail,head) with color. Number of times, speed, default
color is specified in GatoGlobals.py. No error checking! Handles
undirected graphs.
|
|
BlinkVertex
|
BlinkVertex (
self,
v,
color=cVertexBlink,
)
Blink vertex v with color. Number of times, speed, default color is
specified in GatoGlobals.py. No error checking!
|
|
CanvasToEmbedding
|
CanvasToEmbedding (
self,
x,
y,
)
Internal Convert canvas coordinates to embedding
|
|
CreateDirectedDrawEdge
|
CreateDirectedDrawEdge (
self,
t,
h,
curved,
w,
)
Internal Create an directed draw edge. t, h are Point2Ds
|
|
CreateDirectedLoopDrawEdge
|
CreateDirectedLoopDrawEdge (
self,
v,
w,
orientation=None,
)
Internal Create an directed loop draw edge. v is a Point2D
|
|
CreateDrawEdge
|
CreateDrawEdge (
self,
tail,
head,
)
Internal Create a draw edge for (tail,head) on the canvas. Position is
determined by the position of the vertices (or the embedding if the draw
vertices do not exist yet).
|
|
CreateDrawItems
|
CreateDrawItems ( self )
Internal Create items on the canvas
|
|
CreateDrawLabel
|
CreateDrawLabel ( self, v )
Internal Create a draw label for v on the canvas. Position is
determined by the embedding specified. Text is specified by the
labeling: Call only after CreateDrawVertex()
|
|
CreateDrawVertex
|
CreateDrawVertex (
self,
v,
x=None,
y=None,
)
Internal Create a draw vertex for v on the canvas. Position is
determined by the embedding unless explictely passed as x,y in
canvas coordinates
|
|
CreateEdgeAnnotation
|
CreateEdgeAnnotation (
self,
tail,
head,
annotation,
color,
)
Internal Create an edge annotation for (tail,head) on the canvas.
Position is determined by the embedding specified.
|
|
CreateUndirectedDrawEdge
|
CreateUndirectedDrawEdge (
self,
t,
h,
w,
)
Internal Create an undirected draw edge. t, h are Point2Ds
|
|
CreateUndirectedLoopDrawEdge
|
CreateUndirectedLoopDrawEdge (
self,
v,
w,
orientation=None,
)
Internal Create an undirected loop draw edge. v is a Point2D
|
|
CreateVertexAnnotation
|
CreateVertexAnnotation (
self,
v,
annotation,
color,
)
Internal Create a vertex annotation for v on the canvas. Position is
determined by the position of the corresponding draw vertex
on the canvas.
|
|
CreateWidgets
|
CreateWidgets ( self )
Internal Create UI-Elements (except Frame/Toplevel)
|
|
DefaultInfo
|
DefaultInfo ( self, event=None )
Internal Put default info into info box
|
|
DeleteDrawEdges
|
DeleteDrawEdges ( self )
Internal Delete draw edges on the canvas
|
|
DeleteDrawItems
|
DeleteDrawItems ( self )
Internal Delete all items on the canvas and clear up
our references to it
|
|
DeleteDrawLabels
|
DeleteDrawLabels ( self )
Internal Delete draw labels on the canvas
|
|
DeleteDrawVertices
|
DeleteDrawVertices ( self )
Internal Delete draw vertices on the canvas
|
|
DeleteEdge
|
DeleteEdge (
self,
tail,
head,
repaint=1,
)
Internal Delete edge (tail,head)
|
|
DeleteEdgeAnnotations
|
DeleteEdgeAnnotations ( self )
Internal Delete all edge annotations on the canvas
|
|
DeleteVertex
|
DeleteVertex ( self, v )
Internal Delete vertex v
|
|
DeleteVertexAnnotations
|
DeleteVertexAnnotations ( self )
Internal Delete all vertex annotations on the canvas
|
|
EdgeInfo
|
EdgeInfo ( self, event )
Internal Call back routine bound to MouseEnter of edges.
Produces default info for edges unless a user supplied
informer has been registered with RegisterGraphInformer()
|
|
EmbeddingToCanvas
|
EmbeddingToCanvas (
self,
x,
y,
)
Internal Convert Embedding coordinates to Canvas
|
|
FindEdge
|
FindEdge ( self, event )
Internal Given an event find the correspoding edge
|
|
FindGridVertex
|
FindGridVertex ( self, event )
Internal Given an event find the correspoding grid vertex
|
|
FindVertex
|
FindVertex ( self, event )
Internal Given an event find the correspoding vertex
|
|
GetCanvasCenter
|
GetCanvasCenter ( self )
Internal Return the center of the canvas in pixel
|
|
GetEdgeColor
|
GetEdgeColor (
self,
tail,
head,
)
Return color of (tail,head). No error checking!
Handles undirected graphs.
|
|
GetVertexColor
|
GetVertexColor ( self, v )
Return the color of v
|
|
MouseUp
|
MouseUp ( self, event )
Callback method for <B1-ButtonRelease>. Finds the vertex/edge
clicked and calls the registered clickhandler
|
|
MoveVertex
|
MoveVertex (
self,
v,
x,
y,
doUpdate=None,
)
Internal Move vertex v to position (x,y)
NOTE: Assumes x,y to be in canvas coordinates if
doUpdate=None and in embedding coordinates else
|
|
PrintToPSFile
|
PrintToPSFile ( self, fileName )
Produce an EPSF of canvas in fileName. Note: Graph gets scaled
and rotated as to maximize size while still fitting on paper
|
|
RegisterClickhandler
|
RegisterClickhandler ( self, handler )
A clickhandler is a function being called when the user
clicks on a vertex or an edge (actually releases mouse
button 1 over a vertex or an edge). The clickhandler takes a string vertex or edge as the
first and the vertex/edge clicked on as the second argument
|
|
RegisterGraphInformer
|
RegisterGraphInformer ( self, Informer )
A graph informer is an object which supplies information
about the graph, its vertices and its edges. It needs methods
If none is registered, information will be produced by
GraphDisplay. Infos are displayed in info field at the bottom
of the graph window.
|
|
SetAllEdgesColor
|
SetAllEdgesColor (
self,
color,
graph=None,
leaveColors=None,
)
Change the color of all edges to color at once
You can also pass an induced subgraph
|
|
SetAllVerticesColor
|
SetAllVerticesColor (
self,
color,
graph=None,
)
Change the color of all vertices to color at once
You can also pass an induced subgraph
|
|
SetEdgeAnnotation
|
SetEdgeAnnotation (
self,
tail,
head,
annotation,
color="black",
)
Add an annotation to (tail,head). Annotations are displayed to the left and
the bottom of v and allow to display more info about a vertex.
No error checking! Does not handle edge deletions/moves !
|
|
SetEdgeColor
|
SetEdgeColor (
self,
tail,
head,
color,
)
Change color of (tail,head) to color. No error checking!
Handles undirected graphs.
|
|
SetVertexAnnotation
|
SetVertexAnnotation (
self,
v,
annotation,
color="black",
)
Add an annotation to v. Annotations are displayed to the left and
the bottom of v and allow to display more info about a vertex.
No error checking! Does not handle vertex deletions/moves !
|
|
SetVertexColor
|
SetVertexColor (
self,
v,
color,
)
Change color of v to color. No error checking!
Animator commands
|
|
SetVertexFrameWidth
|
SetVertexFrameWidth (
self,
v,
val,
)
Set the width of the black frame of a vertex to val
|
|
ShowGraph
|
ShowGraph (
self,
G,
graphName,
)
Display graph G name graphName. Currently we assume that for
the embedding (x,y) of every vertex < x < 1000 and 0 < y < 1000
holds
|
|
SwapEdgeOrientation
|
SwapEdgeOrientation (
self,
tail,
head,
)
Internal If graph is directed and we do not have edges in both
directions, change the orientation of the edge (tail,head)
|
|
UnregisterClickhandler
|
UnregisterClickhandler ( self )
Unregister the handler
|
|
UpdateInfo
|
UpdateInfo ( self, neuText )
Internal Update text in info box
|
|
UpdateVertexLabel
|
UpdateVertexLabel (
self,
v,
blink=1,
color=cLabelBlink,
)
Visualize the changing of v's label. After changing G.labeling[v],
call UpdateVertexLabel to update the label in the graph window,
blinking blink times with color. No error checking!
|
|
VertexInfo
|
VertexInfo ( self, event )
Internal Call back routine bound to MouseEnter of vertices and
labels. Produces default info for vertices unless a user supplied
informer has been registered with RegisterGraphInformer()
|
|
VertexPosition
|
VertexPosition ( self, v )
Return the position of vertex v in canvas coordinates
|
|
Zoom
|
Zoom ( self, percent )
Internal Perform a zoom to specified level
|
|
__init__
|
__init__ ( self )
|