# Multigraph Generation

Implementation of EFP/EFM Generator class.

## Generator

Generates non-isomorphic multigraphs according to provided specifications.

```
energyflow.Generator(dmax=None, nmax=None, emax=None, cmax=None, vmax=None, comp_dmaxs=None,
filename=None, gen_efms=True, np_optimize='greedy', verbose=False)
```

Doing a fresh generation of connected multigraphs (`filename=None`

)
requires that `igraph`

be installed.

**Arguments**

**dmax**:*int*- The maximum number of edges of the generated connected graphs.

**nmax**:*int*- The maximum number of vertices of the generated connected graphs.

**emax**:*int*- The maximum number of edges of the generated connected simple graphs.

**cmax**:*int*- The maximum VE complexity \chi of the generated connected graphs.

**vmax**:*int*- The maximum valency of the generated connected graphs.

**comp_dmaxs**: {*dict*,*int*}- If an integer, the maximum number of edges of the generated disconnected graphs. If a dictionary, the keys are numbers of vertices and the values are the maximum number of edges of the generated disconnected graphs with that number of vertices.

**filename**:*str*- If
`None`

, do a complete generation from scratch. If set to a string, read in connected graphs from the file given, restrict them according to the various 'max' parameters, and do a fresh disconnected generation. The special value`filename='default'`

means to read in graphs from the default file. This is useful when various disconnected graph parameters are to be varied since the generation of large simple graphs is the most computationlly intensive part.

- If
**gen_efms**:*bool*- Controls whether EFM information is generated.

**np_optimize**: {`True`

,`False`

,`'greedy'`

,`'optimal'`

}- The
`optimize`

keyword of`numpy.einsum_path`

.

- The
**verbose**:*bool*- A flag to control printing.

### save

```
save(filename, protocol='npz', compression=True)
```

Save the current generator to file.

**Arguments**

**filename**:*str*- The path to save the file.

**protocol**: {`'npz'`

,`'json'`

}- The file format to be used.

**compression**:*bool*- Whether to compress the resulting file or not.R

### properties

#### specs

```
specs
```

An array of EFP specifications. Each row represents an EFP
and the columns represent the quantities indicated by `cols`

.