vis network: accessing edited data after manipulation - vis.js

When using the "manipulation" option in vis network, what is the correct access point to extract the graph data after editing (e.g., adding nodes and edges) has concluded? I'm less worried about node positions, but need to extract all IDs, labels, to's and from's at the very least. Going through network.body.data.nodes._data and the like feels like a bad hack.

Related

Graphviz: How to include multiple graphs in the same graph?

In Jupyter notebook, I am writing code that deals with a graph. It involves a series of transformations on the given graph. I am using graphviz to render the graphs inline. I can only render one graph at a time.
How do I render more than one graph side by side so that I can see successive transformations of the graph?
I know that 'subgraph' can be used to cluster different components of the graph. But I can't use it because it draws connections between all those subgraphs.
But I can't use it because it draws connections between all those subgraphs.
Sounds like the problem is that you have nodes with the same names across different subgraphs.
GraphViz has no per-subgraph namespacing mechanism. Therefore, you will need to somehow make all node names unique, even across subgraphs. You could do this by, for example, prefixing every node name with an unique subgraph ID.
Note that node labels don't need to be the same as node names. For more information, see:
graphviz: subgraph has same node, how to unique

Is there a way to create a geom_path heatmap in ggplot?

For example, this is a heatmap from a website using GPS data:
I have gotten some degree of success with adding a weight parameter to each vertex and calculating the number of events that have vertices near those, but that takes a long time, especially with a large amount of data. It also appears a bit spotty when the distance between vertices is a bit wonky, which causes random splotches of different colors throughout the heatmap. It looks kind of cool, but it makes the data a bit harder to read.
When you zoom out, it looks a bit more continuous due to the paths overlapping more.
In R, the closest I can do to this involves using an alpha channel, but that only gets me a monochromatic heatmap, which is not always desirable, especially when you want to see lesser-traveled paths visibly. In theory I could do two lines to resolve the visibility part (first opaque, second semi-transparent), but I would like to be able to have different hue values.
Ideally I would like this to work with ggplot, but if it cannot, I would accept other methods, provided they are reasonably quick computationally.
Edit: The data format is a data frame with sequential (latitude, longitude) coordinate pairs, along with some associated data that can be used for filter & grouping (such as activity type and event ID).
Here is a sample of the data for the region displayed in the above images (~1.5 MB):
https://www.dropbox.com/s/13p2jtz4760m26d/sample_coordinate_data.csv?dl=0
I would try something like
ggplot() + geom_count(data, aes(longitude, latitude, alpha=..prop..))
but you need to show some data to check how it works.

How to organise an i-graph directed network along a time axis?

I am creating a network of scientific literature, where nodes represent publications and edges citations. I used igraph to plot my example set in a circle layout.
Network,organized in circle layout
What I wnat to do next is organize the network on a time axis. I have the publication year as node-attribute in a column of the nodes file. Is there a way to organize this directed network by time?
The result should finally a bit like this:
Citationnetwork, y-axis=timeline, created with www.citnetexplorer.nl
One idea could be a treelayout and then truncating each year - tried hard, but couldn't manage. Any advice?
I'm not sure if this is the most elegant solution (or timely given that this question is over three years old...), but it might work if the network is small.
You can use tkplot(), which will pull up a window to help you manually plot the nodes. You need to have XQuartz if you're running things on a mac. The clearest bit of instruction I've found is here.

External node color in Gephi

I'm trying to create a graph in Gephi. This graph is undirected and has over 100 nodes. I would like to color the nodes in this graph according to my convenience. Say I'd like to color the nodes in 9 different colors. For doing this, I downloaded a plugin to Gephi which may be found here.
Though the plugin works, I still have to go and enter the color value for every single node manually. There doesn't seem to be a way to do this programatically. And I'd have to create about 10 such graphs, so that means a lot of manual labor.
Can someone help me out with this problem? Does someone know a better way to have custom colors for each node generated programatically? At this point, I'm generating a .gdf file, the format looks something like this.
I also know that Gephi is quite buggy, is there any other graph visualization software that I can use? Out of the other usual things that one does to the graph, I definitely want the capability to set edge weights. In other words, I'd like to make the edges thicker if the edge weight is more and vice-versa.
I can't use D3 coz I don't know Javascript. I looked into using GraphViz but it seems like it requires a lot of manual manipulation of the graph file. I'd like to have something that I'm able to generate programatically.
What seems to be working is to add a column named color VARCHAR where you add the color hex value prepended with the # sign and no quotes.
Example:
nodedef> name,label,color VARCHAR
a,"Apple",#00ffdd
b,"Banana",#00ddff
c,"Cherry",#dd00ff
d,"Did it!",#0012ca
e,"Ed 209",#121212
edgedef> node1,node2,weight
a,b,2
b,c,30
b,d,0.4
d,e,200
Edit:
For a more informed answer take a look at the Gephi documentation. The color values in the link are rgb triples but I tried with hex and it worked

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/

Resources