9.4. Lazy adjacency list for edges

9.4.1. igraph_lazy_adjedgelist_init — Constructor
9.4.2. igraph_lazy_adjedgelist_destroy — Deallocate memory
9.4.3. igraph_lazy_adjedgelist_get — Query adjacent edges

9.4.1. igraph_lazy_adjedgelist_init — Constructor

int igraph_lazy_adjedgelist_init(const igraph_t *graph,
				   igraph_lazy_adjedgelist_t *al,
				   igraph_neimode_t mode);

Create a lazy adjacency list for edges. This function only allocates some memory for storing the vectors of an adjacency list, but the adjacent edges are not queried, only when igraph_lazy_adjedgelist_get() is called.

Arguments: 

graph:

The input graph.

al:

Pointer to an uninitialized adjacency list.

mode:

Constant, it gives whether incoming edges ( IGRAPH_IN ), outgoing edges ( IGRPAH_OUT ) or both types of edges ( IGRAPH_ALL ) are considered. It is ignored for undirected graphs.

Returns: 

Error code.

Time complexity: O(|V|), the number of vertices, possibly. But it also depends on the underlying memory management too.

9.4.2. igraph_lazy_adjedgelist_destroy — Deallocate memory

void igraph_lazy_adjedgelist_destroy(igraph_lazy_adjedgelist_t *al);

Free all allocated memory for a lazy edge adjacency list.

Arguments: 

al:

The adjacency list to deallocate.

Time complexity: depends on memory management.

9.4.3. igraph_lazy_adjedgelist_get — Query adjacent edges

#define igraph_lazy_adjedgelist_get(al,no)

If the function is called for the first time for a vertex, then the result is stored in the adjacency list and no further query operations are needed when the adjacent edges of the same vertex are queried again.

Arguments: 

al:

The lazy adjacency list object.

no:

The vertex id to query.

Returns: 

Pointer to a vector. It is allowed to modify it and modification does not affect the original graph.

Time complexity: O(d), the number of adjacent edges for the first time, O(1) for subsequent calls with the same no argument.