as.directed

0th

Percentile

Convert between directed and undirected graphs

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

Keywords
graphs
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:

  • arbitrary
{The number of edges in the graph stays the same, an arbitrarily directed edge is created for each undirected edge.} mutual{Two directed edges are created for each undirected edge, one in each direction.}

Value

  • A new graph object.

concept

  • Directed graph
  • Undirected graph

code

as.undirected

itemize

  • each

item

collapse

See Also

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

Aliases
  • as.directed
  • as.undirected
Examples
g <- graph.ring(10)
as.directed(g, "mutual")
g2 <- graph.star(10)
as.undirected(g)
Documentation reproduced from package igraph, version 0.5.5-3, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.