Visualization in pyqtgraph for node network? - pyqt5

I have a collection of network points stored as Nodes and Edges for use in networkx, but would like to impliment a more advanced visualzation tool into the pyqtgraph widget so that I can use it in a GUI designed in pyqt5.
The problem with utilizing matplotlib to visualize the nx network is that the colors are not displayed, gravity cannot be manipulated, ect...
Figure 1
The optimal case would be if cytoscape or Gephi had a backend to allow for integration into these sorts of GUIs, since I am able to get things spaced out for visualization very well with these after constructing the network in nx.
Both figures were of the same data, the only difference is that figure 2 was visualized using Gephi, allowing for the nodes to be repelled a little more, making them readable.
Is there a way to:
Adjust repulsion in networkx when NOT manually dictating node placement?
Visualize a network in a pyqtGraph widget? (preferably interactive)

Related

Can a gmsh mesh be more stucturized without using transfinite option?

For my thesis I'm using a finite element flow solver to simulate the flow through a flume. The flow solver is capable of solving the flow in a 3D unstructured mesh constructed of tetrahedrons. However, the meshes I generate with Gmsh somehow seem to be too unstructured. Which leads too unsolvable and very slow runs.
At the moment I've tried to do simulations with both unstructured and structured meshes. Simulation with very coarse unstructured meshes go very well, however once I make the element size smaller, the flow solver only produces NaN values and doesn't run at all.
For the simulations with structured meshes I've used the transfinite technique to produce a very fine structured mesh. This mesh contains way more element than the unstructured one and the results are fine. However, in future runs I need to refine the mesh in certain areas which doesn't seem possible with the transfinite volume technique in 3D.
Does anyone have any what could possibly go wrong in this case? And is there a way to improve the quality of a 3D gmsh mesh? Can the structure of the mesh be improved somehow?
Thanks in advance!
Bart
I think the middle ground between a transfinite structured grid and a completely unstructured one would be one made of 8-node hexs. If your 3D case can be built from an extruded 2D case, you could try setting Mesh.Algorithm=8 to get right triangles (rather than equilaterals) and then use the Recombine Surface option to turn them into quads.

Plotting and displaying a complex network with a react native component?

I have a rather large graph consisting of about 50 nodes and 100 vertices represented in DOT graph notation language which I want to display on a mobile device using React Native. Ideally, I would like to be able to fine-tune the layouting algorithm, e.g. the parameters of the Fruchterman–Reingold algorithm for force-directed graph drawing.
So far, I figured out two approaches:
Convert my input data such that it can be digested by react-graph-vis and plot my network on the fly. For adjusting the parameters of the drawing algorithm, things might get tricky.
Generate a SVG graphics on the server using graphviz and on the mobile device just display the SVG so that you can zoom and scroll. For this I found react-native-svg-pan-zoom whose last commit is 2 years ago (as of Dec 2019). This approach has the disadvantage that it does not work offline.
Which other alternatives do I have? Did I miss some out-of-the-box solution? Any help is appreciated!

How to redraw only the regions of an image that have changed using matplotlib

I have an application where only one row of a 1024x2048 pixel image changes at a rate of 100 times per second. I would like to display and update this image in real time using minimal resources.
However, matplotlib redraws the entire image every time I call the plt.draw() function. This is slow and processor intensive.
Is there a way to redraw only one line at a time?
I am not an expert on matplotlib internals, but I think it cannot be done in that way. Matplotlib was not designed for displaying large changing textures at a high frame rate, it is designed to offer a high level and be very easy to use API for displaying interactive plots.
Internally it is implemented in both python and c++ (for low level and high performance operation), and it uses Tcl / Tk as graphical user interface and widget toolkit (what allows the great cross-platform portability among OSs).
So, your 1024x2048 matrix has to be transformated several times before it is displayed.
If you do not need the extra features matplotlib gives (as autoscaling, axes, interactive zoom...) and your main goal is speed, I recommend you to use a more focused in performance python library / module for displaying.
There are lots of options: pyopencv, pySDL2...

Openlayers add feature in Internet explorer memory issue

We have a map configuration, where at a certain zoom level we have to plot N number of features, ranging in hundreds to thousands, but on Internt Explorer, if the feature count is more than 2500, than there are memory issues.
So, is it possible to plot the features on the map progressively in a manner, so that memory issues can be resolved?
Here are a few options that can improve performance and/or memory usage:
Use clustering Cluster Example
Use an Image Vector Layer Image Vector Example
Use 'postcompose' to draw directly to canvas to avoid the overhead of features
Don't use a spatial index on your vector source (useSpatialIndex=false)
Render features on server using a map server like GeoServer

How to let Cytoscape.js automatically create a layout like what Cytoscape creates?

I used Cytoscape for biological network visualization before using Cytoscape.js.
Cytoscape is able to create an automatic layout from our network file using its internal placement algorithm. The layout placement is very reasonable--- nodes that are connected to each other are placed nearby, and nodes are spread out nicely with the central nodes placed in the center of each group of nodes, which is really good for biological networks since there are so many nodes and so many connections among nodes.
Now I am using Cytoscape.js. I want Cytoscape.js to automatically create a layout like what Cytoscape creates. I tried to use all different layout options (“random”, “grid”, “cose”, “circle”, “breadthfirst”), but none of them creates a layout like what Cytoscape creates.
I don’t what to write our own layout placement algorithm for biological networks (which is a big deal).
But we need to use Cytoscape.js instead of Cytoscape since we need to put our molecular network workflow on the website (and visualize the network result on the website).
So my question is: how can we let Cytoscape.js automatically create a layout like what Cytoscape creates?
Thank you very much in advance!
Cytoscape desktop can make a lot of assumptions that a library can't --- or shouldn't. If you use a library like Cytoscape.js, you need to set explicit options for things that Cytoscape desktop can make assumptions about.
Look into the force-directed layouts. They're described in the docs, but I'll give an overview here:
cose : Built-in, very fast, small impact on file size, but need to set options fairly precisely for good results (e.g.)
cose-bilkent : A version of the CoSE algorithm with more enhancements, optimised to work well for bio networks, a bit slower, larger file size, gives nice results without much or any tinkering (e.g.)
cola : Works well for most graphs (e.g.)
spread : Fast, clustering cases don't want the second phase enabled
springy and arbor : Basic, usually lots of tinkering needed, even with tinkering results can be poor
Most layouts are not built-in, as Cytoscape.js is a lib. (It wouldn't be fair to force everyone to include large files when not everyone needs them.)
For more info, see
http://js.cytoscape.org/#layouts
http://js.cytoscape.org/#extensions/layout-extensions