There is a function for creating fully connected (i.e. complete) graphs, nameley complete_graph.
import networkx as nx g = nx.complete_graph(10)
It takes an integer argument (the number of nodes in the graph) and thus you cannot control the node labels. I haven't found a function for doing that automatically, but with itertools it's easy enough:
from itertools import combinations nodes = ['A', 'B', 'C', 'D', 'E'] edges = combinations(nodes, 2) g = nx.Graph() g.add_nodes_from(nodes) g.add_edges_from(edges)
combinations(nodes, 2) will create 2-element tuples with all pair combinations of nodes which then will work as the edges in the graph.
This solution is however only valid for undirected graphs. Take a look at zubinmehta's solution for a more general approach.