NetworkX

Table Of Contents

Previous topic

networkx.MultiDiGraph.reverse

Next topic

networkx.create_empty_copy

Operators

Operations on graphs; including union, intersection, difference, complement, subgraph.

The following operator functions provide standard relabeling and combining operations for networks.

Graph Manipulation

create_empty_copy(G[, with_nodes]) Return a copy of the graph G with all of the edges removed.
subgraph(G, nbunch[, copy]) Return the subgraph induced on nodes in nbunch.
cartesian_product(G, H[, create_using]) Return the Cartesian product of G and H.
compose(G, H[, create_using, name]) Return a new graph of G composed with H.
complement(G[, create_using, name]) Return graph complement of G.
union(G, H[, create_using, rename, name]) Return the union of graphs G and H.
disjoint_union(G, H) Return the disjoint union of graphs G and H, forcing distinct integer
intersection(G, H[, create_using]) Return a new graph that contains only the edges that exist in
difference(G, H[, create_using]) Return a new graph that contains the edges that exist in
symmetric_difference(G, H[, create_using]) Return new graph with edges that exist in
line_graph(G) Return the line graph of the graph or digraph G.
ego_graph(G, n[, center]) Returns induced subgraph of neighbors centered at node n.
stochastic_graph(G[, copy]) Return a right-stochastic representation of G.

Node Relabeling

convert_node_labels_to_integers(G[, ...]) Return a copy of G node labels replaced with integers.
relabel_nodes(G, mapping) Return a copy of G with node labels transformed by mapping.

Freezing

freeze(G) Modify graph to prevent addition of nodes or edges.
is_frozen(G) Return True if graph is frozen.”