as.directed {igraph}R Documentation

Convert between directed and undirected graphs

Description

as.directed converts an undirected graph to directed, as.undirected is the opposite, it converts a directed graph to undirected.

Usage

as.directed(graph, mode = c("mutual", "arbitrary")) 
as.undirected(graph, mode = c("collapse", "each")) 

Arguments

graph The graph to convert.
mode Character constant, defines the conversion algorithm. For as.directed it can be mutual or arbitrary. For as.undirected it can be each or collapse. See details below.

Details

Conversion algorithms for as.directed:

Conversion algorithms for as.undirected:

Value

A new graph object.

Author(s)

Gabor Csardi csardi@rmki.kfki.hu

See Also

simplify for removing multiple and/or loop edges from a graph.

Examples

g <- graph.ring(10)
as.directed(g, "mutual")
g2 <- graph.star(10)
as.undirected(g)

[Package igraph version 0.5.2 Index]