# vec2mat

From ghypernet v1.0.0
by Giona Casiraghi

##### Auxiliary function, produces matrix from vector

The number of elements of vec are the number of non-zero elements in the adjacency matrix. It performs the opposite operation of `mat2vec.ix`.

##### Usage

`vec2mat(vec, directed, selfloops, n)`

##### Arguments

- vec
vector to be put in matrix form

- directed
a boolean argument specifying whether object is directed or not.

- selfloops
a boolean argument specifying whether the model should incorporate selfloops.

- n
vector. if length(n)==1, n is the number of vertices. If length(n)==3 first element is number of vertices, second and third elements are number of vertices for row and column of bipartite matrix.

##### Value

matrix nxn generated from vector.

##### Examples

```
# NOT RUN {
data('adj_karate')
ix <- mat2vec.ix(adj_karate, FALSE, FALSE)
vec <- adj_karate[ix]
vec2mat(vec, FALSE, FALSE, nrow(adj_karate))
# }
```

*Documentation reproduced from package ghypernet, version 1.0.0, License: AGPL-3*

### Community examples

Looks like there are no examples yet.