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 9064939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:22:50+00:00 2026-06-16T16:22:50+00:00

I would like to generate a grandom graph in R using any of the

  • 0

I would like to generate a grandom graph in R using any of the packages.

The desired output would be a two column matrix with the first column listing agents and the second column their connections of the following form:

1 3
1 4
1 6
1 7
2 2
2 5
3 9
3 11
3 32
3 43
3 2
4 5

I would like to be able to specify the average degree and minimum and maximum number of contacts.

What is the easiest way of doing this?

  • 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-06-16T16:22:51+00:00Added an answer on June 16, 2026 at 4:22 pm

    Since you don’t specify the need for anything other than just a graph we ca do this very simply:

    actor     <- sample(1:4, 10, replace=TRUE)
    receiver  <- sample(3:43, 10, replace=TRUE)
    graph     <- cbind(actor,receiver)
    

    if you want something more specific have a look at igraph for instance

    library(igraph)
    graph <- erdos.renyi.game(21, 0.3, type=c("gnp", "gnm"),
                  directed = FALSE, loops = FALSE)
    
    # here the 0.3 is the probability of ties and 21 is the number of nodes
    # this is a one mode network
    

    or using package bipartite which focuses specifically on two mode networks:

    library(bipartite)
    web <- genweb(N1 = 5, N2 = 10, dens = 2)
    web2edges(web,return=TRUE)
    
    # here N1 is the number of nodes in set 1 and N2 the number of nodes in set 2
    # and dens the average number of ties per node
    

    There are many things to take into account, for instance if you want to constrain the degree distribution, probablity of ties between agents etc.

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

Sidebar

Related Questions

I would like to generate the following output, using a single row from a
I would like to generate a graphical sitemap for my website. There are two
i would like to generate strict alphanumeric character logins from users' first and lastname.
I would like to generate a .jpg file by using vb.net desktop application. Example:
I would like to generate SHA1 or similar hashes using only client-side Javascript. In
I would like to generate a random real symmetric square matrix with entries uniformly
I would like to generate anagram output of a given string without the help
I would like to generate a SQLFORM with radiobuttons using the radiobutton widget as
I would like to generate a random text using letter frequencies from a book
I would like to generate an Excel file using a database query in VB.Net.

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.