save d3.map() to be able to restore it later - node.js

I am creating a picture using d3, the picture is composed from node and link (arrow):
var graph = { nodes: d3.map(), edges: d3.map() };
Is there way to save nodes and edges using node.js to be able to restore it later?

Related

Output MQTT data into a Node-Red graph

I am currently using an MQTT client that is linked with some Arduino code that produces numerical outputs at a 2 second interval. This is further linked to a NodeRed flow where it reads the input passed through the broker, and outputs it as a payload message on the dashboard. I am wanting to produce a graph node that is connected to the MQTT subscriber and shows real time data in the UI. I attempted this in the way shown in the example image as I wanted to still see the information in the dashboard, but I could not get a proper graph to appear. Could anyone help me with how I could do this?
To get the chart node to work properly you need to feed it just the numerical value.
Your MQTT messages are actually a string as follows Temperature = -70.06660 degrees so you will need to extract the number from the string.
The quickest way to do this is probably to insert a function node between the MQTT-in node and the chart node.
In the function node add the following code:
var parts = msg.payload.split(" ");
msg.payload = parseFloat(parts[2]);
return msg;
This should now just feed the numerical part to the chart node.

Relationships are not displaying properly in Neo4J

I'm just starting out with Neo4j and I've been trying to send over simple relationships using Postman. I'm not having any issues sending the Nodes but the second I try to create a relationship, it creates two arbitrary grey nodes and builds the relationships. However, when I send a command like this:
CREATE (a:Person { name:'Tom Hanks', born:1956 })
-[r:ACTED_IN { roles: ['Forrest']}]->
(m:Movie { title:'Forrest Gump',released:1994 })
It properly displays the nodes and the relationship between them. See image below for more clarity.
This seems a bit odd as I would assume you'd be able to easily add nodes or create relationships at any point rather than when the Node's are being created.
Any feedback would be greatly appreciated.
Yes, you can create Relationship after the node is created using Match clause.
For e.g.
MATCH (node1:node),(node2:node)
WHERE node1.val=20 AND node2.val=21
CREATE (node1)-[r:Rel]->(node2)
RETURN r

How to create graph in ArangoDb using arangosh command line?

I am trying to execute following JS file using arangosh in order to build my graph. The file executes without error but when I go into web interface, I do see a graph created but no vertices or edges in the graph.
db._dropDatabase("database");
db. _createDatabase("database", [], [{username: "admin", passwd: "admin", active: true}]);
db._useDatabase("database");
var graph_module = require("org/arangodb/general-graph");
var graph = graph_module._create("myGraph");
//Add top level documents
graph._addVertexCollection("users");
graph._addVertexCollection("positions");
graph._extendEdgeDefinitions(graph_module._relation("has_worked_at", ["users"], ["positions"]));
I save this file as database.js and then run following command
arangosh --javascript.execute database.js
The graph was created, the two vertex collections and the edge collection as well, but they do not contain any documents (vertices and edges). If you add
db.users.insert({_key:"Max"});
db.positions.insert({_key:"ArangoDB"});
db.has_worked_at.insert("users/Max", "positions/ArangoDB", {developer:true});
to your script, you will see two vertices and an edge in the graph viewer.

Clear images from RenderWindowControl C# Activize.Net

I am using RenderWindowControl in order to display Dicom Series.
This way:
string folder = path;//#"C:\VTKdata";
vtkDICOMImageReader reader = vtkDICOMImageReader.New();
reader.SetDirectoryName(folder);
reader.Update();
// Visualize
_ImageViewer1 = vtkImageViewer2.New();
_ImageViewer1.SetInputConnection(reader.GetOutputPort());
_ImageViewer1.SetRenderWindow(renderWindow);
_ImageViewer1.SetSlice(_MinSlice1);
_ImageViewer1.Render();
I need to be able to delete all images displayed by the control, before the user reloads a new series.
Any help?
Thanks.
Clear the renderwindow by
_ImageViewer1.SetRenderWindow(null);
renderWindow.Render();
and simply connect it again if new data is available
_ImageViewer1.SetRenderWindow(renderWindow);
_ImageViewer1.Render();

How To Obtain All the Nodes and Connections After Launching the GMF Project

After launching the GMF project, I get a new window to make my own model.
After placing some nodes and connections, I should calculate according to their attributes. At first, HOW can I obtain all the information of every node and every connection?
First , let's get the relevant editor:
DomainDiagramEditor d= (DomainDiagramEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
Now, you can either get all the editparts in your diagram , getting the relevant model from them:
final List children = d.getDiagramEditPart().getChildren();
gets you a list of EditParts.
Or, you can get the model objects directly with:
EObject element = d.getDiagram().getElement();
EList<EObject> eContents_ = element.eContents();
That gives you a list of all the model objects in the active editor.
Hope that answers your question

Resources