igraph-help
[Top][All Lists]

## [igraph] How can i add the edges?

 From: Vladimir Petrov Subject: [igraph] How can i add the edges? Date: Sat, 20 Feb 2010 05:48:39 +0600

```Hello!

I have a problem with edges

/*file igraph_add_edges.c from "sample" folder*/

igraph_t g;
igraph_vector_t v;
int ret;

/* Create graph */
igraph_vector_init(&v, 8);
VECTOR(v)[0]=0; VECTOR(v)[1]=1;
VECTOR(v)[2]=1; VECTOR(v)[3]=2;
VECTOR(v)[4]=2; VECTOR(v)[5]=3;
VECTOR(v)[6]=2; VECTOR(v)[7]=2;
igraph_create(&g, &v, 0, 1);

/* Add edges */
igraph_vector_resize(&v, 4);
VECTOR(v)[0]=2; VECTOR(v)[1]=1; // <--- What does it mean?
VECTOR(v)[2]=3; VECTOR(v)[3]=3;

/*************************/
A quote from "igraph_create" function help:
"const igraph_vector_t *edges
The edges to add, the first two elements are the first edge, etc."

What does it mean "first edge"? The edge between what vertexes?
What should i write if i want, for example, add an edge between
second and fifth vertexes? Or create self-loop on 8th vertex?

What sense does have statement "VECTOR(v)[2]=3"? The edges from vertex
number "2" to vertex number "3"?

```

reply via email to