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

Hypergraphs feature development advice #117

Open
Philogicatician opened this issue Mar 19, 2022 · 7 comments
Open

Hypergraphs feature development advice #117

Philogicatician opened this issue Mar 19, 2022 · 7 comments
Labels
question Further information is requested

Comments

@Philogicatician
Copy link

Philogicatician commented Mar 19, 2022

Hello, I'd like to start developing an implementation of hypergraphs (both directed and undirected) for Graphs.jl and a way to visualize them. I'm aiming for something like the following:

Hypergraphs- Julia example1

This was from me playing around with SimpleHypergraphs.jl which used PyCall.jl to utilize Python's HyperNetX. The issue with the package is that the native Julia implementation doesn't work and it doesn't support directed hypergraphs.

Consequently, I wanted to throw out the idea before I started development to see if the package I make should be following certain implementation or style guidelines (besides the ones listed here). Also, let me know if there's a preferred graph visualization library that is normally used by Graphs.jl so I can make it as compatible as possible. 👍

@Philogicatician Philogicatician changed the title Hypergraphs feature Hypergraphs feature development advice Mar 19, 2022
@jpfairbanks
Copy link
Member

I like that visualization. I think you will have the best luck with Compose.jl. Layout will be the hardest part.

@pszufe
Copy link

pszufe commented Mar 21, 2022

Please note that SimpleHypergraphs is already totally compatible with Graphs.jl. (more info on the thread cross referenced in the previous post).

julia> h = Hypergraph([1 nothing nothing;
       1 1 nothing;
       nothing nothing 1
       nothing 1 1]
       );

julia> b = BipartiteView(h)
{7, 6} undirected simple Int64 graph

julia> supertype(BipartiteView)
Graphs.SimpleGraphs.AbstractSimpleGraph{Int64}

@Philogicatician
Copy link
Author

Philogicatician commented Mar 21, 2022

Please note that SimpleHypergraphs is already totally compatible with Graphs.jl.

Perfect! In that case, the main issue will be displaying the graph in a way that captures the previous image (but without reaching into Python with PyCall.jl to get HyperNetX) and creating a way to represent directed hypergraphs. I'm thinking something along these lines (but with colors):
image

One issue that came to mind for long-term hypergraph functionality is also allowing for oriented hypergraphs (which are a generalization of signed graphs). I'm thinking mainly of the work done by Neff & Rusnak that Rusnak outlines here.

@pszufe
Copy link

pszufe commented Mar 29, 2022

There is already a similar visualization in SimpleHypergraphs.jl. It is based on D3, JavaScript and can show hypergraph in a web browser.
Have a look at https://pszufe.github.io/SimpleHypergraphs.jl/stable/reference/#SimpleHypergraphs.draw

Try in Jupyter notebook:

draw(h, GraphBased)

@Philogicatician
Copy link
Author

At first I thought that feature was still broken, but it turns out it just took several minutes for it to display the first time. Thanks a lot @pszufe!

@pszufe
Copy link

pszufe commented Mar 30, 2022

perhaps it was downloading the JavaScript libs when run for the first time?
I see in the other post that you were running it inside VS Code - quite likely it might be quite not suited for VS Code - we have tested it on Firefox and Chrome - I do not know what browser VS Code is using,

@gdalle
Copy link
Member

gdalle commented May 19, 2022

Hi there! Just following up, is your problem solved @Philogicatician ? Can we close the issue?

@gdalle gdalle added the question Further information is requested label Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants