Darwin Help

Back to Index

DrawGraph

Function DrawGraph - draw a graph in two dimensions

Calling Sequence  DrawGraph(G)
DrawGraph(G,modif)
Parameters
NameTypeDescription

G Graphan input Graph
modif {string,symbol = anything}(optional) modifiers for the drawing
Return Type  NULL
Globals printlevel,
Synopsis DrawGraph uses the plot facility to display a Graph in two dimensions. The first argument, G, should be a Graph data structure. The positioning of the nodes and other properties of appearance depend on the optional arguments:
 

Mode of node positioning for NBody problem:


equal


equal All the edges have an equal initial distance and variance


distance The Edges' labels correspond to distances between the adjacent nodes. The variance of the distances are assumed to be equal to the distance. Edges having a non-positive label are ignored for the fitting.


weight The Edges' labels correspond to weights or scores between the adjacent nodes. They are converted to distances by taking the inverse of the weights. Variances are assumed to be equal to the distance. Edges having a non-positive labels are ignored for the fitting.


procedure A procedure Edge -> [dist, var] that assigns a distance and a variance to an edge.

 

Edge drawing and labeling:


unlabeled


EdgeDrawing=unlabeled Edges are drawn without any label


EdgeDrawing=labeled The label of each edge is drawn centered on the line and in the same color than the edge.


EdgeDrawing= A procedure (x1,y1,x2,y2,label,ts,col) -> list( drawing commands ). x1,y1,x2,y2 are the starting and end points of the edge, label is its label, ts the desired textsize and col the color.

 

Node drawing:


Nodes are represented with a circle and the node description


NodeDrawing= A procedure (x,y,label,ts,col) -> list( drawing commands ), where the node with label 'label' is centered at (x,y). ts is the desired textsize and col the color.

 

Size of Text:


TextSize= Set point-size for all text

 

Nodes and edges can be colored using the optional argument, which takes a list of arguments of the following form: Color( colorname, obj1, obj2, ... ). The objects are either Nodes(), Edges() or Edge() data structures. This means that those edges or nodes will be colored with colorname. The valid names for colorname are defined in lib/Color. The output is directed according to plotsetup.

See also BrightenColor,   ColorPalette,   DrawDistribution,   DrawDotplot,   DrawHistogram,   DrawPlot,   DrawPointDistribution,   DrawStackedBar,   DrawTree,   GetColorMap,   Plot2Gif,   PlotArguments,   Set,   SmoothData,   StartOverlayPlot,   StopOverlayPlot,   string_RGB,   ViewPlot