Learn R Programming

mathgraph (version 0.9-14)

adjamat: Adjacency Matrix of a Mathematical Graph

Description

Returns an object of class "adjamat" which is the adjacency matrix of a numbered graph.

Usage

adjamat(x, …)
# S3 method for mathgraph
adjamat(x, general=FALSE, …)

is.adjamat(x)

Arguments

x

an object of class "mathgraph".

general

logical flag, if TRUE, then multiple edges or arcs between the same nodes are counted; otherwise, there is a 1 no matter how many edges or arcs there are.

other arguments for generic function.

Value

An object of class "adjamat" which is a square matrix with as many rows and columns as there are nodes in the numbered graph. The i,j element is an indicator of an arc from node i to node j. An undirected edge between nodes i and j contributes a 1 to both the i,j element and the j,i element.

is.adjamat is the membership function for this class.

BUGS

The general argument to adjamat.mathgraph is not functional.

Details

adjamat is a generic function with a method for class "mathgraph".

References

Chachra, V., Ghare, P. M. and Moore, J. M. (1979). Applications of Graph Theory Algorithms. Elvesier North Holland, New York.

Harary, Frank (1969). Graph Theory, p. 158. Addison Wesley.

See Also

mathgraph, incidmat, getpath.adjamat

Examples

Run this code
# NOT RUN {
adjamat(mathgraph(~ 1:3 * 3:5, dir=TRUE))
# }

Run the code above in your browser using DataLab