from numpy import mat
# refer to page 8.6
print 'given a graph with 6 nodes viz. node1,node2....node6'
A=mat([[0, 1, 0, 1 ,1 ,0],[1, 0, 1, 0, 1, 0],[0, 1, 0, 0, 0, 1],[1, 0, 0 ,0 ,0 ,0],[1 ,1, 0, 0, 0, 0],[0, 0, 1, 0 ,0 ,0]])
print 'The adjacency matrix for A is : \n',A
print 'sequence A is a path from node4 to node6# but it is not a trail since the edge from node1 to node2 is used twice'
B=mat([[0 ,0, 0, 1, 1, 0],[0, 0 ,0 ,0 ,1, 1],[0, 0, 0, 0 ,0, 0],[1, 0, 0 ,0 ,0,0],[1, 1, 0, 0, 0, 0],[0,1, 0 ,0, 0, 0]])
print 'The adjacency matrix for B is : \n',B
print 'sequence B is not a path since there is no edge from node2 to node6 is used twice'
C=mat([[0, 0, 0 ,1 ,1 ,0],[0, 0, 1, 0, 1, 0],[0, 1, 0, 0, 1, 0],[1, 0, 0, 0, 0, 0],[1, 1, 1, 0, 0, 1],[0, 0, 0, 0, 1, 0]])
print 'sequence C is a trail since is no edge is used twice'
D=mat([[0, 0 ,0 ,1, 1, 0],[0, 0, 0, 0, 0, 0],[0, 0 ,0 ,0, 1, 1],[1, 0, 0,0, 0, 0],[1, 0, 1, 0, 0, 0],[0, 0, 1 ,0 ,0 ,0]])
print 'The adjacency matrix for D is : \n',D
print 'sequence D is a simple path from node4 to node6'