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, ...)Returns adjacency matrix as a dense NumPy array.
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
()Returns last layer, formatted as set of strings.
load
(path)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
Explicit states, ordered by index.
Returns list of edges, with vertices renumbered.
Dictionary used to remap vertex hashes to indexes.
Number of vertices in the graph.
Returns names for vertices in the graph.
bfs_completed
layer_sizes
layers
vertices_hashes
edges_list_hashes
graph
- property all_states: Tensor
Explicit states, ordered by index.
- 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.
- property hashes_to_indices_dict: dict[int, int]
Dictionary used to remap vertex hashes to indexes.
- 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.