conversion

0th

Percentile

Convert a graph to an adjacency matrix or an edge list

Sometimes it is useful to have a standard representation of a graph, like an adjacency matrix or an edge list.

Keywords
graphs
Usage
get.adjacency(graph, type="both")
get.edgelist(graph)
Arguments
graph
The graph to convert.
type
Gives how to create the adjacency matrix for undirected graphs. It is ignored for directed graphs. Possible values: upper: the upper right triangle of the matrix is used, lower: the lower left triangle of the matrix i
Details

get.adjacency returns the adjacency matrix of a graph.

get.edgelist returns the list of edges in a graph.

Value

  • A vcount(graph) by vcount(graph) numeric matrix for get.adjacency. (This can be huge!)

    A ecount(graph) by 2 numeric matrix for get.edgelist.

See Also

graph.adjacency, read.graph

Aliases
  • get.adjacency
  • get.edgelist
Examples
g <- erdos.renyi.game(10, 2/10)
get.adjacency(g)
get.edgelist(g)
Documentation reproduced from package igraph, version 0.1.2, License: GPL version 2 or later (June, 1991)

Community examples

Looks like there are no examples yet.