Package networkx :: Module function
[hide private]
[frames] | no frames]

Module function

source code

Functional interface to graph properties.


Author: Aric Hagberg (hagberg@lanl.gov) Pieter Swart (swart@lanl.gov) Dan Schult(dschult@colgate.edu)

Functions [hide private]
 
nodes(G)
Return a copy of the graph nodes in a list.
source code
 
nodes_iter(G)
Return an iterator over the graph nodes.
source code
 
edges(G, nbunch=None)
Return list of edges adjacent to nodes in nbunch.
source code
 
edges_iter(G, nbunch=None)
Return iterator over edges adjacent to nodes in nbunch.
source code
 
degree(G, nbunch=None, with_labels=False)
Return degree of single node or of nbunch of nodes.
source code
 
neighbors(G, n)
Return a list of nodes connected to node n.
source code
 
number_of_nodes(G)
Return the order of a graph = number of nodes.
source code
 
number_of_edges(G)
Return the size of a graph = number of edges.
source code
 
density(G)
Return the density of a graph.
source code
 
degree_histogram(G)
Return a list of the frequency of each degree value.
source code
 
is_directed(G)
Return True if graph is directed.
source code
 
_test_suite() source code
Function Details [hide private]

edges(G, nbunch=None)

source code 

Return list of edges adjacent to nodes in nbunch.

Return all edges if nbunch is unspecified or nbunch=None.

For digraphs, edges=out_edges

edges_iter(G, nbunch=None)

source code 

Return iterator over edges adjacent to nodes in nbunch.

Return all edges if nbunch is unspecified or nbunch=None.

For digraphs, edges=out_edges

degree(G, nbunch=None, with_labels=False)

source code 
Return degree of single node or of nbunch of nodes. If nbunch is ommitted, then return degrees of all nodes.

density(G)

source code 

Return the density of a graph.

density = size/(order*(order-1)/2) density()=0.0 for an edge-less graph and 1.0 for a complete graph.

degree_histogram(G)

source code 

Return a list of the frequency of each degree value.

The degree values are the index in the list. Note: the bins are width one, hence len(list) can be large (Order(number_of_edges))