Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pytools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Klöckner
pytools
Commits
df9867f4
Commit
df9867f4
authored
4 years ago
by
James Stevens
Browse files
Options
Downloads
Patches
Plain Diff
prepend collections.abc to types in docs
parent
69fde78f
No related branches found
No related tags found
1 merge request
!34
Graph processing algorithms
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pytools/graph.py
+19
-18
19 additions, 18 deletions
pytools/graph.py
with
19 additions
and
18 deletions
pytools/graph.py
+
19
−
18
View file @
df9867f4
...
@@ -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:`
C
ollection
` of nodes that are connected to the node by outgoing
graph, and this key maps
to a :class:`
c
ollection
s.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:`
C
ollection
` of nodes that are connected to the node by outgoing
graph, and this key maps
to a :class:`
c
ollection
s.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`.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment