GraphTheory[Graph]
|
Calling Sequence
|
|
Graph(V)
Graph(n)
Graph(V, E)
Graph(L)
Graph(V, L)
Graph(T)
Graph(A)
Graph(V, E, A)
Graph(D, W, V, E, A)
Graph(N)
|
|
Parameters
|
|
V
|
-
|
(optional) list of vertices (integers, symbols, or strings)
|
n
|
-
|
(optional) positive integer specifying the vertices 1,2,...,n
|
E
|
-
|
(optional) set of edges
|
L
|
-
|
(optional) list or Array of neighbors
|
T
|
-
|
(optional) function of the form Trail(a,b,c,,...) or Trail([a,b,c,...])
|
A
|
-
|
(optional) adjacency Matrix (of edge weights)
|
D
|
-
|
(optional) symbol, one of directed or undirected
|
W
|
-
|
(optional) symbol, one of weighted or unweighted
|
N
|
-
|
(optional) procedure (a networks graph)
|
|
|
|
|
Description
|
|
•
|
The type of each argument determines what it is. Because of this the arguments can appear in any order.
|
•
|
A symbol can be one of directed, undirected, weighted, or unweighted. This specifies the type of the graph. If not specified, a default is chosen depending on the type of the other inputs.
|
•
|
An integer n specifies the number of vertices and implicitly the vertex labels 1 through n.
|
•
|
A list V of integers, symbols or strings specifies the vertices. Each vertex must be an integer, symbol or string.
|
•
|
An Array (or list) of lists / sets of vertices L specifies a mapping from vertices to their neighbors. Note that the mapping is an integer mapping that indicates the vertices (if the vertices are labeled as ) or the location of each vertex in the vertex list V. If the graph is undirected, then the lists / sets of neighbors must be symmetric.
|
•
|
A function T of the form Trail(a,b,c,...) or Trail([a,b,c,...]) specifies a trail of edges from a to b to c .... By default the edges are undirected. If the symbol directed is specified as an option then they are directed. More than one trail may be specified. This is often the easiest way to enter a graph interactively.
|
•
|
A matrix A means the adjacency matrix. A symmetric matrix is interpreted as an undirected graph unless the edge direction is stated otherwise. Likewise, a matrix of 0's and 1's is interpreted as an unweighted graph unless specified otherwise.
|
•
|
A procedure N means a networks graph. This option allows conversion from a networks graph representation to the GraphTheory representation. Note, the GraphTheory package does not support multigraphs.
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
>
|
|
| (6) |
>
|
|
>
|
|
| (7) |
>
|
|
| (8) |
>
|
|
>
|
|
>
|
|
| (9) |
>
|
|
| (10) |
>
|
|
| (11) |
>
|
|
| (12) |
>
|
|
| (13) |
>
|
|
| (14) |
>
|
|
| (15) |
>
|
|
| (16) |
>
|
|
>
|
|
| (17) |
>
|
|
| (18) |
>
|
|
| (19) |
>
|
|
| (20) |
>
|
|
>
|
|
| (21) |
>
|
|
| (22) |
>
|
|
| (23) |
>
|
|
>
|
|
| (24) |
>
|
|
| (25) |
>
|
|
| (26) |
>
|
|
| (27) |
>
|
|
| (28) |
>
|
|
| (29) |
>
|
|
| (30) |
>
|
|
| (31) |
>
|
|
| (32) |
>
|
|
| (33) |
|
|