Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6599751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:31:54+00:00 2026-05-25T18:31:54+00:00

I need to draw a network with 5 nodes and 20 directed edges (an

  • 0

I need to draw a network with 5 nodes and 20 directed edges (an edge connecting each 2 nodes) using R, but I need two features to exist:

  1. To be able to control the thickness of each edge.
  2. The edges not to be overlapping (i.e.,the edge form A to B is not drawn over the edge from B to A)

I’ve spent hours looking for a solution, and tried many packages, but there’s always a problem.

Can anybody suggest a solution please and provide a complete example as possible?

Many Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:31:54+00:00Added an answer on May 25, 2026 at 6:31 pm

    If it is ok for the lines to be curved then I know two ways. First I create an edgelist:

    Edges <- data.frame(
        from = rep(1:5,each=5),
        to = rep(1:5,times=5),
        thickness = abs(rnorm(25)))
    
    Edges <- subset(Edges,from!=to)
    

    This contains the node of origin at the first column, node of destination at the second and weight at the third. You can use my pacake qgraph to plot a weighted graph using this. By default the edges are curved if there are multiple edges between two nodes:

    library("qgraph")
    qgraph(Edges,esize=5,gray=TRUE)
    

    qgraph

    However this package is not really intended for this purpose and you can’t change the edge colors (yet, working on it:) ). You can only make all edges black with a small trick:

    qgraph(Edges,esize=5,gray=TRUE,minimum=0,cut=.Machine$double.xmin)
    

    For more control you can use the igraph package. First we make the graph:

    library("igraph")
    g <- graph.edgelist(as.matrix(Edges[,-3]))
    

    Note the conversion to matrix and subtracting one because the first node is 0. Next we define the layout:

    l <- layout.fruchterman.reingold(g)
    

    Now we can change some of the edge parameters with the E()function:

    # Define edge widths:
    E(g)$width <- Edges$thickness * 5
    
    # Define arrow widths:
    E(g)$arrow.width <- Edges$thickness * 5
    
    # Make edges curved:
    E(g)$curved <- 0.2
    

    And finally plot the graph:

    plot(g,layout=l)
    

    igraph

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to draw on my uiview without using the drawrect method but i
I need to draw some simple network topology charts, suggestions of some good tools
I need to draw text onto a window HDC along a circular path using
I need to draw a graph of write accesses of two concurrently running threads.
i need to draw two lines. can i use the same UIView subclass to
I work for the small ISP. We need to draw network topology in our
I need to draw a shape then add shadow but shadow is over the
I need to draw a chart in a JSP. I am using Charts4J to
I need to draw a complicated object with Qt primitives using QPainter. The thing
i need draw some stuff on canvas and then lick on each. I made

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.