Socket
Socket
Sign inDemoInstall

@cosmograph/cosmos-tigergraph

Package Overview
Dependencies
21
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @cosmograph/cosmos-tigergraph

Use Cosmos to visualize data from your TigerGraph graph database.


Version published
Maintainers
1
Created

Readme

Source

Connecting Cosmos with TigerGraph

Use Cosmos to visualize data from your TigerGraph graph database.

To begin, you will need to spin a TigerGraph on-prem solution. If you use a TigerGraph Cloud solution, be sure to enable CORS or use middleware.

To initialize the connection, run TigerGraphConnection with the details of the solution you just provisioned, including the host, the name of the graph, and your username and password. The final parameter of token is optional; if it is not provided, it will be generated when needed.

let conn = new TigerGraphConnection(host, graphname, username, password, token);

Running getTigerGraphData will convert data from specific vertex and edge types to Cosmos-compatible InputNode and InputLink types, and its two parameters are string arrays of vertex and edge types.

getTigerGraphData(vertex_type, edge_type)

This will return a Promise with InputNode and InputLink arrays with the vertices, edges, and attributes which can be used to create a graph.

conn.getTigerGraphData(["VertexType1", "VertexType2"], ["edge_type_1", "edge_type_2"]).then((data) => {
    const canvas = document.querySelector("canvas") as HTMLCanvasElement;
    const graph = new Graph(canvas);
    graph.setData(data.nodes, data.links);
});

In addition, users can run installed and interpreted queries and the results will be visualized. Currently, only vertices and edges returned in the form of lists or sets are supported. The syntax for the two are similar.

conn.runInterpretedQuery('interpreted_query_string').then((data) => {
    const canvas = document.querySelector("canvas") as HTMLCanvasElement;
    const graph = new Graph(canvas);
    graph.setData(data.nodes, data.links);
});
conn.runInstalledQuery('installed_query_name').then((data) => {
    const canvas = document.querySelector("canvas") as HTMLCanvasElement;
    const graph = new Graph(canvas);
    graph.setData(data.nodes, data.links);
});

FAQs

Last updated on 16 Dec 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc