networkx.classes.function.info

info(G, n=None)[source]

Return a summary of information for the graph G or a single node n.

The summary includes the number of nodes and edges (or neighbours for a single node), and their average degree.

Parameters
  • G (Networkx graph) – A graph

  • n (node (any hashable)) – A node in the graph G

Returns

info – A string containing the short summary

Return type

str

Raises

NetworkXError – If n is not in the graph G