• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

paulgb/nbgraph: Inline, interactive graphs inside jupyter/ipython notebooks

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

paulgb/nbgraph

开源软件地址:

https://github.com/paulgb/nbgraph

开源编程语言:

Python 66.8%

开源软件介绍:

nbgraph

Interactive graph exploration inside of a Jupyter notebook. Graphs are rendered with sigma.js.

screenshot

Installation

Install is as simple as:

pip install nbgraph

Use

Graphs are represented with the NotebookGraph class. Although manual graph construction is possible with the add_node and add_edge methods, the anticipated use-case is that the user will create or load a graph with another library and use the nbgraph represenation only for the final display of the graph. With this in mind, nbgraph comes with loaders for working with graphs represented by igraph or networkx.

Quick-start Examples

See the examples directory for the examples as Jupyter notebooks.

igraph

from nbgraph.loaders.igraph_loader import load_graph
import igraph
G = igraph.Graph.Atlas(381)
load_graph(G)

networkx

from nbgraph.loaders.networkx_loader import load_graph
import networkx as nx
G=nx.dodecahedral_graph()
load_graph(G)

Notebooks with multiple graphs

If you use multiple graphs within the same notebook, you will see a warning about nbgraph being loaded multiple times. This is because the Python code can't reliably know what's loaded in the JavaScript, so it tries to load it every time a graph is displayed. This means sending the entire graph rendering code for each graph, which can explode the size of an .ipynb file.

To avoid this, use prepare_notebook:

from nbgraph.renderer import display_notebook, prepare_notebook
prepare_notebook()

Then, use display_notebook with an extra False argument to display the graph:

my_graph = load_graph(G)
display_notebook(load_graph(my_graph), False) 



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap