I have the following undirected graph (picture) that contains a cycle or a Hamiltonian path of length |V|= 8. The cycle (path) with no repeated edges and vertices is the red line. The adjacency matrix is :
A | B | C | D | E | F | G | H | |
---|---|---|---|---|---|---|---|---|
A | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 |
B | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 |
C | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 |
D | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |
E | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 |
F | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 |
G | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 |
H | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 |
How can I plot this graph in R ?
Ham = matrix(c(0,1,0,1,1,0,0,0,
1,0,1,0,0,1,0,0,
0,1,0,1,0,0,0,1,
1,0,1,0,0,0,1,0,
1,0,0,0,0,1,1,0,
0,1,0,0,1,0,0,1,
0,0,0,1,1,0,0,1,
0,0,1,0,0,1,1,0),8,8)
Ham