A 1D linear topology.
Inherits From: NamedTopology
cirq.LineTopology(
n_nodes: int = cirq.NamedTopology.graph
)
Used in the notebooks
Node indices are contiguous integers starting from 0 with edges between
adjacent integers.
Args |
n_nodes
|
The number of nodes in a line.
|
Attributes |
n_nodes
|
Dataclass field
|
Methods
draw
View source
draw(
ax=None, tilted: bool = True, **kwargs
) -> Dict[Any, Tuple[int, int]]
Draw this graph using Matplotlib.
Args |
ax
|
Optional matplotlib axis to use for drawing.
|
tilted
|
If True, draw as a horizontal line. Otherwise, draw on a diagonal.
|
**kwargs
|
Additional arguments to pass to nx.draw_networkx .
|
nodes_as_linequbits
View source
nodes_as_linequbits() -> List['cirq.LineQubit']
Get the graph nodes as cirq.LineQubit
nodes_to_linequbits
View source
nodes_to_linequbits(
offset: int = 0
) -> Dict[int, 'cirq.LineQubit']
Return a mapping from graph nodes to cirq.LineQubit
Args |
offset
|
Offset integer positions of the resultant LineQubits by this amount.
|
__eq__
__eq__(
other
)
Class Variables |
graph
|
Instance of NotImplementedType
|
n_nodes
|
Instance of NotImplementedType
|
name
|
Instance of NotImplementedType
|