Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop a new vertex-indexed graph type for Lattice #285

Open
mofeing opened this issue Jan 13, 2025 · 2 comments
Open

Develop a new vertex-indexed graph type for Lattice #285

mofeing opened this issue Jan 13, 2025 · 2 comments
Labels
enhancement New feature or request refactor Change internals
Milestone

Comments

@mofeing
Copy link
Member

mofeing commented Jan 13, 2025

Currently, Lattice wraps a SimpleGraph{Int} together with a BijectiveDict between AbstractLane and Int for implementing a graph with AbstractLanes as indexing vertices.

The problem is that if we remove a vertex from the SimpleGraph, the already existing vertices with vertex code bigger than the removed vertex, are renamed.

In general, we need a graph with vertex indexing metadata (that's what Lattice is really) but MetaGraphsNext feels like too much boilerplate and @mtfishman's NamedGraphs.jl and DataGraphs.jl add too many dependencies and rely on Dictionaries.jl... which I can't really use.

For preserving lattice topology when performing different operations, we will also require to be able to group vertices temporarily... just like @mtfishman's PartitionedGraphs.jl (we seem to be facing similar design issues).

@mofeing mofeing added enhancement New feature or request refactor Change internals labels Jan 13, 2025
@mofeing mofeing added this to the 0.8.x milestone Jan 13, 2025
@mtfishman
Copy link

mtfishman commented Jan 13, 2025

@mofeing indeed I imagine these kinds of graph data structures are fundamental to designing general tensor networks.

Why do you say you can't use Dictionaries.jl? Maybe we could cut down on some of the dependencies of NamedGraphs.jl/DataGraphs.jl but they are all pretty lightweight. Note that NamedGraphs.j and DataGraphs.jl are based around AbstractNamedGraph/AbstractDataGraph supertypes so you could probably design your own named graph/data graph subtypes that use different dictionary types if you wanted to. (Also credit should go to @JoeyT1994 as well for helping with the development of these packages!).

@mofeing
Copy link
Member Author

mofeing commented Jan 20, 2025

ey @mtfishman, sorry for taking long to answer

Why do you say you can't use Dictionaries.jl?

i think it's a matter of taste but i find it quite hard to work with. it doesn't work well with Julia's native Dict (i know it can convert but the return type of many Dict functions are different), and one of my main obstacles is that many times i just want to get another type out of it (e.g. get me a Vector with the keys filtered using this) but it always forces to return a Dictionary. i wasted time in the past to try work with it, so i have as a norm to try to avoid it.

Maybe we could cut down on some of the dependencies of NamedGraphs.jl/DataGraphs.jl but they are all pretty lightweight. Note that NamedGraphs.j and DataGraphs.jl are based around AbstractNamedGraph/AbstractDataGraph supertypes so you could probably design your own named graph/data graph subtypes that use different dictionary types if you wanted to. (Also credit should go to @JoeyT1994 as well for helping with the development of these packages!).

that's nice! i would also need PartitionedGraphs.jl with i think it also uses them right?
it would also help with integration between ITensorNetworks.jl and Tenet.jl, because it would allow us to preserve the lattice information.


i can try an implementation without using them directly first, and let the custom implementation of NamedGraph and the rest for latter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor Change internals
Projects
None yet
Development

No branches or pull requests

2 participants