SciProgCentre/kmath

MST: Tree visualization with Kaliningraph or Graphviz

CommanderTvis opened this issue · 4 comments

That would quite beautiful in the context of Jupyter. By the way, this is already partially available because there is possible conversion: MST -> SFun -> Kaliningraph Graph -> Graphviz -> BufferedImage. However, direct conversion will look better.

I was thinking about something like this myself. It would be nice. Marking it as up for grabs.

We recently added support for rendering to Viz.js directly, bypassing graphviz-java and Kweb. With Kotlin/JS, this was a lot simpler than I had originally anticipated. Now we just need to figure out how to package JS as part of a Jupyter notebook library (do we simply paste it inside like <script>$viz_js_code</script> or is there a better way?) and we should be able to support Kotlin/kotlin-jupyter#219.

@breandan there are three ways to do that. First, you can place your JS/CSS publically on the web (CDN for example) and add a script link. Second, you can place file locally and add a link to it. It will work only for stand-alone HTML or in server mode though, it won't work for Jupyter because of cross-origin restriction policy of Chrone. And the third way is to embedd the JS inside the page/notebook. It hsas some problems with notebook classic/datalore due to cell isolation, but works quite well with notebook lab.

The Jupyter API has a way to do either first or third way. See example here.

Also you can do embedding/local file generation yourself.

Gotcha, I see it was documented here, guess I must have missed it. Since Kotlin/Jupyter supports MPP projects I'll give that a try and let you know how it goes. Thanks!