# gc - pydoc - phpman

> **TLDR:** Count nodes, edges, connected components, or clusters in Graphviz `.dot` files.
>
- Count nodes and edges in a file:
  `gc {{path/to/file.dot}}`
- Count only [n]odes:
  `gc -n {{path/to/file.dot}}`
- Count only [e]dges:
  `gc -e {{path/to/file.dot}}`
- Count [c]onnected components:
  `gc -c {{path/to/file.dot}}`
- Display help:
  `gc -?`

*Source: tldr-pages*

---

Help on built-in module gc:

## NAME
    gc - This module provides access to the garbage collector for reference cycles.

## MODULE REFERENCE
    <https://docs.python.org/3.10/library/gc.html>

    The following documentation is automatically generated from the Python
    source files.  It may be incomplete, incorrect or include features that
    are considered implementation detail and may vary between Python
    implementations.  When in doubt, consult the module reference at the
    location listed above.

## DESCRIPTION
### enable
### disable
### isenabled
### collect
### get_count
### get_stats
### set_debug
### get_debug
### set_threshold
### get_threshold
### get_objects
### is_tracked
### is_finalized
### get_referrers
### get_referents
### freeze
### unfreeze
### get_freeze_count

## FUNCTIONS
### collect
        Run the garbage collector.

        With no arguments, run a full collection.  The optional argument
        may be an integer specifying which generation to collect.  A ValueError
        is raised if the generation number is invalid.

        The number of unreachable objects is returned.

### disable
        Disable automatic garbage collection.

### enable
        Enable automatic garbage collection.

### freeze
        Freeze all current tracked objects and ignore them for future collections.

        This can be used before a POSIX fork() call to make the gc copy-on-write friendly.
        Note: collection before a POSIX fork() call may free pages for future allocation
        which can cause copy-on-write.

### get_count
        Return a three-tuple of the current collection counts.

### get_debug
        Get the garbage collection debugging flags.

### get_freeze_count
        Return the number of objects in the permanent generation.

### get_objects
        Return a list of objects tracked by the collector (excluding the list returned).

          generation
            Generation to extract the objects from.

        If generation is not None, return only the objects tracked by the collector
        that are in that generation.

### get_referents
        get_referents(*objs) -> list
        Return the list of objects that are directly referred to by objs.

### get_referrers
        get_referrers(*objs) -> list
        Return the list of objects that directly refer to any of objs.

### get_stats
        Return a list of dictionaries containing per-generation statistics.

### get_threshold
        Return the current collection thresholds.

### is_finalized
        Returns true if the object has been already finalized by the GC.

### is_tracked
        Returns true if the object is tracked by the garbage collector.

        Simple atomic objects will return false.

### isenabled
        Returns true if automatic garbage collection is enabled.

### set_debug
        Set the garbage collection debugging flags.

          flags
            An integer that can have the following bits turned on:
              DEBUG_STATS - Print statistics during collection.
              DEBUG_COLLECTABLE - Print collectable objects found.
              DEBUG_UNCOLLECTABLE - Print unreachable but uncollectable objects
                found.
              DEBUG_SAVEALL - Save objects to gc.garbage rather than freeing them.
              DEBUG_LEAK - Debug leaking programs (everything but STATS).

        Debugging information is written to sys.stderr.

### set_threshold
        set_threshold(threshold0, [threshold1, threshold2]) -> None

        Sets the collection thresholds.  Setting threshold0 to zero disables
        collection.

### unfreeze
        Unfreeze all objects in the permanent generation.

        Put all objects in the permanent generation back into oldest generation.

## DATA
    DEBUG_COLLECTABLE = 2
    DEBUG_LEAK = 38
    DEBUG_SAVEALL = 32
    DEBUG_STATS = 1
    DEBUG_UNCOLLECTABLE = 4
    callbacks = []
    garbage = []

## FILE
    (built-in)


