CayleyPy API Reference

Core classes and functions

cayleypy.CayleyGraphDef(generators_type, ...)

Mathematical definition of a CayleyGraph.

cayleypy.CayleyGraph(definition, *[, ...])

Represents a Schreier coset graph for some group.

cayleypy.CayleyPath(start_state, edges, graph)

Path in a Cayley graph.

cayleypy.find_path(graph, start_state, **kwargs)

Finds path from start_state to central state.

Graphs library

cayleypy.PermutationGroups()

Pre-defined Cayley graphs for permutation groups (S_n).

cayleypy.MatrixGroups()

Pre-defined Cayley graphs for matrix groups.

cayleypy.Puzzles()

Definitions of graphs describing various puzzles.

cayleypy.GapPuzzles()

Library of puzzles defined in GAP format.

cayleypy.create_graph(*[, ...])

Creates CayleyGraph.

cayleypy.prepare_graph(name[, n])

Returns pre-defined CayleyGraphDef by codename and additional kwargs.

Beam search and ML

cayleypy.Predictor(graph, models_or_heuristics)

Estimates distance from central state to given states.

cayleypy.algo.BeamSearchAlgorithm(graph)

Beam search algorithm for finding paths in Cayley graphs.

cayleypy.algo.BeamSearchResult(path_found, ...)

Result of running beam search on a Cayley graph.

cayleypy.algo.RandomWalksGenerator(graph)

Generator for random walks on Cayley graphs.

cayleypy.models.ModelConfig(model_type, ...)

Configuration used to describe ML model.

cayleypy.models.GroupTokenizer(groups)

Converts states to sequences of tokens, one token per group of consecutive elements of a state.

cayleypy.models.MlpModel(config)

Multi-layer perceptron model.

cayleypy.models.ResMlpModel(config)

Multi-layer perceptron with residual (skip) connections.

cayleypy.models.graph_hash(graph_def)

Computes hash of the mathematical definition of a graph.

cayleypy.models.save_checkpoint(path, model, ...)

Saves weights of a model together with the config describing this model.

cayleypy.models.load_checkpoint(path[, ...])

Loads model from a checkpoint written by save_checkpoint().

Training

cayleypy.train.Loss()

Base class for losses used to train distance-estimating models.

cayleypy.train.MseLoss()

Mean squared error loss.

cayleypy.train.PinballLoss([tau])

Pinball (quantile) loss, which penalizes underestimation and overestimation differently.

cayleypy.train.make_loss(name[, tau])

Creates loss by name.

BFS algorithm and its variations

cayleypy.algo.BfsAlgorithm()

Basic version of the bread-first search (BFS) algorithm.

cayleypy.algo.BfsDistributed()

Multi-GPU breadth-first search implementation.

cayleypy.algo.BfsResult(bfs_completed, ...)

Result of running breadth-first search on a Schreier coset graph.

cayleypy.algo.bfs_bitmask(graph[, max_diameter])

Version of BFS storing all vertices explicitly as bitmasks, using 3 bits of memory per state.

cayleypy.algo.bfs_numpy(graph[, max_diameter])

Simple version of BFS (from destination_state) using numpy, optimized for memory usage.

cayleypy.algo.InteractiveBfs(graph, start_states)

Interactive breadth-first search that computes layers one by one.

cayleypy.algo.MeetInTheMiddle()

Meet-in-the middle (MITM) algorithm for path finding.