简体   繁体   English

HTML中的有向图表示

[英]Directed Graph Representation in HTML

I have stored a graph in a Java data structure which maps a node to a node list. 我已经在Java数据结构中存储了一个图,该图将一个节点映射到一个节点列表。 The graph is more likely a tree structure. 该图更可能是树状结构。 I want to represent the graph in a HTML page like a tree view. 我想在HTML页面(如树视图)中表示图形。 I can convert the data structure to JSON format and send to a JavaScript function. 我可以将数据结构转换为JSON格式并发送给JavaScript函数。 The general view of the tree is like the following. 树的一般视图如下所示。

    A
   / \
  B   C
 / \   \
D   E   F
 \ /
  G
  |
  H

You could create your own graphing code, but D3 ( http://d3js.org ) has some excellent tree graphing. 您可以创建自己的图形代码,但是D3( http://d3js.org )具有一些出色的树形图形。

Examples: https://github.com/mbostock/d3/wiki/Tree-Layout 示例: https//github.com/mbostock/d3/wiki/Tree-Layout

http://bl.ocks.org/d3noob/8375092 http://bl.ocks.org/d3noob/8375092

试用您可以使用http://d3js.org创建的力导向图(以下为示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM