Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Finding the largest connected set

    Hello,

    I am wondering if anyone is aware of a Stata command that would compute the largest connected set in a network. So far, I have been using MatLab's BGL (http://dgleich.github.io/matlab-bgl/) command “components” to identify the largest connected set, but I wonder if any command like this has been developed for Stata.

    Thank you for any advice.

    Marta

  • #2
    I don't know anything about this topic, but this may be useful: https://nwcommands.wordpress.com/

    Jorge Eduardo Pérez Pérez
    www.jorgeperezperez.com

    Comment


    • #3
      You can do that easily with the "nwcommands". Check this site for instructions http://nwcommands.org. First, you need to "set" your network. There are various ways to do this, e.g. nwset, nwimport, nwfromedge... After that you can refer to a network by its "netname". Once you have your network set, finding the largest component is easy:

      // Load the example networks 'flomarriage' and 'flobusiness'
      webnwuse florentine

      // Calculate component membership and save it in variable "mycomp"
      nwcomponents flomarriage, generate(mycomp)

      // Alternatively, this generates a new variable "mylgc" which is 1 for those nodes who belong to the largest component and 0 otherwise.
      nwgen mylgc = lgc(flomarriage)

      // You can also extract the largest component and save it as a new network. This generates a new network called "mylarge".
      nwgen mylarge = large(flomarriage)

      Hope this helps.
      Thomas



      Comment

      Working...
      X