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

Jim Lemon drjimlemon at gmail.com
Mon May 8 05:07:04 CEST 2017


Hi Ante,
As this is a homework problem, you will probably get a number of
negative replies. You might want to look at the color.scale.lines
function in the plotrix package. Perhaps you will find some clues in
the code.

Jim

On Mon, May 8, 2017 at 9:22 AM, Ante Dilber <antedilber74 at gmail.com> wrote:
> 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 :)
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list