IGraph/M Library - ConfigurationModelDoes DegreeGraphDistribution sample uniformly?How can I conveniently call igraph from Mathematica?Fast code to generate large random graph with fixed degree sequenceHow to use DegreeGraphDistribution with directed graphs?Dynamic graph construction and visualization (Watts' “Small Worlds” α-model)Fast way to get edge-list of graph in terms of vertex indices (not vertex names)what Mathematica Export Graph Format is easy to load in R?Power law fitting package that optimizes fitting parameters based off of the KolmogorovSmirnov MC methodHelp to model fitting a distribution of weights in weighted graphs : power or exponential law?Does DegreeGraphDistribution sample uniformly?

How is it possible to have an ability score that is less than 3?

Were any external disk drives stacked vertically?

Is it legal for company to use my work email to pretend I still work there?

How to format long polynomial?

Why does Kotter return in Welcome Back Kotter?

Performing Transactions cleanup

Operational amplifier as comparator at high frequency

What is a clear way to write a bar that has an extra beat?

How much RAM could one put in a typical 80386 setup?

Do infinite dimensional systems make sense?

When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?

Question relative to pads for capacitors - high frequency

dbcc cleantable batch size explanation

What's that red-plus icon near a text?

How to source a part of a file

Does Otiluke's Resilient Sphere beat Magic Circle?

List<T>.RemoveAll() efficiency / compiler optimisation

Arrow those variables!

Languages that we cannot (dis)prove to be Context-Free

Why doesn't a class having private constructor prevent inheriting from this class? How to control which classes can inherit from a certain base?

Are astronomers waiting to see something in an image from a gravitational lens that they've already seen in an adjacent image?

Convert two switches to a dual stack, and add outlet - possible here?

Why are electrically insulating heatsinks so rare? Is it just cost?

Horror movie about the virus at the prom; beginning and end are stylized as a cartoon



IGraph/M Library - ConfigurationModel


Does DegreeGraphDistribution sample uniformly?How can I conveniently call igraph from Mathematica?Fast code to generate large random graph with fixed degree sequenceHow to use DegreeGraphDistribution with directed graphs?Dynamic graph construction and visualization (Watts' “Small Worlds” α-model)Fast way to get edge-list of graph in terms of vertex indices (not vertex names)what Mathematica Export Graph Format is easy to load in R?Power law fitting package that optimizes fitting parameters based off of the KolmogorovSmirnov MC methodHelp to model fitting a distribution of weights in weighted graphs : power or exponential law?Does DegreeGraphDistribution sample uniformly?













6












$begingroup$


I am trying to reproduce a network generated by a configuration model given degree vector truncated power law distribution.



I am relying on the following function from the IGraph/M package for Mathematica:



IGDegreeSequenceGame[yy, Method -> "FastSimple"];


where yy is the data and FastSimple is the method option.



An example degree sequence is



yy = 10, 7, 6, 6, 7, 8, 9, 11, 8, 7, 6, 9, 13, 8, 13, 19, 6, 12, 11, 11, 6, 7, 6, 6, 12;


Method doesn't converge; the dimension of yy is 25, and I would like to use it on bigger networks.



Is there a fast way I can generate a network from a configuration model (without loops) with Mathematica?










share|improve this question











$endgroup$











  • $begingroup$
    Can you give a concrete example for yy?
    $endgroup$
    – Szabolcs
    Mar 26 at 15:14










  • $begingroup$
    yy is sampled from degree vector truncated power law distribution. An example could be: 10, 7, 6, 6, 7, 8, 9, 11, 8, 7, 6, 9, 13, 8, 13, 19, 6, 12, 11, 11, 6, 7, 6, 6, 12 , where the degree distribution has k0 = 6 as lower cutoff, gamma = 2.5 as power law coefficient, and kmax is the natural cutoff
    $endgroup$
    – Alberto Artoni
    Mar 26 at 15:18







  • 1




    $begingroup$
    Thanks. Next time please edit all such information into the question itself. I did the edit this time to illustrate what I mean.
    $endgroup$
    – Szabolcs
    Mar 26 at 15:22










  • $begingroup$
    With FastSimple and the example yy that you provided, I get an immediate output. However, FastSimple does not implement the configuration model, and does not sample uniformly. Did you mean ConfigurationModelSimple? Was it not clear from the documentation that FastSimple is not the configuration model? I welcome all suggestion to improve the documentation.
    $endgroup$
    – Szabolcs
    Mar 26 at 15:25










  • $begingroup$
    Also, make sure you are using the latest version of IGraph/M (currently 0.3.108)
    $endgroup$
    – Szabolcs
    Mar 26 at 15:29















6












$begingroup$


I am trying to reproduce a network generated by a configuration model given degree vector truncated power law distribution.



I am relying on the following function from the IGraph/M package for Mathematica:



IGDegreeSequenceGame[yy, Method -> "FastSimple"];


where yy is the data and FastSimple is the method option.



An example degree sequence is



yy = 10, 7, 6, 6, 7, 8, 9, 11, 8, 7, 6, 9, 13, 8, 13, 19, 6, 12, 11, 11, 6, 7, 6, 6, 12;


Method doesn't converge; the dimension of yy is 25, and I would like to use it on bigger networks.



Is there a fast way I can generate a network from a configuration model (without loops) with Mathematica?










share|improve this question











$endgroup$











  • $begingroup$
    Can you give a concrete example for yy?
    $endgroup$
    – Szabolcs
    Mar 26 at 15:14










  • $begingroup$
    yy is sampled from degree vector truncated power law distribution. An example could be: 10, 7, 6, 6, 7, 8, 9, 11, 8, 7, 6, 9, 13, 8, 13, 19, 6, 12, 11, 11, 6, 7, 6, 6, 12 , where the degree distribution has k0 = 6 as lower cutoff, gamma = 2.5 as power law coefficient, and kmax is the natural cutoff
    $endgroup$
    – Alberto Artoni
    Mar 26 at 15:18







  • 1




    $begingroup$
    Thanks. Next time please edit all such information into the question itself. I did the edit this time to illustrate what I mean.
    $endgroup$
    – Szabolcs
    Mar 26 at 15:22










  • $begingroup$
    With FastSimple and the example yy that you provided, I get an immediate output. However, FastSimple does not implement the configuration model, and does not sample uniformly. Did you mean ConfigurationModelSimple? Was it not clear from the documentation that FastSimple is not the configuration model? I welcome all suggestion to improve the documentation.
    $endgroup$
    – Szabolcs
    Mar 26 at 15:25










  • $begingroup$
    Also, make sure you are using the latest version of IGraph/M (currently 0.3.108)
    $endgroup$
    – Szabolcs
    Mar 26 at 15:29













6












6








6





$begingroup$


I am trying to reproduce a network generated by a configuration model given degree vector truncated power law distribution.



I am relying on the following function from the IGraph/M package for Mathematica:



IGDegreeSequenceGame[yy, Method -> "FastSimple"];


where yy is the data and FastSimple is the method option.



An example degree sequence is



yy = 10, 7, 6, 6, 7, 8, 9, 11, 8, 7, 6, 9, 13, 8, 13, 19, 6, 12, 11, 11, 6, 7, 6, 6, 12;


Method doesn't converge; the dimension of yy is 25, and I would like to use it on bigger networks.



Is there a fast way I can generate a network from a configuration model (without loops) with Mathematica?










share|improve this question











$endgroup$




I am trying to reproduce a network generated by a configuration model given degree vector truncated power law distribution.



I am relying on the following function from the IGraph/M package for Mathematica:



IGDegreeSequenceGame[yy, Method -> "FastSimple"];


where yy is the data and FastSimple is the method option.



An example degree sequence is



yy = 10, 7, 6, 6, 7, 8, 9, 11, 8, 7, 6, 9, 13, 8, 13, 19, 6, 12, 11, 11, 6, 7, 6, 6, 12;


Method doesn't converge; the dimension of yy is 25, and I would like to use it on bigger networks.



Is there a fast way I can generate a network from a configuration model (without loops) with Mathematica?







graphs-and-networks igraphm






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 16:15









Szabolcs

163k14447944




163k14447944










asked Mar 26 at 15:09









Alberto ArtoniAlberto Artoni

313




313











  • $begingroup$
    Can you give a concrete example for yy?
    $endgroup$
    – Szabolcs
    Mar 26 at 15:14










  • $begingroup$
    yy is sampled from degree vector truncated power law distribution. An example could be: 10, 7, 6, 6, 7, 8, 9, 11, 8, 7, 6, 9, 13, 8, 13, 19, 6, 12, 11, 11, 6, 7, 6, 6, 12 , where the degree distribution has k0 = 6 as lower cutoff, gamma = 2.5 as power law coefficient, and kmax is the natural cutoff
    $endgroup$
    – Alberto Artoni
    Mar 26 at 15:18







  • 1




    $begingroup$
    Thanks. Next time please edit all such information into the question itself. I did the edit this time to illustrate what I mean.
    $endgroup$
    – Szabolcs
    Mar 26 at 15:22










  • $begingroup$
    With FastSimple and the example yy that you provided, I get an immediate output. However, FastSimple does not implement the configuration model, and does not sample uniformly. Did you mean ConfigurationModelSimple? Was it not clear from the documentation that FastSimple is not the configuration model? I welcome all suggestion to improve the documentation.
    $endgroup$
    – Szabolcs
    Mar 26 at 15:25










  • $begingroup$
    Also, make sure you are using the latest version of IGraph/M (currently 0.3.108)
    $endgroup$
    – Szabolcs
    Mar 26 at 15:29
















  • $begingroup$
    Can you give a concrete example for yy?
    $endgroup$
    – Szabolcs
    Mar 26 at 15:14










  • $begingroup$
    yy is sampled from degree vector truncated power law distribution. An example could be: 10, 7, 6, 6, 7, 8, 9, 11, 8, 7, 6, 9, 13, 8, 13, 19, 6, 12, 11, 11, 6, 7, 6, 6, 12 , where the degree distribution has k0 = 6 as lower cutoff, gamma = 2.5 as power law coefficient, and kmax is the natural cutoff
    $endgroup$
    – Alberto Artoni
    Mar 26 at 15:18







  • 1




    $begingroup$
    Thanks. Next time please edit all such information into the question itself. I did the edit this time to illustrate what I mean.
    $endgroup$
    – Szabolcs
    Mar 26 at 15:22










  • $begingroup$
    With FastSimple and the example yy that you provided, I get an immediate output. However, FastSimple does not implement the configuration model, and does not sample uniformly. Did you mean ConfigurationModelSimple? Was it not clear from the documentation that FastSimple is not the configuration model? I welcome all suggestion to improve the documentation.
    $endgroup$
    – Szabolcs
    Mar 26 at 15:25










  • $begingroup$
    Also, make sure you are using the latest version of IGraph/M (currently 0.3.108)
    $endgroup$
    – Szabolcs
    Mar 26 at 15:29















$begingroup$
Can you give a concrete example for yy?
$endgroup$
– Szabolcs
Mar 26 at 15:14




$begingroup$
Can you give a concrete example for yy?
$endgroup$
– Szabolcs
Mar 26 at 15:14












$begingroup$
yy is sampled from degree vector truncated power law distribution. An example could be: 10, 7, 6, 6, 7, 8, 9, 11, 8, 7, 6, 9, 13, 8, 13, 19, 6, 12, 11, 11, 6, 7, 6, 6, 12 , where the degree distribution has k0 = 6 as lower cutoff, gamma = 2.5 as power law coefficient, and kmax is the natural cutoff
$endgroup$
– Alberto Artoni
Mar 26 at 15:18





$begingroup$
yy is sampled from degree vector truncated power law distribution. An example could be: 10, 7, 6, 6, 7, 8, 9, 11, 8, 7, 6, 9, 13, 8, 13, 19, 6, 12, 11, 11, 6, 7, 6, 6, 12 , where the degree distribution has k0 = 6 as lower cutoff, gamma = 2.5 as power law coefficient, and kmax is the natural cutoff
$endgroup$
– Alberto Artoni
Mar 26 at 15:18





1




1




$begingroup$
Thanks. Next time please edit all such information into the question itself. I did the edit this time to illustrate what I mean.
$endgroup$
– Szabolcs
Mar 26 at 15:22




$begingroup$
Thanks. Next time please edit all such information into the question itself. I did the edit this time to illustrate what I mean.
$endgroup$
– Szabolcs
Mar 26 at 15:22












$begingroup$
With FastSimple and the example yy that you provided, I get an immediate output. However, FastSimple does not implement the configuration model, and does not sample uniformly. Did you mean ConfigurationModelSimple? Was it not clear from the documentation that FastSimple is not the configuration model? I welcome all suggestion to improve the documentation.
$endgroup$
– Szabolcs
Mar 26 at 15:25




$begingroup$
With FastSimple and the example yy that you provided, I get an immediate output. However, FastSimple does not implement the configuration model, and does not sample uniformly. Did you mean ConfigurationModelSimple? Was it not clear from the documentation that FastSimple is not the configuration model? I welcome all suggestion to improve the documentation.
$endgroup$
– Szabolcs
Mar 26 at 15:25












$begingroup$
Also, make sure you are using the latest version of IGraph/M (currently 0.3.108)
$endgroup$
– Szabolcs
Mar 26 at 15:29




$begingroup$
Also, make sure you are using the latest version of IGraph/M (currently 0.3.108)
$endgroup$
– Szabolcs
Mar 26 at 15:29










1 Answer
1






active

oldest

votes


















7












$begingroup$

Exact sampling with a given degree sequence



The example degree sequence that you provided is:



yy = 10, 7, 6, 6, 7, 8, 9, 11, 8, 7, 6, 9, 13, 8, 13, 19, 6, 12, 11, 11, 6, 7, 6, 6, 12;


With this degree sequence,



IGDegreeSequenceGame[yy, Method -> "FastSimple"]


returns immediately, contrary to your claim.




However, Method -> "FastSimple" does not implement the configuration model. It implements a similar algorithm that is much faster but does not sample graphs uniformly. In other words, not all graphs that have this degree sequence will be generated with the same probability.



To use the configuration model to generate simple graphs, use



IGDegreeSequenceGame[yy, Method -> "ConfigurationModelSimple"]


As you say, this will not return. It takes too long. This algorithm (i.e. the configuration model) is simply too slow on this degree sequence, whether implemented in IGraph/M or another package.



I am not aware of any method which is capable of the exact and uniform sampling of simple graphs with such a degree sequence (if you are, let me know).



Approximate sampling with MCMC



One alternative option you have is to use Markov-Chain based sampling. First, create a single realization of the degree sequence then "shuffle its edges around" while keeping the degree sequence with IGRewire. Provided that enough rewiring steps are made, this method will sample approximately uniformly. It would sample uniformly for an infinite number of rewiring steps.



g = IGRealizeDegreeSequence[yy]
IGRewire[g, 1000]


You can use some heuristics to decide on how many rewiring steps are sufficient for the degree sequence you are working with. For example, correlations seem to be lost with less than 1000 rewiring steps for the sequence you quoted.



am = AdjacencyMatrix[g];
ListLogLinearPlot@Table[
k, Flatten[am].Flatten@AdjacencyMatrix@IGRewire[g, k],
k, Round[2^Range[0, 15, 0.1]]
]


enter image description here



You can also use Method -> "VigerLatapy" in IGDegreeSequenceGame, which implements a similar method for sampling connected graphs specifically. See the documentation for a reference to the paper.



Sampling graphs with power-law degree distributions



If your goal is to generate a graph with a power-law degree distribution (not a specific degree sequence), also take a look at IGStaticPowerLawGame. See the references within the C/igraph documentation for how it works. It implements a variation of the Chung-Lu model.



A note about the built-in DegreeGraphDistribution



A note about RandomGraph[DegreeGraphDistribution[...]]: it does not sample uniformly and I was not able to get information from Wolfram Support about how this method works. I would be cautious when using it.






share|improve this answer











$endgroup$













    Your Answer





    StackExchange.ifUsing("editor", function ()
    return StackExchange.using("mathjaxEditing", function ()
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    );
    );
    , "mathjax-editing");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "387"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f193983%2figraph-m-library-configurationmodel%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    7












    $begingroup$

    Exact sampling with a given degree sequence



    The example degree sequence that you provided is:



    yy = 10, 7, 6, 6, 7, 8, 9, 11, 8, 7, 6, 9, 13, 8, 13, 19, 6, 12, 11, 11, 6, 7, 6, 6, 12;


    With this degree sequence,



    IGDegreeSequenceGame[yy, Method -> "FastSimple"]


    returns immediately, contrary to your claim.




    However, Method -> "FastSimple" does not implement the configuration model. It implements a similar algorithm that is much faster but does not sample graphs uniformly. In other words, not all graphs that have this degree sequence will be generated with the same probability.



    To use the configuration model to generate simple graphs, use



    IGDegreeSequenceGame[yy, Method -> "ConfigurationModelSimple"]


    As you say, this will not return. It takes too long. This algorithm (i.e. the configuration model) is simply too slow on this degree sequence, whether implemented in IGraph/M or another package.



    I am not aware of any method which is capable of the exact and uniform sampling of simple graphs with such a degree sequence (if you are, let me know).



    Approximate sampling with MCMC



    One alternative option you have is to use Markov-Chain based sampling. First, create a single realization of the degree sequence then "shuffle its edges around" while keeping the degree sequence with IGRewire. Provided that enough rewiring steps are made, this method will sample approximately uniformly. It would sample uniformly for an infinite number of rewiring steps.



    g = IGRealizeDegreeSequence[yy]
    IGRewire[g, 1000]


    You can use some heuristics to decide on how many rewiring steps are sufficient for the degree sequence you are working with. For example, correlations seem to be lost with less than 1000 rewiring steps for the sequence you quoted.



    am = AdjacencyMatrix[g];
    ListLogLinearPlot@Table[
    k, Flatten[am].Flatten@AdjacencyMatrix@IGRewire[g, k],
    k, Round[2^Range[0, 15, 0.1]]
    ]


    enter image description here



    You can also use Method -> "VigerLatapy" in IGDegreeSequenceGame, which implements a similar method for sampling connected graphs specifically. See the documentation for a reference to the paper.



    Sampling graphs with power-law degree distributions



    If your goal is to generate a graph with a power-law degree distribution (not a specific degree sequence), also take a look at IGStaticPowerLawGame. See the references within the C/igraph documentation for how it works. It implements a variation of the Chung-Lu model.



    A note about the built-in DegreeGraphDistribution



    A note about RandomGraph[DegreeGraphDistribution[...]]: it does not sample uniformly and I was not able to get information from Wolfram Support about how this method works. I would be cautious when using it.






    share|improve this answer











    $endgroup$

















      7












      $begingroup$

      Exact sampling with a given degree sequence



      The example degree sequence that you provided is:



      yy = 10, 7, 6, 6, 7, 8, 9, 11, 8, 7, 6, 9, 13, 8, 13, 19, 6, 12, 11, 11, 6, 7, 6, 6, 12;


      With this degree sequence,



      IGDegreeSequenceGame[yy, Method -> "FastSimple"]


      returns immediately, contrary to your claim.




      However, Method -> "FastSimple" does not implement the configuration model. It implements a similar algorithm that is much faster but does not sample graphs uniformly. In other words, not all graphs that have this degree sequence will be generated with the same probability.



      To use the configuration model to generate simple graphs, use



      IGDegreeSequenceGame[yy, Method -> "ConfigurationModelSimple"]


      As you say, this will not return. It takes too long. This algorithm (i.e. the configuration model) is simply too slow on this degree sequence, whether implemented in IGraph/M or another package.



      I am not aware of any method which is capable of the exact and uniform sampling of simple graphs with such a degree sequence (if you are, let me know).



      Approximate sampling with MCMC



      One alternative option you have is to use Markov-Chain based sampling. First, create a single realization of the degree sequence then "shuffle its edges around" while keeping the degree sequence with IGRewire. Provided that enough rewiring steps are made, this method will sample approximately uniformly. It would sample uniformly for an infinite number of rewiring steps.



      g = IGRealizeDegreeSequence[yy]
      IGRewire[g, 1000]


      You can use some heuristics to decide on how many rewiring steps are sufficient for the degree sequence you are working with. For example, correlations seem to be lost with less than 1000 rewiring steps for the sequence you quoted.



      am = AdjacencyMatrix[g];
      ListLogLinearPlot@Table[
      k, Flatten[am].Flatten@AdjacencyMatrix@IGRewire[g, k],
      k, Round[2^Range[0, 15, 0.1]]
      ]


      enter image description here



      You can also use Method -> "VigerLatapy" in IGDegreeSequenceGame, which implements a similar method for sampling connected graphs specifically. See the documentation for a reference to the paper.



      Sampling graphs with power-law degree distributions



      If your goal is to generate a graph with a power-law degree distribution (not a specific degree sequence), also take a look at IGStaticPowerLawGame. See the references within the C/igraph documentation for how it works. It implements a variation of the Chung-Lu model.



      A note about the built-in DegreeGraphDistribution



      A note about RandomGraph[DegreeGraphDistribution[...]]: it does not sample uniformly and I was not able to get information from Wolfram Support about how this method works. I would be cautious when using it.






      share|improve this answer











      $endgroup$















        7












        7








        7





        $begingroup$

        Exact sampling with a given degree sequence



        The example degree sequence that you provided is:



        yy = 10, 7, 6, 6, 7, 8, 9, 11, 8, 7, 6, 9, 13, 8, 13, 19, 6, 12, 11, 11, 6, 7, 6, 6, 12;


        With this degree sequence,



        IGDegreeSequenceGame[yy, Method -> "FastSimple"]


        returns immediately, contrary to your claim.




        However, Method -> "FastSimple" does not implement the configuration model. It implements a similar algorithm that is much faster but does not sample graphs uniformly. In other words, not all graphs that have this degree sequence will be generated with the same probability.



        To use the configuration model to generate simple graphs, use



        IGDegreeSequenceGame[yy, Method -> "ConfigurationModelSimple"]


        As you say, this will not return. It takes too long. This algorithm (i.e. the configuration model) is simply too slow on this degree sequence, whether implemented in IGraph/M or another package.



        I am not aware of any method which is capable of the exact and uniform sampling of simple graphs with such a degree sequence (if you are, let me know).



        Approximate sampling with MCMC



        One alternative option you have is to use Markov-Chain based sampling. First, create a single realization of the degree sequence then "shuffle its edges around" while keeping the degree sequence with IGRewire. Provided that enough rewiring steps are made, this method will sample approximately uniformly. It would sample uniformly for an infinite number of rewiring steps.



        g = IGRealizeDegreeSequence[yy]
        IGRewire[g, 1000]


        You can use some heuristics to decide on how many rewiring steps are sufficient for the degree sequence you are working with. For example, correlations seem to be lost with less than 1000 rewiring steps for the sequence you quoted.



        am = AdjacencyMatrix[g];
        ListLogLinearPlot@Table[
        k, Flatten[am].Flatten@AdjacencyMatrix@IGRewire[g, k],
        k, Round[2^Range[0, 15, 0.1]]
        ]


        enter image description here



        You can also use Method -> "VigerLatapy" in IGDegreeSequenceGame, which implements a similar method for sampling connected graphs specifically. See the documentation for a reference to the paper.



        Sampling graphs with power-law degree distributions



        If your goal is to generate a graph with a power-law degree distribution (not a specific degree sequence), also take a look at IGStaticPowerLawGame. See the references within the C/igraph documentation for how it works. It implements a variation of the Chung-Lu model.



        A note about the built-in DegreeGraphDistribution



        A note about RandomGraph[DegreeGraphDistribution[...]]: it does not sample uniformly and I was not able to get information from Wolfram Support about how this method works. I would be cautious when using it.






        share|improve this answer











        $endgroup$



        Exact sampling with a given degree sequence



        The example degree sequence that you provided is:



        yy = 10, 7, 6, 6, 7, 8, 9, 11, 8, 7, 6, 9, 13, 8, 13, 19, 6, 12, 11, 11, 6, 7, 6, 6, 12;


        With this degree sequence,



        IGDegreeSequenceGame[yy, Method -> "FastSimple"]


        returns immediately, contrary to your claim.




        However, Method -> "FastSimple" does not implement the configuration model. It implements a similar algorithm that is much faster but does not sample graphs uniformly. In other words, not all graphs that have this degree sequence will be generated with the same probability.



        To use the configuration model to generate simple graphs, use



        IGDegreeSequenceGame[yy, Method -> "ConfigurationModelSimple"]


        As you say, this will not return. It takes too long. This algorithm (i.e. the configuration model) is simply too slow on this degree sequence, whether implemented in IGraph/M or another package.



        I am not aware of any method which is capable of the exact and uniform sampling of simple graphs with such a degree sequence (if you are, let me know).



        Approximate sampling with MCMC



        One alternative option you have is to use Markov-Chain based sampling. First, create a single realization of the degree sequence then "shuffle its edges around" while keeping the degree sequence with IGRewire. Provided that enough rewiring steps are made, this method will sample approximately uniformly. It would sample uniformly for an infinite number of rewiring steps.



        g = IGRealizeDegreeSequence[yy]
        IGRewire[g, 1000]


        You can use some heuristics to decide on how many rewiring steps are sufficient for the degree sequence you are working with. For example, correlations seem to be lost with less than 1000 rewiring steps for the sequence you quoted.



        am = AdjacencyMatrix[g];
        ListLogLinearPlot@Table[
        k, Flatten[am].Flatten@AdjacencyMatrix@IGRewire[g, k],
        k, Round[2^Range[0, 15, 0.1]]
        ]


        enter image description here



        You can also use Method -> "VigerLatapy" in IGDegreeSequenceGame, which implements a similar method for sampling connected graphs specifically. See the documentation for a reference to the paper.



        Sampling graphs with power-law degree distributions



        If your goal is to generate a graph with a power-law degree distribution (not a specific degree sequence), also take a look at IGStaticPowerLawGame. See the references within the C/igraph documentation for how it works. It implements a variation of the Chung-Lu model.



        A note about the built-in DegreeGraphDistribution



        A note about RandomGraph[DegreeGraphDistribution[...]]: it does not sample uniformly and I was not able to get information from Wolfram Support about how this method works. I would be cautious when using it.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 26 at 16:14

























        answered Mar 26 at 15:45









        SzabolcsSzabolcs

        163k14447944




        163k14447944



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Mathematica Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f193983%2figraph-m-library-configurationmodel%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

            Luettelo Yhdysvaltain laivaston lentotukialuksista Lähteet | Navigointivalikko

            Gary (muusikko) Sisällysluettelo Historia | Rockin' High | Lähteet | Aiheesta muualla | NavigointivalikkoInfobox OKTuomas "Gary" Keskinen Ancaran kitaristiksiProjekti Rockin' High