How to build tree diagrams in bokeh - bokeh

What would it take to implement a tree diagram in bokeh? Something similar to this DS example would be nice --
http://bl.ocks.org/robschmuecker/7880033
I'm just looking to visualize a data structure, so only need the pan, zoom, and collapse functionality.
Thanks!
- AH

There is nothing in Bokeh to do this automatically. Bokeh does now support network/graph support, which it did not at the time the question was originally posted:
https://docs.bokeh.org/en/latest/docs/user_guide/graph.html
However, it would take some work to use this to reproduce the link above:
non straight-line edges would need to be computed explicitly
nodes/edges would have to be hidden manually based on TapTool events
Additionally there is no "smooth animation" option yet (as of Bokeh 0.13.0) so the transitions would be instant.
If the idea is to have this sort of capability along side other Bokeh plots, or to connect it to Python backend code, then another option is to write a custom extension for Bokeh:
https://docs.bokeh.org/en/latest/docs/user_guide/extensions.html
This would take some up-front work, but doing this, you could integrate the fancy D3 widget directly into Bokeh documents, and use it like, and connect it to, any other Bokeh component or widget.

Related

Gephi automation: how to make multiple graphs at once

I am looking for a tool to automate making graphs with Gephi. I have dozens of similar graphs to prepare (only labels and figures in data differ), so need something able to automatically:
load nodes and edges from a file (e.g., csv)
set up layout (e.g., "type='force atlas 2', iterations=n, threads=m, scaling=p, gravity=q...")
apply selected laoyut
tune appearance (ranking: color, size)
export graph
I am aware of Gephi Toolkit, but it is for Java. Maybe there is some other way to automate Gephi? (or I will have to learn Java, which is not bad, but requires time)
I've also found Gephi Scripting Plugin, which is good but lacks some features, e.g. can't set up layout (only runs it with default settings).
Thanks in advance!
It is a bit tricky and haven't tried myself but if you don't want to get your feet wet with Java then you could try one of the automation frameworks that allow you to control a GUI application, e.g. Robot, PyAutoGUI or if you use Windows you can use pywinauto.
I know it not a complete answer but it might give you a lead.

Is there any method for fix manually an Alloy Analyzer graph?

I need to fix my Alloy graph, for example I have this output:
I can't move "node2" rectangle over the row of "node0" and "node1", and I can't move "node1" under "node2" whitout also move "node0". Is there any solution? Thank you.
PS: I am using Alloy Analyzer 4.2 under Windows.
PPS: This is only an example, i get a big graph with 5 or 6 rows of 20-25 rectangles, and if I can't fix it manually, it's only a mess.
To answer the direct question: I for one have never found a way to make the visualizer change its mind about which nodes should be on the same horizontal level. (That doesn't quite mean it's not possible, but it does mean that if it's possible it's not immediately obvious how to do it. But I guess you knew that already.)
If your goal is to make the auto-generated diagrams easier to read, the simplest approach is to experiment with adjustments to the visualizer theme. The "Magic Layout" button can be helpful; manual adjustments to hide some nodes or display some relations as labels rather than arcs can help with diagrams which are otherwise too cluttered.
If your goal is to make a 'good' version of a diagram for inclusion on a slide for a talk or a figure for a paper, you may want to export to Dot and import into a graph-drawing tool that gives you the kind of manual control you want (or edit the .dot file yourself, if you are familiar with graphviz and can make it do what you want), or export to XML and generate the graph description language of your choice from the XML.
I hope this helps.
The Lightning tool is an Ecplise plugin relying on Alloy4.2 to formally define Domain Specific Languages and might be a solution to your problem.
It's still under development, but if you are only interested in being able to freely reorganize each atom and label of generated instances, there shouldn't be any problems, as it uses Ecplise draw2D to render those latter.
If now you're really interested in providing an intuitive visualization to your generated instance (by intuitive I mean a visualization that is closer to its domain rather than the structure of your model), then you can define your own language (with your model as abstract syntax ) and define a concrete syntax for it.
The update site to be used for the installation of the tool is : http://lightning.gforge.uni.lu/update-site
Don't hesitate to contact me if you plan to give it a shot and get any issues.
(I'm eager of constructive feedbacks ;-) )
The steps to follow to generate a graphical instance in which any components can be moved are :
Install Lightning
Create a new Lightning Project
Create a new Language in this project
Put your model in the ASM folder
generate instances of the language by "running the project"

Knowledge Graph (Demo) UI using sigma.js?

Are there any beginner-friendly tutorials to display graphs in the way Knowledge graph has been done?
I have the data is JSON format presented from a graphdb
For eg:
The closest I have found so far is Gelphi. Which also can be integrated with unity to produce a 3d Graph like this one https://www.youtube.com/watch?v=h_arRCf73Kg.
Then there is https://cayley.io/
https://n0where.net/opengraphiti-data-visualization-engine/
There is also https://www.maana.io/knowledge-platform/platform-capabilities/#maana-knowledge-graph . However, i have not tried to use/download their platform.
https://en.wikipedia.org/wiki/Force-directed_graph_drawing
Finally, I am working myself on learning unity to build a simple GUI which a user can identify nodes and edges and entities easily and move them around. So instead of just reading from a data base, also write to it through a UI.

Using Cytoscape.js for network visualization in Shiny

I am working on a web project for network visualization. I am writing my code in R using Shiny. And I want to display my graph using Cytoscape.js
I've searched the web for some kind of source code doing this. But I couldn't find anything. The webpage of Cytoscape.js is not enough for me cause I am not expert in js and can't use the examples.
Briefly, I have Adjacency matrix of my graph and want to use it with cytoscpae.js. Do you know any source code or a tutorial of the steps I should go through?
Cytoscape.js supports JSON for input, so as long as your R/Shiny code can produce that, you should be able to use Cytoscape.js. Here's the format described: http://cytoscape.github.io/cytoscape.js/#notation/elements-json
It looks like Shiny has a predefined set of widgets it supports, so there are a few options here:
(1) Shiny adds support for Cytoscape.js (e.g. https://github.com/cytoscape/r-cytoscape.js),
(2) A Cytoscape.js plugin is written for Shiny.
(3) You use JS for at least part of your app.
(1) and (2) will take more time than (3), so depending on your requirements, you may have to bite the bullet and use normal JS. When using a framework like R/Shiny without your own JS, you'll always be locked into whatever's supported and miss whatever's not -- so you lose on flexibility.
For very flexible and general interaction between R and Cytoscape.js, see the RCyjs project (docs)

What does IDA use for graphing?

We need to create a CFG for some custom intermediate language code. We are currently using Qt + graphviz - and the CFGs look like ass.
Specifically, we cant seem to figure out how we can
get the "flow" (from top to bottom) into the graph, and
make the connecting lines go AROUND the other graph nodes.
Anyways, we were admiring the awesome IDA CFGs - and noticed that IDA does not seem to use graphviz at all! GV adds x MB of dependencies to our project, and we'd love to get rid of it.
SO the questions is: does anyone know what IDA uses for graph rendering and sorting?
We considered writing a IDA plugin to use the graphing feature, but that seems a little over the top for what we want to do.
Last I Checked they used (Q)WinGraph, you can get their modified source from this page (based off of VCG tool).
Something similar is yED which you might also want to check out & there are a few IDA scripts that use TouchGraph as well (which doesn't seem to be free).
I think that IDA use its own graph library (although you might ask Ilfak Guilfanov for a definitive answer about that).
What you're looking for is called "Sugiyama graph layout algorithm" (see: Layered graph drawing).
There is a really interesting paper about this problem (especially focusing on CFG) on citeseerx (see: Graph Layout for Code Flow Visualization).
As stated in the aforementioned paper the OGDF provides a Sugiyama layout algorithm although it might require some tweaking.
Hope that helps !

Resources