summaryrefslogtreecommitdiff
path: root/networkx/classes/multidigraph.py
diff options
context:
space:
mode:
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).