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

[BUG] graph.ToSvg() not working. (rise4fun is down) #48

Open
samvanlier opened this issue Dec 14, 2021 · 10 comments
Open

[BUG] graph.ToSvg() not working. (rise4fun is down) #48

samvanlier opened this issue Dec 14, 2021 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@samvanlier
Copy link

I'm trying to use the ToSvg() method to render a graph but it seems that it uses rise4fun.com in the background to do this.

After some digging, I found out that this service has been shut down and will probably not recover (source: Z3Prover/z3#5472).

Is there a plan to create a solution for this?

And in the meantime, are there alternatives for rendering a graph to svg?
I would prefer a local solution because I need to render quite a few.

Thanks in advance

@samvanlier samvanlier added the bug Something isn't working label Dec 14, 2021
@KeRNeLith
Copy link
Owner

KeRNeLith commented Dec 15, 2021

Hello @samvanlier,

Ah, sad news. I always though that replacing this call to a web service by a proper implementation of svg conversion would have been better. That was the same case when Graphviz website certificate has expirated some API of the library were broken, but for this case I already fixed that.

When reworking the library I already had in mind the fact of doing a web independant version of this conversion for several other reasons BTW. So I guess it quite answers you question about plan about this!
But the main problem is that I did not managed to get/find an implementation for this scenario. If you have any suggestion on an algorithm that can be re-used or adapted feel free to propose.

Otherwise a possible solution might be to use the graphviz dot executable that if I'm not wrong has a command line to do so.

Hope it helped a bit.

@samvanlier
Copy link
Author

Hello @KeRNeLith ,

I used the command line tool of graphviz to fix this problem but that is not a solution that is usable for the nuget because it requires the tool being installed on the machine.

It is my first time using Graphviz so I cannot recommend any idea to solve this issue without using Graphviz locally.

Anyway, thanks for the reply and good luck finding a solution.

@KeRNeLith
Copy link
Owner

Yeah it requires the tool to be installed indeed, or an alternative would be to create a package that embeds the tool executable.
It possible but not ideal, I would prefer having an implementation in the package itself.

I have to admit that I'm pretty stuck too without having an implementation of what's done in the dot executable. It would be certainly nice to kind of make an equivalent implementation in C#. BTW I don't have the sources of the dot executable. So I'm afraid I don't really have solution for now. Deploying a dot executable may be the best compromise for now.
Depending on your need and constraint it's possible by the way. I've already seen usage for graph layout in an application that is calling this executable under the hood.

@samvanlier
Copy link
Author

I now just call the dot executable from C# giving the Graphviz string as input to convert a graph to a file.
It is a hacky solution but requires some work because of the different platforms .Net core/standard needs to support.

I use Mac and accessing command line tools from within C# wasn't easy.

So a implementation in C# would seem the most useful solution.

@eosfor
Copy link

eosfor commented Dec 17, 2021

Hello @KeRNeLith,

For simplicity and, kind of, being cross-platform I'd perhaps think of using some wrapper around things like vis.js or d3. Throughout the years I haven't seen any .NET-based visualization libraries for graphs, except, perhaps, MSAGL

@KeRNeLith
Copy link
Owner

@samvanlier I'm totally agree that a C# implementation will always be better in term of portability, practicality and also resilience.
That's why I always wanted to replace this web dependent implementation.

I'm not really aware of those solution @eosfor. Do you have some references on them (vis.js and d3) for the scenario we're facing?
There is a bridge to MSAGL through the QuikGraph.MSAGL library. BTW I'm not sure there is any conversion to SVG implemented in it. In my knowledge it's mostly for layout.

@eosfor
Copy link

eosfor commented Dec 19, 2021

Hello @KeRNeLith , here is the example in MSAGL repo. I tried it here

I wonder what dows QuikGraph.MSAGL do?

@KeRNeLith
Copy link
Owner

@eosfor the QuikGraph.MSAGL is basically a bridging library. I mean it allows to convert from a QuikGraph representation to an MSAGL one. The main relevant implementation you can have a look around this is here. As a summary QuikGraph provide a customizable convertion by hooking events at some point that gives control to user. Other than that, it's basically almost what your example is showcasing indeed.

@KeRNeLith
Copy link
Owner

@eosfor The implementation of MSAGL bridge may be improved based on the test implementation you gave earlier. But note that it seems we miss the clustering feature.

The best thing would certainly be to get the code that was running behind the rise4fun AGL API, but seems to not be an easy task BTW.

@aviatrix
Copy link

This might be of help as a temporary work around for people that want to implement their own .ToSVG :
https://kroki.io/
https://github.com/yuzutech/kroki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants