graphscope.nx.generators.classic.empty_graph(n=0, create_using=None, default=<class 'graphscope.nx.classes.graph.Graph'>, **kw)[source]#

Returns the empty graph with n nodes and zero edges.

  • n (int or iterable container of nodes (default = 0)) – If n is an integer, nodes are from range(n). If n is a container of nodes, those nodes appear in the graph.

  • create_using (Graph Instance, Constructor or None) – Indicator of type of graph to return. If a Graph-type instance, then clear and use it. If None, use the default constructor. If a constructor, call it to create an empty graph.

  • default (Graph constructor (optional, default = nx.Graph)) – The constructor to use if create_using is None. If None, then nx.Graph is used. This is used when passing an unknown create_using value through your home-grown function to empty_graph and you want a default constructor other than nx.Graph.


>>> G = nx.empty_graph(10)
>>> G.number_of_nodes()
>>> G.number_of_edges()
>>> G = nx.empty_graph("ABC")
>>> G.number_of_nodes()
>>> sorted(G)
['A', 'B', 'C']