用户给出邻接矩阵和节点名称列表,在canvas上绘制出可视化的图
声明:本项目由这个项目改良而来
特性:
- 用户输入图的邻接矩阵,使用canvas将图可视化,并且在节点间显示方向、箭头、权重
- 自动识别无向图和有向图,自动识别边的类型
- 用户可以随意拖动节点
- 可设置是否绘制箭头、是否绘制权重标签
- 可设置隐藏特定权重值的标签
- 支持修改画板大小
- 支持导出导入图(含绘图设置),提供文件和文本两种导入导出形式
- 页面根据设备宽度响应式调整,并且支持触屏设备
- 不依赖任何第三方库
- 单文件网页,用户可下载到本地打开运行
邻接矩阵:
0 1 2
1 0 1
1 0 0
效果:
0 2 1 1 1 0 1
2 0 0 1 0 0 1
1 0 0 0 5 0 0
1 1 0 0 1 1 0
1 0 5 1 0 1 0
0 0 0 1 1 0 1
1 1 0 0 0 1 0
Users provide an adjacency matrix and a list of node names to draw a visual representation of the graph on a canvas.
Disclaimer: This project is an improvement upon this project.
Features:
- Users input the adjacency matrix of the graph, and the graph is visualized using canvas, displaying direction, arrows, and weights between nodes.
- Automatic detection of undirected and directed graphs, as well as edge types.
- Users can freely drag nodes.
- Option to enable/disable arrow drawing and weight labels.
- Option to hide labels for specific weight values.
- Support for modifying canvas size.
- Support for exporting and importing graphs (including drawing settings) in both file and text formats.
- Responsive page layout that adapts to device width, including support for touch devices.
- No dependencies on any third-party libraries.
- Single-file webpage that users can download and open locally.
Adjacency matrix:
0 1 2
1 0 1
1 0 0
Result:
Adjacency matrix:
0 2 1 1 1 0 1
2 0 0 1 0 0 1
1 0 0 0 5 0 0
1 1 0 0 1 1 0
1 0 5 1 0 1 0
0 0 0 1 1 0 1
1 1 0 0 0 1 0
Result: