I have an undirected graph with the following attributes and I need to do some analysis on a fully random graph and a regular graph with the same attributes.
Attributes:
Number of Nodes = 37764
Number of Edges = 518151
Average Degree = 27.44153161741341
To study the properties of random graphs, I create them using networkx.gnm_random_graph(37764,518151)
and performed my analysis. But I am very much confused about how to generate regular graphs using the same attributes.
I found two methods to generate regular graphs here using networkx.random_regular_graph(k, n)
(documentation) and igraph.Graph().K_Regular(n, k)
(documentation), but noticed that they need the degree k
to be an integer value.
But in my original graph, the value is a float value 27.44153161741341
. Now I cannot understand how to create a regular graph (or many graphs to give the same above-mentioned attributes when averaged) for my analysis.
In rephrasing my question: How to deal with the decimal part of the average degree in my case?
Language/library no bound for the solution.
A regular graph is a graph where each vertex has the same degree.
It's not possible to have a regular graph with an average decimal degree because all nodes in the graph would need to have a decimal degree.
The best you can do is:
I guess you could try something like:
where v_27 is the value for the graph with degree = 27
(and v_28 the value for the graph with degree = 28)
For example: