Add graph references

This commit is contained in:
Abdelrahman Said
2026-06-28 13:49:01 +01:00
parent 0a9807e448
commit a11edf0c53
2578 changed files with 868045 additions and 0 deletions
@@ -0,0 +1,33 @@
#include <igraph.h>
#include <assert.h>
int main(void) {
igraph_t graph;
igraph_vector_int_t edges;
/* Initialize the library. */
igraph_setup();
/* Create a directed graph with no vertices or edges. */
igraph_empty(&graph, 0, IGRAPH_DIRECTED);
/* Add 5 vertices. Vertex IDs will range from 0 to 4, inclusive. */
igraph_add_vertices(&graph, 5, NULL);
/* Add 5 edges, specified as 5 consecutive pairs of vertex IDs
* stored in an integer vector. */
igraph_vector_int_init_int(&edges, 10,
0,1, 0,2, 3,1, 2,1, 0,4);
igraph_add_edges(&graph, &edges, NULL);
igraph_vector_int_destroy(&edges);
/* Now the graph has 5 vertices and 5 edges. */
assert(igraph_vcount(&graph) == 5);
assert(igraph_ecount(&graph) == 5);
igraph_destroy(&graph);
return 0;
}