This does not seem like a trivial problem, and I can see multiple interpretations of what you describe. Can you clarify through a concrete example? Show a concrete example input, and a possible valid output from the function.
P.S. The reason why the system held your post for moderation is that it detected that it was pasted (not typed at a typical rate). Did you cross-post it to somewhere else? This is the typical reason why people end up copy/pasting. If you cross-posted, please link to the other instances of this post.
@szhorvat This is a question about moderation, not sample_degseq.
“P.S. The reason why the system held your post for moderation is that it detected that it was pasted (not typed at a typical rate). Did you cross-post it to somewhere else? This is the typical reason why people end up copy/pasting.”
Actually I typically edit in a text editor to avoid the frustration when a web page is inadvertently refreshed and one’s work is lost. So if I compose in a text editor and paste it will always be held for moderation?
I don’t know, but I don’t think so. We are still learning to use Discourse, and adapting as we go. This was a default setting. It is meant to prevent spam messages, so I assume it only applies to first-time posters. If you find any problems with this, do let me know.
The reason I commented on this (for the first time) is because there is a chance that @Alvaro_Sechinel has cross-posted the same question somewhere else. In the past, this auto-moderation action was triggered when people have written a message to the old igraph mailing list, then later posted it here as well. We don’t have a policy against cross-posting, but it is useful to cross-link cross-posts: if someone gives an answer on one forum only, people reading the question on a different forum should have a link to that answer.
So you have no constraints on how many outgoing and incoming connections a vertex can have, or on which other vertices it may connect to. Your only constraints are on the total incoming and outgoing edge weights, for each vertex. Edge weights are non-negative real numbers.
I believe this is the matrix scaling problem. There’s an overview here:
Is there any way to use the generator igraph_degree_sequence_game with positive rational numbers in the arguments in_deg and out_deg?
My idea is to use igraph_degree_sequence_game generator with the sum of edges that enter the node in the argument in_deg and the sum of edges that exit the node in the argument out_deg. I think the output would be equivalent.
I have a question regarding this issue: What if we use the “strength” function instead of “centr_degree” (to give an example) to perform a configurational model with weights? I conducted a toy test, and one problem I encountered is that it creates self-loops, and there seems to be a slight mismatch between the row sums (when I convert it to an adjacency matrix).
in sample_degseq if i try to use the method = “simple.no.multiple”, it doesn’t work, is it because this method restrict loops, and the size of the graph is smaller than the weights to assigned for each node?
Any insights or suggestions on how to address this would be greatly appreciated. Thank you in advance for your help!
As I said above, there is currently no function in igraph to construct a weighted graph with given strengths. The input to sample_degseq() must be integer degrees, not strengths.
Aside: If you need the degrees, use degree(), not centr_degree().
I suggest you create a single graph using realize_degseq(), then rewire it using rewire(graph, with=keeping_degseq(niter = 10*ecount(graph)). This will sample graphs with the given degree sequence uniformly.
Sampling with given degrees and the associated documentation will be improved in the next major version. See the C library documentation for a preview: igraph Reference Manual
thank you very much for the response!
as you suggested i tried the functions: rewire(graph, with=keeping_degseq(niter = 10*ecount(graph)), its good but the results is also an unweighted graph, no? and then it’s similar as implementing the sample_degseq function with the degree distribution?
In other hand, I am close to a solution (with the help of other post), perhaps similar to the configurational model, for bipartite spp. abundance matrix in the way (spp. x communities, in this case, unlike my previous example, it is now a bipartite matrix with abundance data that are integer, relative big values),
then you tell me what do you think about it:
degr_cent ← strength(your_graph, mode = ‘all’)
deg1 ← degr_cent[1:nrow(m_sppxcomm)]
deg2 ← degr_cent[(nrow(m_sppxcomm)+1):length(degr_cent)]
edgelist ← cbind(spp=sample(rep(rownames(m_sppxcomm), deg1)), comm=sample(rep(colnames(m_sppxch$“2005”), deg2))) # m_sppxcomm is my community matrix from which i get my graph
m_random<-as.matrix(xtabs(~spp+comm, edgelist, sparse = F))
It is not clear to me what you are looking for. You touched on a mixture of different problems including generating weighted graphs (with what precise constraint?), the bad time performance of “simple.no.multiple” and sampling bipartite graphs with given degrees.
If you can give a mathematically precise description of what you are looking for, ideally with a concrete example, then we can tell you whether this is already available in igraph, or if not, whether it is easy to implement with the current functionality.