igraph (version 0.6-3)

print.igraph: Print graphs to the terminal

Description

These functions attempt to print a graph to the terminal in a human readable form.

Usage

## S3 method for class 'igraph':
print(x, full=getIgraphOpt("print.full"),
  graph.attributes=getIgraphOpt("print.graph.attributes"),
  vertex.attributes=getIgraphOpt("print.vertex.attributes"),
  edge.attributes=getIgraphOpt("print.edge.attributes"),
  names=TRUE, ...)
## S3 method for class 'igraph':
summary(object, \dots)
## S3 method for class 'igraph':
str(object, \dots)

Arguments

x
The graph to print.
full
Logical scalar, whether to print the graph structure itself as well.
graph.attributes
Logical constant, whether to print graph attributes.
vertex.attributes
Logical constant, whether to print vertex attributes.
edge.attributes
Logical constant, whether to print edge attributes.
names
Logical constant, whether to print symbolic vertex names (ie. the name vertex attribute) or vertex ids.
object
The graph of which the summary will be printed.
...
Additional agruments.

Value

  • All these functions return the graph invisibly.

Details

summary.igraph prints the number of vertices, edges and whether the graph is directed.

str.igraph prints the same information, and also lists the edges, and optionally graph, vertex and/or edge attributes.

print.igraph behaves either as summary.igraph or str.igraph depending on the full argument. See also the print.full igraph option and getIgraphOpt.

The graph summary printed by summary.igraph (and print.igraph and str.igraph) consists one or more lines. The first line contains the basic properties of the graph, and the rest contains its attributes. Here is an example, a small star graph with weighed directed edges and named vertices: IGRAPH DNW- 10 9 -- In-star + attr: name (g/c), mode (g/c), center (g/n), name (v/c), weight (e/n) The first line always starts with IGRAPH, showing you that the object is an igraph graph. Then a four letter long code string is printed. The first letter distinguishes between directed (D) and undirected (U) graphs. The second letter is N for named graphs, i.e. graphs with the name vertex attribute set. The third letter is W for weighted graphs, i.e. graphs with the weight edge attribute set. The fourth letter is B for bipartite graphs, i.e. for graphs with the type vertex attribute set.

Then, after two dashes, the name of the graph is printed, if it has one, i.e. if the name graph attribute is set.

From the second line, the attributes of the graph are listed, separated by a comma. After the attribute names, the kind of the attribute -- graph, vertex or edge -- is denoted, and the type of the attribute as well, character, numeric, or other (x). As of igraph 0.4 str.igraph (and print.igraph) uses the max.print option, see options for details.

Examples

Run this code
g <- graph.ring(10)
g
summary(g)

Run the code above in your browser using DataCamp Workspace