PyVis - search Node - python

I am using PyVis to build a graph (essentially a call chain). So I like how it generates a html file, with related code, to visualize it.
Is there a way I can generate a 'Search node" functionality ? The Graph I am loading is huge, and a function to zoom in to a node of interest, is what I am looking for...

There is a filter function in PyVis.
When creating the network instance, set filer_menu parameter to True.
And there is search menu shown in html file.
g = Network('1200px', width="100%", notebook=True, directed=True, filter_menu=True)
reference from https://pyvis.readthedocs.io/en/latest/tutorial.html#edges

Related

Interactive Pyvis Diagram Search function

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 :)

Generating Network graph in python

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.

Removing a internal PropertyMap from a Graph in graph-tool

For the purpose to save a graph without a specific PropertyMap (added with g.vp.foo = vprop) we need to remove it from a Graph g.
The PropertyMap is already present after the loading of the Graph from file.
How can I either remove a PropertyMap from the loaded Graph? (Or alternatively is there a way to copy only the Graph into a new one, without the PropertyMaps?)
Duhhh, found the answer just some lines below from where I copied the example above:
del g.vertex_properties["foo"]

Paraview: Can I annotate sources via python scripts?

I am visualizing a 3D dataset in paraview and want to annotate certain surface locations by marking them with an object (e.g. cone) and annotating them with text. I want to do this via python script.
Putting the cones is not a problem. But the sources Text and a3DText do not have property for location.
Does anybody know a way how I could do this?
Answer:
After generating the 3D Text source, you can put it into view using Show, then the position property can be changed:
renderView1 = GetActiveViewOrCreate('RenderView')
text = a3DText()
textDisplay = Show(text, renderView1)
textDisplay.Position = [1,1,0]
I found a method that exploits the representation properties (so, if you change visalization, you have to do it again)
Here is what I tried in the paraview gui (4.1):
Tools - Start trace
Source - 3D text
make sure you are visualizing it
in the 3dtext property panel, go to advanced options (the gear symbol)
in the visualization properties there is a field "translation", you can modify that value
I also modified the scale because it was too big for my object
Tools -stop trace : you can see the corresponding python instructions

Directed graph in python

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.

Categories

Resources