NetworkX

Table Of Contents

Previous topic

closeness_vitality

Next topic

degree

Functions

Functional interface to graph methods and assorted utilities.

Graph

degree(G[, nbunch, weight]) Return degree of single node or of nbunch of nodes.
degree_histogram(G) Return a list of the frequency of each degree value.
density(G) Return the density of a graph.
info(G[, n]) Print short summary of information for the graph G or the node n.
create_empty_copy(G[, with_nodes]) Return a copy of the graph G with all of the edges removed.
is_directed(G) Return True if graph is directed.

Nodes

nodes(G) Return a copy of the graph nodes in a list.
number_of_nodes(G) Return the number of nodes in the graph.
nodes_iter(G) Return an iterator over the graph nodes.

Edges

edges(G[, nbunch]) Return list of edges adjacent to nodes in nbunch.
number_of_edges(G) Return the number of edges in the graph.
edges_iter(G[, nbunch]) Return iterator over edges adjacent to nodes in nbunch.

Attributes

set_node_attributes(G, name, attributes) Set node attributes from dictionary of nodes and values
get_node_attributes(G, name) Get node attributes from graph
set_edge_attributes(G, name, attributes) Set edge attributes from dictionary of edge tuples and values
get_edge_attributes(G, name) Get edge attributes from graph

Freezing graph structure

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