Dataplot Vol 2 Vol 1

# EDGES TO VERTICES

Name:
EDGES TO VERTICES (LET)
Type:
Let Subcommand
Purpose:
Convert a list of edges and coordinates for the vertices into a form suitable for plotting.
Description:
This is a convenience function. Graphs are often defined in terms of its edges. If you have a list of edges and and variables that define the coordinates of the vertices, this command will return variables that contain the coordinates of the plot points (call them X2 and Y2) and a third variables that identifies which points are to be connected (call this variable TAG). Then a plot of the edges of the graph can be generated with the command

PLOT Y2 X2 TAG

The primary limitation of this command is that it assumes that you already have coordinates for the vertices in the graph.

Syntax:
LET <y2> <x2> <tag> = EDGES TO VERTICES <edge1> <edge2> <y> <x>
where <edge1> is a variable that identifies the first vertex in the edge;
<edge2> is a variable that identifies the second vertex in the edge;
<y> is a variable that identifies the y-coordinates of the vertices;
<x> is a variable that identifies the x-coordinates of the vertices;
and      <tag> is a variable where the trace-id is saved.
Examples:
LET Y2 X2 TAG = EDGES TO VERTICES E1 E2 Y X
Default:
None
Synonyms:
None
Related Commands:
 2D CONVEX HULL = Compute the 2D convex hull of a set of points. MINIMUM SPANNING TREE = Compute the minimum spanning tree. ADJACENCY MATRIX = Create an adjacency matrix from a list of edges. SPANNING FOREST = Compute the spanning forest. NEXT PERMUTATION = Generate the next permutation of a positive integer. RANDOM PERMUTATION = Generate a random permutation of a positive integer.
References: Skiena (1998), "The Algorithm Design Manual", Telos. Applications:
Graph Theory
Implementation Date:
2009/1
Program:
```
2 3
4 7
1 9
7 11
5 8
2 5
6 10
2 8
3 8
4 11
end of data
.
80 80
40 20
40 80
10 20
60 80
80 20
18 60
60 20
90 80
90 20
25 20
82 50
90 50
98 50
end of data
.
let y2 x2 tag = edges to vertices edge1 edge2 y1 x1
.
limits 0 100
let nvert = size y1
let ivert = sequence 1 1 nvert
character automatic ivert
character offset 2 2 all
line blank all
plot y1 x1 ivert
.
pre-erase off
character blank all
line solid all
plot y2 x2 tag
.
pre-erase on
limits
```

Date created: 1/26/2009
Last updated: 1/26/2009