Graphs Objects

igraph uses graph objects to represent graphs, a graph object is an opaque type in the sense that users are not expected to manipulate graph objects directly. Instead igraph provides functions to create and manipulate graph objects. This organization has the advantage that the internal representation can be changed any time without breaking any code, assuming the users keep the rules. To facilitate the proper usage of igraph graph objects we do not present the internal graph representation here.

There are several functions which create graph objects, here is a very incomplete list of them: graph(), graph.star(), graph.tree(), graph.adjacency(), barabasi.game().

For example graph() creates a directed graph from a list of edges:

> g <- graph( c(0,1, 1,2, 3,4, 5,6) )
> g
Vertices: 7 
Edges: 4 
Directed: TRUE 

Edges:
[0] 0 -> 1
[1] 1 -> 2
[2] 3 -> 4
[3] 5 -> 6

Graph objects have an R class igraph and the is.igraph function can be used to check that an R object is an igraph graph object:

> class( graph( 1:10 ) )
[1] "igraph"
> is.igraph( graph( 1:10 ) )
[1] TRUE
> is.igraph( 1:10 )
[1] FALSE