Visualisation for hierarchically clustered graph on map in python - graph

I am starting a new project in python (to be used through jupyter-notebooks), where I'll need to visualise some hierarchically clustered graphs.
I have looked for existing packages, but so far I am not convinced by what I have seen.
I am not interested in the clustering process in itself, because this will be another part of the project and I know (roughly) how the graphs will be built up progressivelly.
What I am looking for are:
an appropriate data structure for storing hierarchically clustered graphs,
visualisation tools that would allow to represent the graph on a map (based on X and Y coordinates of the nodes) and either represent the subparts of the clusters, or simplify the clusters depending on their type or depth in the graph structure,
ideally, bring some interactivity, for example the ability to zoom-in or-out, or click on some clustered nodes to expand the nodes that were hidden in the cluster.
It looks pretty specific and despite some cool packages I have seen I am not sure which one would help without having too much to reimplement. So far, NetworkX looks like a cool starting point, especially with some D3.js (as shown here), but it is still far from what I have in mind.
Any advice about where to start digging?
Thanks a lot.
Gautier

For Python, Seaborn's clustermaps are nice. Seaborn is mainly meant to be used with Pandas dataframes; however, the documentation for clustermap says it can be rectangular data, and so I think it means other arrays will wor.
See also:
Dendrogram with heat map
SciPy Hierarchical Clustering and Dendrogram Tutorial
Hierarchical Clustering in Python

Related

Which R packages are suitable for plotting disease transmission over time?

I am trying to find a way to plot a disease transmission tree that allows me to:
plot the tree over a timeline (a timeline spanning 2 months)
specify the shape and colour of the nodes in the tree (so that you can easily identify which nodes belong to the same household for example)
format the link between the nodes (dashed lines, two way arrows, solid lines...etc.)
plot "stray branches" that aren't linked to the root/parent node.
The dataset I am working with is relatively small (22 nodes) so I don't mind working with a package that is a bit fiddly!
I have thought about using phylogeny trees, but I'm uncertain whether they will allow me to plot stray nodes. Which package would be most suitable for this task?
Thanks!
Try DiagrammeR. I don't have much experience, but it did what I needed to do and I know I barely scratched the surface of what it can do.

Is it possible to download graph of scalars in TensorBoard?

I'm using Tensorboard to visualize the training of a neural network in R. Tensorboard gives really nice graphs of the accuracy, the loss, validation accuracy etcetera. I would like to download these graphs (including smoothing and legend) just like one can download the graph of the nodes. Is this possible? I know that you can download the data one by one, but then you would have to make the graph manually including the smoothing and legend. This would be a lot of work, while you already have such a nice looking graph. I have tried using SVG Crowbar, but I don't know which one to download (if this even works...). I do not know what to do. The best solution thus far seems to be using printscreen and paint.
Thanks in advance for helping me!

Complex domain graphs

Source of image : https://math.stackexchange.com/questions/144268/is-there-a-name-for-this-type-of-plot-function-on-complex-plane-vs-time-shown
I had in one of my lectures a graph of how sin, cos and exp are related in complex domain with a figure that close to that one. I searched on-line a lot until I found that picture on Math.SE.
As per my search I found that it is only PTC mathcad that is stating it is possible to draw complex domain graphs but couldn't find any information related in mathcad manual or even in books including such graphs. Did any one managed to have such graphs drawn before. I would appreciate it as it will help me imagine graphically the circulation of complex numbers and the changes in formulas.
Can any one help?
In Mathcad, use CreateSpace with the appropriate functions of time. You'll have to open the plot dialog box to set the various axis and backplane options. You'll also need to ensure that each of the 3 plot elements is set to Data Points rather than Surface (the default display for the 3D plot component).
I typed the plot's expressions for exp, sin and cos elsewhere in the worksheet and then dragged them onto the plot.

How do I visualise an arbitrary directed acyclic graph?

I'm looking for an algorithm to automatically visualise a large DAG. It needs to scale well to hundreds or even thousands of nodes and connections (without turning unreadable). Connections should avoid crossing over each other where possible, and should especially avoid crossing over nodes that they aren't connected to.
Is there any standard algorithm I can adapt for this purpose?
You could check out the scalable force-directed placement algorithm. Graphviz implements this, so if you'd like to preview it before implementing, create a Graphviz file and run sfdp my_dag.gv (or fdp which might be easier to implement).
If that doesn't work for you, you might want something like Circos or Hive Plots. Hive Plots work really well for thousands of nodes for both directed and undirected graphs. The algorithm is described at a high level on the homepage, but there's an accompanying journal article too.
You can try Gephi a graph viz software.
You can feed it with different file type (.gexf, .gdf).
As this is a open source software, you can look inside spatialization algorithms.
url: http://gephi.org/

Visualizing a DAG

I have a large directed acyclic graph that I would like to visualize in a bitmap image.
Ideally I'd like to have all the root nodes at the top of the image, and all of the leaf nodes at the bottom, i.e. the graph edges are all pointing in a downwards direction.
Is there a good algorithm for working out the coordinates of all the nodes that meets these constraints and will produce a good visualization?
I advise you to use Gephi.
This soft is able to do all the things you want to, especially graph layouts !
Look at the Graphviz software collection. It contains several programs to render graphs.
The most simple way is to write your graph to disk, in one of Graphviz's text formats. Then execute one of the render programs, and load the resulting image into your application.
Bayesian Networks have similar requirements. You might look for algorithms for Bayesian Networks. This paper for example might be helpful.
If the graph is fairly simply then bitmaps will serve you fairly well. For very dense graphs however you'll want something with vector graphics, such as a SVG file that will support zooming in and out of fine details in a more friendly manner. Better yet is to use an interactive tool dedicated to navigating a graph such as gephi like someone mentioned above or yED
If you're trying to visualize a software dependency graph the best tool I've found for navigating is the DGML tools that are part of Visual Studio. They use a very powerful Sugiyama tree layout that does a fine job of making the flow of the graph directional. They have powerful interactive features with these edge hopping links that are bar none. You can also organize subgraphs and collapse them down, etc.
There's several graph description languages covered in Wikipedia with checking out
https://en.wikipedia.org/wiki/Category:Graph_description_languages. If you have a good chunk of RAM the DGML tools can render very pleasantly and make the interaction and exploration of the graph very intuitive.
There's a decent overview of layout techniques to be seen here particularly #2 Layered Graph Drawing from Kozo Sugiyama.
You might be interested in layered graph drawing (also known as "hierarchical graph drawing" or "Sugiyama-style graph drawing"). The algorithm is too long to describe here, but Google searches bring up many reliable explanations.
You can try this Go package I wrote: https://github.com/h8liu/e8tools/tree/master/dagvis
An example: http://lonnie.io/gostd/dagvis/

Resources