CouplingGraph

class CouplingGraph(graph, num_qudits=None)[source]

Bases: Collection[Tuple[int, int]]

A graph representing connections in a qudit topology.

__init__(graph, num_qudits=None)[source]

Methods

all_pairs_shortest_path()

Calculate all pairs shortest path matrix using Floyd-Warshall.

all_to_all(num_qudits)

Return a coupling graph with all qudits connected.

get_induced_subgraph(location)

Return the edges induced by the vertices specified in location.

get_neighbors_of(qudit)

Return the qudits adjacent to qudit.

get_qudit_degrees()

get_rooted_minimum_span(root)

Connect root to every other node in the graph.

get_shortest_path_tree(source)

Return shortest path from source to every node in self.

get_subgraph(location[, renumbering])

Returns the sub-coupling-graph with qudits in location.

get_subgraphs_of_size(size)

Find all sets of indices that form connected subgraphs on their own.

grid(num_rows, num_cols)

Return a coupling graph with a grid of qubits.

is_embedded_in(graph)

Check if this CouplingGraph is embedded within graph.

is_fully_connected()

Return true if the graph is fully connected.

is_fully_connected_without(qudit)

Return true if the graph is fully connected without qudit.

is_valid_coupling_graph(coupling_graph[, ...])

Return true if the coupling graph is valid.

linear(num_qudits)

Return a coupling graph with nearest-neighbor connectivity.

maximal_matching([edges_to_ignore, randomize])

Generate a random graph matching for the coupling graph.

relabel_subgraph([relabeling])

Renumber the vertices in graph according to the optionally provided relabeling dictionary, or relabel so that the vertices are in renumbered in least to greatest order and in the set {0,...,|V|-1}.

ring(num_qudits)

Return a coupling graph with ring connectivity.

star(num_qudits)

Return a coupling graph with one qudit connected to all else.