GTD2020-05-31 icon indicating copy to clipboard operation
GTD2020-05-31 copied to clipboard

swarma/thebrain2dot: thebrain10 .json to .dot visualization (Graphviz)

Open kunpeng9 opened this issue 4 years ago • 0 comments

This branch is 9 commits behind simoncos:master. 这个分支是 9 条在 simoncos 后面提交的: master

TheBrain10 .json (File>Export>JSON Files ) to .dot visualization with Graphviz

使用 Graphviz 将 brain10. JSON (File> Export > JSON Files) 导入到. dot visualization

  • Python 3 support 3 支持
  • UTF-8 support UTF-8 支持
  • Nodes ( 节点 (thoughts.json)
    • support shapes, colors 支持形状,颜色
    • size depends on PageRank centrality 大小取决于网页级别的中心性
  • Links ( 相关连结 (links.json)
    • support types, directions, colors 支持类型,方向,颜色
  • Layout 布局
    • support layout (algorithm), splines 支持布局 (算法) ,样条
  • Useful Reference 有用参考资料

Before:

以前:

After:

之后:

More Complicated Example:

更复杂的例子:

API 空气污染指数

Example: see test/test.py

示例: 参见 test/test.py

brain_json2dot(thoughts_path, links_path, dot_path='thebrain.dot', png_path='thebrain.png', 
                layout='dot', bg_color='grey22', node_shape='circle', node_color='white', 
                edge_default_color='white', edge_splines='', edge_font_size=10)

The Function will output both .dot file + .png file), recommended Tool for .dot: MS Code + Graphviz Interactive Preview

这个函数将输出两个. dot 文件 + . png 文件) ,推荐的. dot 工具: MS Code + Graphviz Interactive Preview

Dependency 依赖

Graphviz

Ubuntu:

Windows: TODO

窗口: TODO

Pygraphviz

Ubuntu:

apt-get install -y graphviz-dev
pip install pygraphviz

Windows: TODO

窗口: TODO

Chinese Fonts (If Chinese is not correctly shown in the visualization) 中文字体 (如果显示的中文不正确)

Ubuntu:

apt-get install -y fonts-wqy-microhei

TODO 待办事项

  • Doc: parsing of thebrain10's 文档: 对 10 年代大脑的分析thoughts.json & links.json
  • Dev: publish package to PYPI 发布包到 PYPI
  • Parsing: correct color mapping (thebrain exported json seems to have bugs about color) 解析: 正确的颜色映射 (大脑输出的 json 似乎有关于颜色的错误)
  • Layout: label / tag 布局: 标签 / 标签
  • Layout: parent / sibling location restriction in visualization 布局: 可视化中的父级 / 同级位置限制
  • Layout: community detection 布局: 社区检测 https://github.com/swarma/thebrain2dot

kunpeng9 avatar Nov 18 '20 10:11 kunpeng9