Lattice#

class Lattice(graph)[source]#

Bases: object

General lattice.

প্যারামিটার:

graph (Union[PyGraph, 'nx.Graph']) -- Input graph for Lattice. Can be provided as rustworkx.PyGraph, which is used internally, or, for convenience, as rustworkx.Graph. The graph cannot be a multigraph.

রেইজেস:
  • ValueError -- If the input graph is a multigraph.

  • ValueError -- If the graph edges are non-numeric.

Attributes

graph#

Return a copy of the input graph.

node_indexes#

Return the node indexes.

num_nodes#

Return the number of nodes.

weighted_edge_list#

Return a list of weighted edges.

Methods

copy()[source]#

Return a copy of the lattice.

রিটার্ন টাইপ:

Lattice

draw(*, self_loop=False, style=None)[source]#

Draw the lattice.

প্যারামিটার:
classmethod from_adjacency_matrix(interaction_matrix)[source]#

Constructs a new lattice from a 2-dimensional adjacency matrix.

This method is equivalent to PyGraph.from_adjacency_matrix() or its complex counterpart when given a complex-valued matrix.

প্যারামিটার:

interaction_matrix (ndarray) -- the adjacency matrix from which to build out the lattice.

রেইজেস:

ValueError -- if the provided adjacency matrix is not a 2-D square matrix.

রিটার্নস:

A new lattice based on the provided adjacency matrix.

রিটার্ন টাইপ:

Lattice

classmethod from_nodes_and_edges(num_nodes, weighted_edges)[source]#

Return an instance of Lattice from the number of nodes and the list of edges.

প্যারামিটার:
  • num_nodes (int) -- The number of nodes.

  • weighted_edges (List[Tuple[int, int, complex]]) -- A list of tuples consisting of two nodes and the weight between them.

রিটার্নস:

Lattice generated from lists of nodes and edges.

রিটার্ন টাইপ:

Lattice

to_adjacency_matrix(weighted=False)[source]#

Return its adjacency matrix from weighted edges. The weighted edge list is interpreted as the upper triangular matrix. Defaults to False.

প্যারামিটার:

weighted (bool) -- The matrix elements are 0 or 1 when it is False. Otherwise, the weights on edges are returned as the matrix elements.

রিটার্নস:

The adjacency matrix of the input graph.

রিটার্ন টাইপ:

ndarray

uniform_parameters(uniform_interaction, uniform_onsite_potential)[source]#

Returns a new lattice with uniform parameters but otherwise identical structure.

প্যারামিটার:
  • uniform_interaction (complex) -- the value to use for all edge weights.

  • uniform_onsite_potential (complex) -- the value to use for all single-vertex loop weights.

রিটার্নস:

A new lattice with identical structure but uniform parameters.

রিটার্ন টাইপ:

Lattice