cayleypy.BfsResult

class cayleypy.BfsResult[source]

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

Can be used to obtain the graph explicitly. In this case, vertices are numbered sequentially in the order in which they are visited by BFS.

__init__(bfs_completed: bool, layer_sizes: list[int], layers: dict[int, Tensor], vertices_hashes: Tensor | None, edges_list_hashes: Tensor | None, graph: CayleyGraphDef) None

Methods

__init__(bfs_completed, layer_sizes, layers, ...)

adjacency_matrix()

Returns adjacency matrix as a dense NumPy array.

adjacency_matrix_sparse()

Returns adjacency matrix as a sparse SciPy array.

diameter()

Maximal distance from any start vertex to any other vertex.

get_edge_name(i1, i2)

Returns name for generator used to go from vertex i1 to vertex i2.

get_layer(layer_id)

Returns all states in the layer with given index.

has_edges_list_hashes()

has_vertices_hashes()

last_layer()

Returns last layer, formatted as set of strings.

load(path)

named_undirected_edges()

Names for vertices (representing coset elements in readable format).

save(path)

to_device(device)

to_networkx_graph([directed, with_labels])

Returns explicit graph as networkx.Graph or networkx.DiGraph.

vertex_name(state)

Attributes

all_states

Explicit states, ordered by index.

edges_list

Returns list of edges, with vertices renumbered.

hashes_to_indices_dict

Dictionary used to remap vertex hashes to indexes.

num_vertices

Number of vertices in the graph.

vertex_names

Returns names for vertices in the graph.

bfs_completed

layer_sizes

layers

vertices_hashes

edges_list_hashes

graph

adjacency_matrix() ndarray[source]

Returns adjacency matrix as a dense NumPy array.

adjacency_matrix_sparse() coo_array[source]

Returns adjacency matrix as a sparse SciPy array.

property all_states: Tensor

Explicit states, ordered by index.

diameter()[source]

Maximal distance from any start vertex to any other vertex.

property edges_list: ndarray

Returns list of edges, with vertices renumbered.

get_edge_name(i1: int, i2: int) str[source]

Returns name for generator used to go from vertex i1 to vertex i2.

get_layer(layer_id: int) ndarray[source]

Returns all states in the layer with given index.

property hashes_to_indices_dict: dict[int, int]

Dictionary used to remap vertex hashes to indexes.

last_layer() ndarray[source]

Returns last layer, formatted as set of strings.

named_undirected_edges() set[tuple[str, str]][source]

Names for vertices (representing coset elements in readable format).

property num_vertices: int

Number of vertices in the graph.

to_networkx_graph(directed=False, with_labels=True)[source]

Returns explicit graph as networkx.Graph or networkx.DiGraph.

property vertex_names: list[str]

Returns names for vertices in the graph.