I am trying to depict the relationship of different data entities with my ETL (extraction transformation loading) pipeline. The final output is a large directed graph. So far I am using Python to extract data relationship. Pydot helps me generate svg file which I can open up using a browser. The graph that I generate is static.
Pydot lets me setup tooltip and allows me to link other html pages with nodes or edges. I am looking for more than that.
A small portion of the graph is shown below
I want to do several things with this graph.
Every node can have several attributes (including name). It is not possible for me to display those attributes because of paucity of space. But as users mouse over (or do other mouse based action) I would like those attributes to show up as "floating" table which user can dismiss if not interested.
Not all node attributes are integer or strings. It can be graphs as well. For example for one of the nodes I may have a bar chart showing how often this data entity is getting loaded in last 7 days. I would like that bar chart to float over as the user moves (clicks) mouse over that node. Currently I am using matplotlib to generate bar / pie charts associated (please see above) with nodes. I link those diagrams with my original directed graph using setURL in pydot. But the user experience is not great since it takes user over to a new page.
I am happy with node layout etc that I get by default from Pydot/GraphViz. I prefer not to do everything from ground up unless it is absolutely necessary.
Ability to highlight only certain part of the graph based on query in node or edge attributes
I read this forum and came across several options in response to questions similar to mine.
gephi
igraph (I played around with igraph which lets me query by vertex
or edge. I couldn't figure out how I can make my final graph
interactive based on user input e.g. floating table on mouse over of
a node etc)
Javascript libraries - sigma.js, arbor.js, d3.js nodebox
networkX
nodebox
I have Python skill but quite novice on Javascript side. I would like to know from experts what can be my best bet (from functionality and ease of use point of view). A browser based solution is preferred.
Any suggestion / help will be really appreciated.
Thanks
Abhijit
Try NetworkX. Node attributes can be anything hashable, so that addresses (at least) your first two bullets.
You will still be using matplotlib to generate the charts. I don't know of a better solution than that.
Related
To understand better mathematics and for further use, I need to solve some exercises or represent myself some concepts using my computer, by programming them and watch their results on screen.
Among the subjects I'm studying, are the sets and their elements, inclusions, injections, etc.
I'd like to represent them graphically with Python. But not to loose myself in details, plotting circles for elements and lines with arrows for relations, as if I was using Logo.
Use a known module instead, to help me doing my displays would be perfect.
Is there any tool useful to represent graphically some sets and their content with Python?
If not, I guess that they are some tools that represent graphs, and then translating:
elements -> nodes
relations -> edges
could do the work, provided I draw an ellipse around each set...?
another better way to achieve this?
Which tool would you recommend me to represent sets graphically with Python?
Hi i am creating an interactive graph in Pyvis with more than 200 nodes and i want to add a search bar functionality, so i can have the chance to add in the search bar the node name and that it will be selected in the graph.
Does anyone had anything like this?
I am currently working on the same thing. One tool I have used in the past is a software called Gephi. It allows you to load in a node and edges table which can then be displayed in an html through sigma.js. If you find anything for pyvis let me know :)
I used networkx package in python to construct multiple networks, where each represents a biological experiment. I then exported these networks as gml files to visualize in cytoscape and make comparisons. In each file, I have two attributes for nodes- i.e., count and color. In cytoscape, I assign the node size to its count. However, there is a huge difference between the counts of nodes, for instance some have a count of 100 while others have a count of 50,000. I would like map the sizes of all nodes in all cytoscape networks to one scale and also have a legend indicating the relative sizes. An example is shown in right side of the image below! I hope you can help me!
Image source
The answer to the first part of the question is to construct a log(count) column. That should give you a better range to map into node size.
The best 'shipping' solution to creating a legend in a command called 'Create Legend...' found in the Style control panel pop-up menu. That exports a graphics file, but doesn't do an adequate job of it. I'm working on an app called Legend Creator, which will add annotations to the canvas for a legend. It's in development on the github/cytoscape repo.
I am trying to generate a network graph for 200+ nodes and 300+ edges using networkx using python from a file. I was able to generate and plot the graph using matplotlib in my Juypter Notebook, but its not looking good and nodes are so tightly packed.
Is there any other python package help to generate network graph ??.
My aim is to generate graph for whole data set so that I can find dependency between nodes.
If nodes being too close together is the issue, try using the draw_spring()function of networkx.
https://networkx.github.io/documentation/networkx-2.0/reference/generated/networkx.drawing.nx_pylab.draw_spring.html#networkx.drawing.nx_pylab.draw_spring
It simulates what would happen if each edge were a spring and the network were picked up and spun around, seperating the nodes, especially the ones which are not connected via many paths.
If this does not work initially, you can use the parameters of the function that draw_spring() wraps, the spring_layout() function. Try adjusting the k value parameter. This should allow you to manipulate the rough distance between nodes.
https://networkx.github.io/documentation/networkx-2.0/reference/generated/networkx.drawing.layout.spring_layout.html#networkx.drawing.layout.spring_layout
Alternatively, there are additional draw functions you might find more useful than draw_spring(). You can find them in the draw section here: https://networkx.github.io/documentation/networkx-2.0/reference/drawing.html
I can recommend using Netwulf. Input a networkx.Graph object to netwulf.visualize, and launch the visualization in a new browser window. The result and data can be posted back to Python.
Disclaimer: I co-author Netwulf.
I'm writing a web interface for a database of genes values of some experiments with CGI in Python and I want to draw a graph for the data queried. I'm using matplotlib.pyplot, draw a graph, save it, and perform it on the web page. But usually there are many experiments queried hence there are a lot of values. Sometimes I want to know which experiment does one value belong to because it's a big value, whereas it's hard to identify because the picture is small in size. The names of the experiments are long strings so that it will mess the x axis if I put all the experiment names on the x axis.
So I wonder if there is a way to draw a graph that can interact with users, i.e. if I point my mouse to some part on the graph, there would be one small window appears and tells me the exact value and what is the experiment name here. And the most important is, I can use this function when I put the graph on the web page.
Thank you.
What you want is basically D3.js rendering of your plots. As far as I know, there are currently three great ways of achieving this, all under rapid development:
MPLD3 for creating graphs with Matplotlib and serving them as interactive web graphics (see examples in Jake's blog post).
Plotly where you can either generate the plots directly via Plotly or from Matplotlib figures (e.g. using matplotlylib) and have them served by Plotly.
Bokeh if you do not mind moving away from Matplotlib.