This tool can be used to visualize an undirected simple graph.
The algorithm is based on a force-directed method and simulated annealing, called Fruchterman-Reingold.
macOS
Please install matplotlib
first.
Run the bash script.
./visualization.sh [InputFile]
For example
./visualization.sh benchmark/input1.txt
make
python3 draw.py <[InputFile]
make clean
The first line should contain two integer
In
n m
a1 b1
a2 b2
...
am bm
fruchterman_reingold.Visualization(numNode, numEdge, Edges)
numNode
: number of nodesnumEdge
: number of edgesEdges
: a list of edges, each edge is a list of two indices of node
id | type | image |
---|---|---|
1 | ![]() |
|
2 | ![]() |
|
3 | Petersen Graph | ![]() |
4 | ![]() |
|
5 | Tree | ![]() |
6 | Bamboo | ![]() |
7 | ![]() |
|
8 | 100 isolated nodes | ![]() |
9 | Grid | ![]() |
10 | Grid | ![]() |
11 | Caterpillar tree | ![]() |
12 | 5-regular | ![]() |
13 | ![]() |