summaryrefslogtreecommitdiff
path: root/networkx/classes/multidigraph.py
diff options
context:
space:
mode:
authorDan Schult <dschult@colgate.edu>2015-07-29 14:52:46 -0600
committerDan Schult <dschult@colgate.edu>2015-07-29 14:52:46 -0600
commit070ab8e72594e29697530f0b404f52c4676ffb71 (patch)
treec661bd41e1dd63ddffae028d79964e5629277130 /networkx/classes/multidigraph.py
parent0780b8496a219f4ed0f495db5e776450be31c414 (diff)
parenta42df76b765460ca457004e5bf35962b827e2fc4 (diff)
downloadnetworkx-iter_refactor.tar.gz
Merge pull request #1677 from MridulS/docupiter_refactor
Update classes docs
Diffstat (limited to 'networkx/classes/multidigraph.py')
-rw-r--r--networkx/classes/multidigraph.py37
1 files changed, 27 insertions, 10 deletions
diff --git a/networkx/classes/multidigraph.py b/networkx/classes/multidigraph.py
index 1623502b..654ca08e 100644
--- a/networkx/classes/multidigraph.py
+++ b/networkx/classes/multidigraph.py
@@ -166,7 +166,8 @@ class MultiDiGraph(MultiGraph,DiGraph):
**Reporting:**
Simple graph information is obtained using methods.
- Iterator versions of many reporting methods exist for efficiency.
+ Reporting methods usually return iterators instead of containers
+ to reduce memory usage.
Methods exist for reporting nodes(), edges(), neighbors() and degree()
as well as the number of nodes and edges.
@@ -459,6 +460,9 @@ class MultiDiGraph(MultiGraph,DiGraph):
>>> list(G.edges(0))
[(0, 1)]
+ See Also
+ --------
+ in_edges, out_edges
"""
if nbunch is None:
nodes_nbrs = self.adj.items()
@@ -530,10 +534,10 @@ class MultiDiGraph(MultiGraph,DiGraph):
def degree(self, nbunch=None, weight=None):
- """Return an iterator for (node, degree) and degree for single node.
+ """Return an iterator for (node, degree) or degree for single node.
The node degree is the number of edges adjacent to the node.
- This function returns the degree for a single node and an iterator
+ This function returns the degree for a single node or an iterator
for a bunch of nodes or if nothing is passed as argument.
Parameters
@@ -549,11 +553,18 @@ class MultiDiGraph(MultiGraph,DiGraph):
Returns
-------
+ If a single nodes is requested
deg:
- Degree of the node, if a single node is passed as argument.
+ Degree of the node
+
+ OR if multiple nodes are requested
nd_iter : an iterator
The iterator returns two-tuples of (node, degree).
+ See Also
+ --------
+ out_degree, in_degree
+
Examples
--------
>>> G = nx.MultiDiGraph()
@@ -606,10 +617,10 @@ class MultiDiGraph(MultiGraph,DiGraph):
return d_iter()
def in_degree(self, nbunch=None, weight=None):
- """Return an iterator for (node, in-degree) and in-degree for single node.
+ """Return an iterator for (node, in-degree) or in-degree for single node.
The node in-degree is the number of edges pointing in to the node.
- This function returns the in-degree for a single node and an iterator
+ This function returns the in-degree for a single node or an iterator
for a bunch of nodes or if nothing is passed as argument.
Parameters
@@ -625,8 +636,11 @@ class MultiDiGraph(MultiGraph,DiGraph):
Returns
-------
+ If a single node is requested
deg:
- Degree of the node, if a single node is passed as argument.
+ Degree of the node
+
+ OR if multiple nodes are requested
nd_iter : an iterator
The iterator returns two-tuples of (node, in-degree).
@@ -673,10 +687,10 @@ class MultiDiGraph(MultiGraph,DiGraph):
return d_iter()
def out_degree(self, nbunch=None, weight=None):
- """Return an iterator for (node, out-degree) and out-degree for single node.
+ """Return an iterator for (node, out-degree) or out-degree for single node.
The node out-degree is the number of edges pointing out of the node.
- This function returns the out-degree for a single node and an iterator
+ This function returns the out-degree for a single node or an iterator
for a bunch of nodes or if nothing is passed as argument.
Parameters
@@ -692,8 +706,11 @@ class MultiDiGraph(MultiGraph,DiGraph):
Returns
-------
+ If a single node is requested
deg:
- Degree of the node, if a single node is passed as argument.
+ Degree of the node
+
+ OR if multiple nodes are requested
nd_iter : an iterator
The iterator returns two-tuples of (node, out-degree).