Python Forum
How to use "create_degree_sequence" - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to use "create_degree_sequence" (/thread-26429.html)



How to use "create_degree_sequence" - asallili22 - May-01-2020

Hi,

I am rather new to Python and I have a difficulty to use "networkx.Utils". I want to create a graph by creating a degree sequence. However, I don't succeed to import anything from "networkx.Utils". I have installed networkx and have created graphs that I wanted. But I am not succeeding to use the utils. Here what I have done...

import networkx as nx
from networkx.utils import uniform_sequence
seq=nx.create_degree_sequence(10,uniform_sequence)
So I get the error message "ImportError: cannot import name 'uniform_sequence' from 'networkx.utils'"
Would you please help me with this issue, I would appreciate it.


RE: How to use "create_degree_sequence" - Larz60+ - May-01-2020

always post complete unmodified error traceback, we need that to properly diagnose any problem.


RE: How to use "create_degree_sequence" - asallili22 - May-04-2020

I noticed that "create_degree_sequence" is deprecated from networkx.Utils. So I succeeded to download the source code and directly use it without the need for importing the package. So the issue is solved. However, I am struggling to create a graph with the given average degree. I don't want a graph with the same degrees but I want graphs with the given average degree and large diameters.
thanks

(May-01-2020, 05:35 PM)Larz60+ Wrote: always post complete unmodified error traceback, we need that to properly diagnose any problem.
Thanks for the feedback, I will do for the future posts. For now the issue is solved but not my problem :)