Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds algorithms for finding
Eulieran
paths andEulerian
cycles for theAbstractGraph
type.An Eulerian path is a path from a source vertex to a target vertex which traverses each edge in the graph exactly once. In order to have an Eulerian path the source and target vertex must be of odd degree and all other vertices of even degree.
An Eulerian cycle is a path from a source vertex back to itself which traverses each edge in the graph exactly once. In order to have an Eulerian cycle all vertices of the graph must be of even degree.
See: https://en.wikipedia.org/wiki/Eulerian_path for more info.
If such a cycle/ path exists for a graph
g
, the algorithm implemented here will find it inO(M)
whereM = length(edges(g))
time.@mtfishman I think this could be a good base for coming up with a good sweeping plan for DMRG.
eulerian_cycle(g)
for the first half sweep and thenreverse(eulerian_cycle(g))
for the second half.dist(g_original, src(e), dst(e))
until all its vertices have even degree, then ii) construct a corresponding Eulerian cycle starting at one of the extremal vertices of the original graphg
and finally iii) if doing a two-site sweep plan, remove any dummy edges from the cycleConsider:
An open boundary 1D chain of
L
sites. Then a single edge will be added1 => L
to make all the vertices of even degree and the Eulerian cycle will simply start at site1/L
and flow round to siteL/1
of the chain and then backwards as is done in typical DMRG.