I have the following data set (sample):
child,parent
Z,B
T,B
B,A
C,T
X,B
K,A
and i want to create a graph that has the leaf nodes differently colored. However, im unable to achieve it with the following cypher query:
load csv with headers from "file:///test.csv" as test
merge(n:Node{id:test.child})
merge(m:Node{id:test.parent})
merge(m)-[:TO]-(n)
How to achieve it?
If you want the leaf nodes to have a different colour than the other nodes you can assign a different label to them and choose a different colour for that label.
First I would assign the (child)-->(parent) relationship in a specific order by adding a > to your load query.
LOAD CSV WITH HEADERS FROM "file:///test.csv" AS test
MERGE (n:Node {id:test.child} )
MERGE (m:Node {id:test.parent} )
MERGE (m)<-[:TO]-(n)
Then i would traverse the freshly loaded tree to find the leaf nodes and I would assign them a new label. Assuming B is the root ode of the loaded tree.
MATCH (leaf:Node)
WHERE NOT ((leaf)<--())
SET leaf:Leaf
Then in the browser UI I would select the Leaf label and pick a different colour for it. Then something like this should return
MATCH path=(n:Node {id: 'B'})-[:TO*]-(end:Node)
RETURN path
Related
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/
I have been trying to plot a gVisOrgChart but some child nodes are not visible in the final output even though they exist in the data. Is there a maximum size of characters that child nodes can hold in the Output ?
I have tried adjusting the width of the nodes as well but still not able to visualize the complete output.
I have described the data and output in the below link:
https://github.com/mages/googleVis/issues/84
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
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 ...
I would like to put two series in the same graph on the graphite dashboard. However, since the dashboard requires single-line commands I could not find a way that doesn't involve the use of a wildcard.
Here's an example of the two series I would like in the same graph:
sum(base.foo.bar.positive.*)
sum(base.foo.bar.negative.*)
I tried several separators but I could not get it to work. Any ideas?
You have a few options here...
Merge the 2 graphs on to the graph via the drag and drop in the dashboard
OR
Use the sumSeriesWithWildcards() function
Merge 2 or more wildcard matching
Open your first graph on the dashboard
Open your second graph on the same dashboard
Click and hold the second graph and drag it over the first graph
Use groupByNode() and wildcard matching
This is not as nice, and will not always work however you will be able to do this all in one line.
sumSeriesWithWildcards(base.foo.bar.{positive,negative}.*, 3)
This will do the following:
Select all all the graphs that match base.foo.bar.positive.* and base.foo.bar.negative.*
Sum the data by the node at position 3: positive, negative
You might want to have a read over the following page: http://graphite.readthedocs.org/en/1.0/functions.html