Skip to content
Prev 369012 / 398498 Next

Visualizing a graph in the coordinate system given by x using vanila R

So I have the following problem, I need to write a function plotGraph(x , y)
in R with the following properties:

The argument x may be a matrix or data frame with two columns containing
coordinates of vertices of a graph. The argument y must be a quadratic
adjacency matrix that has as many rows and columns as x has rows. Values of
0 of NA stand for ?no connection?. Positive values stand for the connection
strength. Negative values are not allowed.

After that I need to visualize the resulting graph in the coordinate system
given by x, where connection strengths should be visualized by different
line widths and check inputs for validity.

Note: I can only use packages that are pre-loaded with R (e.g. graphics ,
grDevices).

Can someone please explain me how to do that ? I understand that y is the
information about the nodes in the network and their connections (vertices
& edges), x is the information about the network layout, i.e. where to
place the nodes. But I don't know how to do the visualization part with the
different connection strenghts ?

Thanks in advance :)