Using Cytoscape.js for network visualization in Shiny

送分小仙女□ 提交于 2019-12-04 05:58:27

问题


I am working on a web project for network visualization. I am writing my code in R using Shiny. And I want to display my graph using Cytoscape.js

I've searched the web for some kind of source code doing this. But I couldn't find anything. The webpage of Cytoscape.js is not enough for me cause I am not expert in js and can't use the examples.

Briefly, I have Adjacency matrix of my graph and want to use it with cytoscpae.js. Do you know any source code or a tutorial of the steps I should go through?


回答1:


Cytoscape.js supports JSON for input, so as long as your R/Shiny code can produce that, you should be able to use Cytoscape.js. Here's the format described: http://cytoscape.github.io/cytoscape.js/#notation/elements-json

It looks like Shiny has a predefined set of widgets it supports, so there are a few options here:

(1) Shiny adds support for Cytoscape.js (e.g. https://github.com/cytoscape/r-cytoscape.js),

(2) A Cytoscape.js plugin is written for Shiny.

(3) You use JS for at least part of your app.

(1) and (2) will take more time than (3), so depending on your requirements, you may have to bite the bullet and use normal JS. When using a framework like R/Shiny without your own JS, you'll always be locked into whatever's supported and miss whatever's not -- so you lose on flexibility.

For very flexible and general interaction between R and Cytoscape.js, see the RCyjs project (docs)



来源:https://stackoverflow.com/questions/23116539/using-cytoscape-js-for-network-visualization-in-shiny

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!