# How to create graphs without multi-edges from the sample_pa_age function?

To investigate the properties of a citation network, I am modelling a Barabasi-Albert graph with aging exponent, and I would like to apply the igraph function sample_pa_age. However, this graph also generates multi-edges, which I would like to avoid. For the sample_pa function it is possible to choose the algorithm for generating the BA graph, but this is not an option for the sample_pa_age function. I cannot remove multi-edges afterwards, because they won’t have the correct degree distribution, and I would like the sample_pa function and the sample_pa_age function to yield the same graph (if chosen the same random seed) if the aging.exp is set to 0 for the sample_pa_age function.

Any help is appreciated!

Can you show a minimal example of a command (and random seed) that produces non-simple graphs?

Hi Ava999,
I don’t think there is a way to control this with sample_pa_age. The documentation does say “This function might generate graphs with multiple edges.”
How much will this matter? As a graph grows, the probability of multiedges gets very small (there are more nodes for the m new edges to choose from), so for large models will be an insignificant fraction. Could you just allow both to have multi-edges? Then both will be “correct” degree distributions under their models.
I’m also unclear on what you mean by having two different random models generate the “same graph”. If you want the same graph, just copy it, so you must mean something else.
DS

It does say that, but the simple examples I tried didn’t generate multi-edges. It’d be good to have an example that does to understand if multi-edges can be avoided.

Yes, sorry of course! dan_suthers does make a good point that it might not matter for larger models, I was experimenting with smaller examples to try out the function

``````set.seed(99)
h <- sample_pa_age(10, pa.exp=1, m=2, aging.exp=0)
plot(h, layout = layout_nicely)
``````

Hi Dan,
Thank you for your reply, and good point! I’ll keep that in mind when I work with the larger models, for now I was mostly trying to get a grasp of how the R functions work.

As for the “same graph”, I wanted to generate the same graph by the sample_pa function (to see if they would yield the same result), e.g.

``````set.seed(99)
g <- sample_pa(10, power = 1,m = 2)
plot(g, layout = layout_nicely)
``````

as I would with the sample_pa_age function, but with the aging.exp set to 0, so

``````set.seed(99)
h <- sample_pa_age(10, pa.exp=1, m=2, aging.exp=0)
plot(h, layout = layout_nicely)
``````

I’m sorry, I didn’t look carefully. This function does indeed create multi-edges and does not support simple graphs the same way `sample_pa()` does.

If you need a version that creates simple graphs, feel free to open a feature request at GitHub - igraph/igraph: Library for the analysis of networks Be sure to explain in detail what you need it for. I should say that no improvements were planned for this function, but if there is enough demand, we may return to it.