项目作者: pcbje

项目描述 :
大杂乱数据的图形可视化
高级语言: JavaScript
项目地址: git://github.com/pcbje/ggraph.git
创建时间: 2016-12-30T11:08:59Z
项目社区:https://github.com/pcbje/ggraph

开源协议:Apache License 2.0

下载


ggraph - Graph visualization for messy data

Build Status
Coverage Status

This is a library built on top D3 with the goal of improving how we work with large and messy graphs. It extends the notion of nodes and links with groups of nodes. This is useful when multiple nodes are in fact the same thing or belong to the same group.

Live demo: https://gransk.com/ggraph.html

Some examples of nodes that may belong together:

  • IPs in the same subnet
  • Emails / monikers
  • File fingerprints
  • Bitcoin addresses in same wallet
  • Alternative spellings and typos

Data model

The easiest apporach is to call ggraph.convert with a valid D3 object:

  1. var graph = {
  2. nodes:[
  3. {id: "Maria West", type: "female"},
  4. {id: "Hazel Santiago", type: "male"},
  5. {id: "Sheldon Roy", type: "male"}
  6. ],
  7. links: [
  8. {source: "Maria West", target: "Hazel Santiago", value:100},
  9. {source: "Maria West", target: "Sheldon Roy"}
  10. ]
  11. }
  12. converted = ggraph.convert(graph);

Usage

Initialization:

  1. ggraph.init('container', 25); // Marker timeout
  2. ggraph.draw(converted);

Merge nodes into groups:

  1. // Merge selected
  2. ggraph.merge(selection.all());
  3. // Into single group
  4. ggraph.merge(['Maria West', 'Sheldon Roy']);
  5. // Into several groups
  6. ggraph.merge([
  7. ['A', 'B'],
  8. ['C', 'D']
  9. ]);

Split and remove:

  1. ggraph.split(['Maria West', 'Sheldon Roy']);
  2. ggraph.remove(['Maria West', 'Hazel Santiago']);

Building

  1. git clone https://github.com/pcbje/ggraph && cd ggraph
  2. npm install
  3. node_modules/.bin/karma start tests/cover.conf.js
  4. node_modules/.bin/karma start tests/watch.conf.js
  5. node_modules/.bin/grunt min

Disclaimer

This is a work in progress. Contributions are very much welcome!