Neo4j Node Visualization - graph

In Neo4j, using .grass-style files to set the appearance of nodes and relationships, how can one pick a certain style for a node with multiple labels?
Since .grass-files define the visual style of a graph item by linking a certain label to a certain style the obvious question arises:
How to deal with a graph item with multiple labels?
Say, I have the following:
.grass file (pseudo-syntax):
for label "User" use color=red
for label "computer" use color=blue
graph (abstracted):
node John has Label "user"
node Mac has Label "computer"
node Robot has Labels "user" and "computer"
This obviously colors nodes John and Mike red and blue respectively.
But what about the node Robot?
In my particular problem I have a number of nodes with 2 labels each. One of these 2 labels, LabelA is common among all nodes and the other one differs from node to node. What I want is, to use the .grass style of the other-labels-style for my nodes - what it does is, i uses LabelA for all nodes to style them.
After strugeling with this issue for quite some time I give up.
Does anyone has any clue?

This is not an answer to my question but it is a work-around that finally helped me and might also help other people out there.
Assuming I have all relevant styles defined in a .grass files (one for each label) I simply post-process my graph once it is loaded in my Neo4j browser.
This means, that I delete all those labels from my nodes which are blocking the style I need for the nodes leaving only this single label which gives me my required style.
Sure, this is quite unhandy and not optimal but it's the only attempt I found.
I will not mark this as answer since maybe someone will have a more appropriate idea ...

Related

What is this type of graph called and how can it be plotted in R

A graph to indicate the percentage of elements from one node that are transferred to another node in two different stages. In principle, the number of nodes in one stage need not be equal to the number of nodes in the next stage. I would like to know the name of this type of graph and if it is possible to create it in R.
This is sankey diagram:
https://r-graph-gallery.com/sankey-diagram.html
You could find more info how to do it here:
https://plotly.com/r/sankey-diagram/

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

Control colors of links based on source and target nodes in edgebundleR

This question can be considered to be an extension of Network chord diagram woes in R
Is it possible to change the colors of the links in the plot based on whether the node on which the cursor is set is a source node or a target node as done in the following example?
https://bl.ocks.org/mbostock/7607999
I don’t intend to make the question more verbose by giving a reproducible example as the codes are already available in the links. Any help would be great.

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 to create a dyraph with multiple x-axis labels?

I'm working with a lot of rank data that would benefit from a way to simultaneously display its respective year on the x-axis. For example, I want to create the following graph adapted from the dygraph gallery:
Note how the rank information (red arrow) for a particular weekend (green arrow) are both displayed on the x axis.
I know this might not be possible with dygraphs now, at least it wasn't available in these demos, so I guess my follow up question would be are there any plans to make this possible (how about in the [r] {dygraph} package)? Apparently a plotter called flot can do this.
UPDATE 1
If indeed this feature does not exist yet, then the following, although potentially obvious to Dygraph developers, is a thought for accomplishing the task easily (perhaps I'm wrong). At first I thought it would be necessary to provide input data of the form shown in Table A
However such input is a major deviation from the existing Dygraph parser model who expects one abscissa. Such suggests that a modification to the parser to accept a "Dual Label" option, requiring that both labels be contained in a single abscissa element as in Table B, would be easier. Thereafter, with the option specified, the parser would manage CSV as it usually would with the exception that it is now "bin cognizant" and detects division between labels 1 and 2 by use of an acceptable delimiter (in this case a single quotation mark - maybe not the best choice) and divisions between label 1 abscissa elements by name change. Behind the scenes each point gets its unique x coordinate and the "Dual Label" option causes the dygraph to visually scoot up a couple pixels to accommodate an extra label. Not sure how to handle full zoomed scrolling put simply leaving a label 1 element centered until an adjacent label 1 element comes on screen is an option.
Dygraphs rule!
There's no simple way to do this with dygraphs now. As you say, there's a fairly deep assumption that there's only a single x-axis.
Your best bet would be to either modify the existing legend plugin to do this, or to create a new plugin which renders just the "Weekend 1", "Weekend 2" line. While the plugins API isn't official yet, it is at least somewhat documented.
If you get this to work, please share your code!

Resources