Macaulay2 » Documentation
Packages » NautyGraphs :: countGraphs
next | previous | forward | backward | up | index | toc

# countGraphs -- counts the number of graphs in the list with given properties

- Usage:
    `n = countGraphs(L, s)`
    `n = countGraphs(L, h)`
    `n = countGraphs(L, l)`
- Inputs:
  - L, a list, containing graphs (mixed formats are allowed)
  - s, a string, a filter, as generated by buildGraphFilter
  - h, a hash table, a filter, as used by buildGraphFilter
  - l, a list, a filter, as used by buildGraphFilter
- Outputs:
  - n, an integer, the number of graphs in $L$ satisfying the filter

## Description

Counts the number of graphs in a list that satisfy certain restraints as given in the filter (see buildGraphFilter). Notice that the input list can be graphs represented as instances of the class Graph or in a nauty-based String format.

For example, we can count the number of connected graphs on five vertices.

    i1 : L = generateGraphs 5;

    i2 : countGraphs(L, {"Connectivity" => 0, "NegateConnectivity" => true})

    o2 = 21

## See also

- buildGraphFilter -- creates the appropriate filter string for use with filterGraphs and countGraphs
- filterGraphs -- filters (i.e., selects) graphs in a list for given properties

## Ways to use countGraphs:

- `countGraphs(List,HashTable)`
- `countGraphs(List,List)`
- `countGraphs(List,String)`

## For the programmer

The object countGraphs is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/NautyGraphs.m2:784:0.