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

Create VisualizationCore.jl and VisualizationBase.jl, allow visualizing NamedGraph and DataGraph without loading ITensorNetworks #7

Open
emstoudenmire opened this issue Jun 12, 2024 · 2 comments

Comments

@emstoudenmire
Copy link
Contributor

emstoudenmire commented Jun 12, 2024

The following code is leading to an error:

using NamedGraphs.NamedGraphGenerators: named_comb_tree
using ITensorGLMakie

let
  g = named_comb_tree([3,3,3])
  @visualize g
end

This is with the following package versions:
GraphMakie v0.5.6
GeometryBasics v0.4.11
UnicodePlots v3.6.4
ITensorNetworks v0.11.14
Graphs v1.11.1
GeometryBasics v0.4.11

@emstoudenmire emstoudenmire changed the title [BUG] Visualize failing with newer GraphMakie [BUG] Visualize failing with newer package versions (perhaps due to GeometryBasics) Jun 12, 2024
@mtfishman
Copy link
Member

mtfishman commented Jun 12, 2024

I see what's going on. In order to visualize NamedGraph you need to load ITensorNetworks.jl as well.

There is a generic definition of visualize for AbstractGraph: https://github.com/ITensor/ITensorVisualizationBase.jl/blob/v0.1.11/src/visualize.jl#L106-L109 but it assumes the vertices are integers, so when it gets non-integer vertices it throws the error you are seeing deep down in the code.

This definition in ITensorNetworks.jl: https://github.com/ITensor/ITensorNetworks.jl/blob/v0.11.14/src/visualize.jl#L5-L19 adds support for non-integer vertices.

Ideally we would have a VisualizationCore.jl or VisualizationInterface.jl package that is independent of ITensors.jl that defines the visualize/@visualize interface, and then we could add package extensions NamedGraphsVisualizationCore.jl, DataGraphsVisualizationCore.jl, ITensorsVisualizationCore.jl, ITensorMPSVisualizationCore.jl, ITensorNetworkVisualizationCore.jl, etc. Unfortunately for the time being without that the definitions for visualizing certain types are spread out a bit randomly.

@mtfishman mtfishman changed the title [BUG] Visualize failing with newer package versions (perhaps due to GeometryBasics) Create VisualizationCore.jl and VisualizationBase.jl, allow visualizing NamedGraph and DataGraph without loading ITensorNetworks Jun 12, 2024
@emstoudenmire
Copy link
Contributor Author

Yes, I can confirm that adding using ITensorNetworks does fix the problem. I see, so there are sort of layers of features that are split across some packages. Not a problem for now, since this isn't so high-priority, but good to know what the issue is here and what a solution could be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants