function for convert a vector to a binary matrix
vector2matrix(vec)
vec
a vector.
a n by n binary matrix indicating the adjacency.