10.2. igraph_to_undirected — Convert a directed graph to an undirected one.

int igraph_to_undirected(igraph_t *graph,
			 igraph_to_undirected_t mode);

If the supplied graph is undirected, this function does nothing.

Arguments: 

graph:

The graph object to convert.

mode:

Constant, specifies the details of how exactly the convesion is done. Possible values: IGRAPH_TO_UNDIRECTED_EACH: the number of edges remains constant, an undirected edge is created for each directed one, this version might create graphs with multiple edges; IGRAPH_TO_UNDIRECTED_COLLAPSE: one undirected edge will be created for each pair of vertices which are connected with at least one directed edge, no multiple edges will be created.

Returns: 

Error code.

Time complexity: O(|V|+|E|), the number of vertices plus the number of edges.