Skip to content
Snippets Groups Projects
Commit 9e7b8b16 authored by Joseph Weston's avatar Joseph Weston
Browse files

add an `edges` method; the inverse of `node_pairs`

parent 8e386d7b
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -74,7 +74,7 @@ class System2(metaclass=abc.ABCMeta): ...@@ -74,7 +74,7 @@ class System2(metaclass=abc.ABCMeta):
Raises Raises
------ ------
IndexError IndexError
If any element of entries > num_entries. If any element of entries >= num_entries.
""" """
@abc.abstractmethod @abc.abstractmethod
...@@ -98,6 +98,29 @@ class System2(metaclass=abc.ABCMeta): ...@@ -98,6 +98,29 @@ class System2(metaclass=abc.ABCMeta):
If any element of entries >= num_entries. If any element of entries >= num_entries.
""" """
@abc.abstractmethod
def edges(self, heads, tails):
"""Get the edges corresponding to some hoppings.
Parameters
----------
heads, tails: sequence of int
The heads and tails of the hoppings to get.
Returns
-------
Sequence of int
The edges corresponding to the provided hoppings
Raises
------
IndexError
If any element of heads, tails >= num_nodes
KeyError
If a given hopping does not exist as an edge in the system
"""
@abc.abstractmethod @abc.abstractmethod
def neighbors(self, nodes): def neighbors(self, nodes):
"""Get the neighbors of nodes and the corresponding edges. """Get the neighbors of nodes and the corresponding edges.
...@@ -118,7 +141,7 @@ class System2(metaclass=abc.ABCMeta): ...@@ -118,7 +141,7 @@ class System2(metaclass=abc.ABCMeta):
Raises Raises
------ ------
IndexError IndexError
If any element of nodes > num_nodes. If any element of nodes >= num_nodes.
""" """
@abc.abstractmethod @abc.abstractmethod
...@@ -136,7 +159,7 @@ class System2(metaclass=abc.ABCMeta): ...@@ -136,7 +159,7 @@ class System2(metaclass=abc.ABCMeta):
Raises Raises
------ ------
IndexError IndexError
If any element of nodes > num_nodes. If any element of nodes >= num_nodes.
""" """
@abc.abstractmethod @abc.abstractmethod
...@@ -209,7 +232,7 @@ class System2(metaclass=abc.ABCMeta): ...@@ -209,7 +232,7 @@ class System2(metaclass=abc.ABCMeta):
Raises Raises
------ ------
IndexError IndexError
If any element of nodes > num_nodes. If any element of nodes >= num_nodes.
KeyError KeyError
If g is not a group element. If g is not a group element.
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment