[pypy-svn] r18088 - in pypy/dist/pypy/tool/algo: . test
arigo at codespeak.net
arigo at codespeak.net
Sun Oct 2 19:17:38 CEST 2005
Author: arigo
Date: Sun Oct 2 19:17:31 2005
New Revision: 18088
Modified:
pypy/dist/pypy/tool/algo/ (props changed)
pypy/dist/pypy/tool/algo/graphlib.py
pypy/dist/pypy/tool/algo/sparsemat.py (props changed)
pypy/dist/pypy/tool/algo/test/ (props changed)
Log:
fixeol + docstrings.
Modified: pypy/dist/pypy/tool/algo/graphlib.py
==============================================================================
--- pypy/dist/pypy/tool/algo/graphlib.py (original)
+++ pypy/dist/pypy/tool/algo/graphlib.py Sun Oct 2 19:17:31 2005
@@ -1,5 +1,9 @@
"""
Utilities to manipulate graphs (vertices and edges, not control flow graphs).
+
+Convention:
+ 'vertices' is a set of vertices (or a dict with vertices as keys);
+ 'edges' is a dict mapping vertices to a list of edges with its source.
"""
class Edge:
@@ -23,9 +27,10 @@
def strong_components(vertices, edges):
"""Enumerates the strongly connected components of a graph. Each one is
- a set of vertices where any node can be reached from any other vertex by
- following the edges. 'edges' is a dict {vertex: [edges]})"""
-
+ a set of vertices where any vertex can be reached from any other vertex by
+ following the edges. In a tree, all strongly connected components are
+ sets of size 1; larger sets are unions of cycles.
+ """
component_root = {}
discovery_time = {}
stack = []
More information about the Pypy-commit
mailing list