0th

Percentile

The read.graph function is able to read graphs in various representations from a file, or from a http connection. Currently some simple formats are supported.

Keywords
graphs
##### Usage
read.graph(file, format = "edgelist", ...)
##### Arguments
file
The connection to read from. This can be a local file, or a http or ftp URI.
format
Character constant giving the file format. Right now edgelist, ncol and lgl are supported, the default is edgelist.
...
##### Details

The read.graph function may have additional arguments depending on the file format (the format argument).

• edgelist
{ This format is a simple text file with numeric vertex ids defining the edges. There is no need to have newline characters between the edges, a simple space will also do. There are no additional arguments for this format. } ncol{ This format is used by the Large Graph Layout program (http://bioinformatics.icmb.utexas.edu/lgl), and it is simply a symbolic weighted edge list. It is a simple text file with one edge per line. An edge is defined by two symbolic vertex names separated by whitespace. (The symbolic vertex names themselves cannot contain whitespace. They might followed by an optional number, this will be the weight of the edge; the number can be negative and can be in scientific notation. If there is no weight specified to an edge it is assumed to be zero.

The resulting graph is always undirected. LGL cannot deal with files which contain multiple or loop edges, this is however not checked here, as igraph is happy with these.

• names
{Logical constant, whether to add the symbolic names as vertex attributes to the graph. If TRUE the name of the vertex attribute will be name.} weights{Logical constant, whether to add the weights of the edges as edge attribute weight. } } lgl{The lgl format is used by the Large Graph Layout visualization software (http://bioinformatics.icmb.utexas.edu/lgl), it can describe undirected optionally weighted graphs. From the LGL manual: The second format is the LGL file format (.lgl file suffix). This is yet another graph file format that tries to be as stingy as possible with space, yet keeping the edge file in a human readable (not binary) format. The format itself is like the following: # vertex1name vertex2name [optionalWeight] vertex3name [optionalWeight] Here, the first vertex of an edge is preceded with a pound sign '#'. Then each vertex that shares an edge with that vertex is listed one per line on subsequent lines. LGL cannot handle loop and multiple edges or directed graphs, but in igraph it is not an error to have multiple and loop edges. Additional arguments:
• names
{Logical constant, whether to add the symbolic names as vertex attributes to the graph. If TRUE the name of the vertex attribute will be name.} weights{Logical constant, whether to add the weights of the edges as edge attribute weight. }
}

##### Value

• A graph object.

write.graph