kwant.graph.remove_duplicates

kwant.graph.remove_duplicates()

Remove duplicate edges in the CGraph gr (this applies to the case where there are multiple edges (i,j), not to having (i,j) and (j,i)). This function modifes the graph in place.

If edge_weights is provided, edge_weights is modified such that the new edge weights are the sum of the old edge weights if there are duplicate edges.

This function only works on simple graphs (not two-way graphs), and it does not work on graphs which have a relation between the edge number (given by the order the edges are added) and the edge_id (given by the order the edges appear in the graph), see the documentation of CGraph. (Both restrictions could be lifted if necessary.) Furthermore, the function does not support negative node numbers, i.e. dangling links (the concept of being duplicate is more complicated there.)

Previous topic

kwant.graph.make_undirected

Next topic

kwant.graph.induced_subgraph

This Page