Skip to content
Snippets Groups Projects
Commit df9867f4 authored by James Stevens's avatar James Stevens
Browse files

prepend collections.abc to types in docs

parent 69fde78f
No related branches found
No related tags found
1 merge request!34Graph processing algorithms
...@@ -176,10 +176,10 @@ class CycleError(Exception): ...@@ -176,10 +176,10 @@ class CycleError(Exception):
def compute_topological_order(graph): def compute_topological_order(graph):
"""Compute a toplogical order of nodes in a directed graph. """Compute a toplogical order of nodes in a directed graph.
:arg graph: A :class:`Mapping` representing a directed graph. The dictionary :arg graph: A :class:`collections.abc.Mapping` representing a directed
contains one key representing each node in the graph, and this key maps graph. The dictionary contains one key representing each node in the
to a :class:`Collection` of nodes that are connected to the node by outgoing graph, and this key maps to a :class:`collections.abc.Collection` of
edges. nodes that are connected to the node by outgoing edges.
:returns: A :class:`list` representing a valid topological ordering of the :returns: A :class:`list` representing a valid topological ordering of the
nodes in the directed graph. nodes in the directed graph.
...@@ -240,10 +240,11 @@ def compute_transitive_closure(graph): ...@@ -240,10 +240,11 @@ def compute_transitive_closure(graph):
"""Compute the transitive closure of a directed graph using Warshall's """Compute the transitive closure of a directed graph using Warshall's
algorithm. algorithm.
:arg graph: A :class:`Mapping` representing a directed graph. The dictionary :arg graph: A :class:`collections.abc.Mapping` representing a directed
contains one key representing each node in the graph, and this key maps graph. The dictionary contains one key representing each node in the
to a :class:`MutableSet` of nodes that are connected to the node by outgoing graph, and this key maps to a :class:`collections.abc.MutableSet` of
edges. This graph may contain cycles. nodes that are connected to the node by outgoing edges. This graph may
contain cycles.
:returns: A :class:`dict` representing the transitive closure of the graph. :returns: A :class:`dict` representing the transitive closure of the graph.
...@@ -271,10 +272,10 @@ def compute_transitive_closure(graph): ...@@ -271,10 +272,10 @@ def compute_transitive_closure(graph):
def contains_cycle(graph): def contains_cycle(graph):
"""Determine whether a graph contains a cycle. """Determine whether a graph contains a cycle.
:arg graph: A :class:`Mapping` representing a directed graph. The dictionary :arg graph: A :class:`collections.abc.Mapping` representing a directed
contains one key representing each node in the graph, and this key maps graph. The dictionary contains one key representing each node in the
to a :class:`Collection` of nodes that are connected to the node by outgoing graph, and this key maps to a :class:`collections.abc.Collection` of
edges. nodes that are connected to the node by outgoing edges.
:returns: A :class:`bool` indicating whether the graph contains a cycle. :returns: A :class:`bool` indicating whether the graph contains a cycle.
...@@ -296,13 +297,13 @@ def compute_induced_subgraph(graph, subgraph_nodes): ...@@ -296,13 +297,13 @@ def compute_induced_subgraph(graph, subgraph_nodes):
"""Compute the induced subgraph formed by a subset of the vertices in a """Compute the induced subgraph formed by a subset of the vertices in a
graph. graph.
:arg graph: A :class:`Mapping` representing a directed graph. The dictionary :arg graph: A :class:`collections.abc.Mapping` representing a directed
contains one key representing each node in the graph, and this key maps graph. The dictionary contains one key representing each node in the
to a :class:`Set` of nodes that are connected to the node by outgoing graph, and this key maps to a :class:`collections.abc.Set` of nodes
edges. that are connected to the node by outgoing edges.
:arg subgraph_nodes: A :class:`Set` containing a subset of the graph nodes :arg subgraph_nodes: A :class:`collections.abc.Set` containing a subset of
graph. the graph nodes graph.
:returns: A :class:`dict` representing the induced subgraph formed by :returns: A :class:`dict` representing the induced subgraph formed by
the subset of the vertices included in `subgraph_nodes`. the subset of the vertices included in `subgraph_nodes`.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment