def get_named_nodes(self, name):
"""Return a list of "op" nodes with the given name."""
nlist = []
if name not in self.basis:
raise DAGCircuitError("%s is not in the list of basis operations"
% name)
# Iterate through the nodes of self in topological order
ts = nx.topological_sort(self.multi_graph)
for n in ts:
nd = self.multi_graph.node[n]
if nd["type"] == "op" and nd["name"] == name:
nlist.append(n)
return nlist
评论列表
文章目录