GraphViz Node Organization - graphviz

I am trying to organize the nodes to be in a specific way but no matter what I try, I just cannot do it. I am trying to get close to this:
I have many variations but here is what I have so far: https://gist.github.com/wpsmithtwc/3f82433d11b2e99cc65382bf231aa04c
(see GraphViz fiddle).
Any suggestions?

Related

Custom node position in dagree-d3

I have a directed acylic graph done with dagre-d3. Is there any possibility to put a node in a different level and change the position of a node with some code? This library has some 'rank constraints' but it looks like in the latest version it's not working. My current suggestion is adding some links and hide them after that, but it's the last possible option and I really want to avoid it.
Currently, my graph looks as follow and my goal is put one cluster under other

D3 Sankey Diagrams: How to handle dynamic data? I.E. Nodes/Links with no value (or 0 value)

This is a question for those working with D3.js Sankey diagrams.
What is the recommended approach for organizing/creating the JSON data for these diagrams?
Every example I've come across involves the example creator having the JSON/CSV having at least one value for every node/link.
However, If you try to supply dynamic data where you don't know if everything will have a value, and if a node/link value is zero, the node floats to the top-left and it disconnected from everything.
Example:
The items in this picture I'm talking about are: "Fugitive Emissions", "Industry", and "electricity and heat"
Cleaning up these nodes seems non-trivial.
It would seem logical to somehow exclude them from the JSON data to begin with, but this feels like an overly complicated process.
I.E. If you remove a node in the JSON, you need to remove all links associated with that node, but this would seem to require a recursive check to ensure everything is kept clean.
I'm still searching for possible ways to have the D3 Sankey remove the nodes without values, but the crux of the problem seems to be that the SVG object is populated with data for nodes based on the JSON data supplied, not what is passed to the Sankey JavaScript code. I've tried filtering the nodes I don't want here, but it doesn't affect what has already been attached to the SVG (Which is ultimately displayed on the diagram).
Any suggestions are welcome regarding how to remove/filter nodes without values. Either an addition to the Sankey code, or a suggestion for organizing/filtering the JSON data to be supplied to the Sankey.

Im trying my hardest to get a D3 Hierachy tree running. But failed at appending

This is my first post - be gentle, I'm learning (or trying to) D3js.
I have been trying to put together a basic D3js Heirachy tree and have hit an issue.
While I have the basics pretty much covered I am hitting a wall.
I have started with this code as a foundation as its pretty close to what I'm trying to achieve.
http://blockbuilder.org/mattsrinc/16dab5a09aa46ed46975
However, as the original creator had stated - when you ADD/APPEND a new node it removes any and all children to the node you are using.
I've managed to isolate the point at which I think its occuring and replaced
Within the dndtree.js line 398.
if (currentNode[0]._children!=null) {
With
if(!d.children==false ) {
This stops the deletion and then I can add a node to the end and drag it into place - not ideal, but works.
I was wondering if any proper java wizards have a proper solution.
Any pointers appreciated and any help gratefully received.
Thank you for your time.

How to make graph out of seqential data

I am new to whole elastic stack so pardon me if this is basic. But looking into docs I can't find way how to make following graph.
I am feeding elasticsearch with data that looks like this. [{place:'a', time:0, user:1}, {place: 'b', time:1, user:1}, {place:'c', time:2, user:1}, {place:'a', time: 3, user:1}] It is describing path which user went. So for this one a->b->c->a, and some other one could go c->d->a->d->c.
Is is possible to make graph with vertices made out of places and edges describing where users went?
You can't create this visualisation, but its open issue in github

Arango single tree response using AQL only

I have found several questions that are similar but no solution worked as needed, or used internal functions. This is the most relevant one:
Getting data for d3 from ArangoDB using AQL (or arangojs)
I'm unable to understand how to return a single response with a tree structure of parent + children. Something that D3 can understand. Whatever I do, beyond the first iteration, everything is a mess. I have tried MERGE and MERGE_RECURSIVE but it just did not work as I thought of.
I'm clueless to how I can make it to work. I'm used to Neo4J and for some reason this one is just hard for me to understand.
Any help will do,
Thanks,
DD.
I found a simple solution. I'm just using AQL to get a flat list of results and their edges. After that, I just sort it as I need on my code

Resources