agopen | R Documentation |
This function will read in a graph
object and create a
Ragraph
object, returning it for use in other functions. The
graph represented by the Ragraph
can be laidout in various formats.
agopen(graph, name, nodes, edges, kind = NULL, layout = TRUE, layoutType = "dot", attrs = list(), nodeAttrs = list(), edgeAttrs = list(), subGList = list(), edgeMode = edgemode(graph), recipEdges=c("combined", "distinct"))
graph |
An object of class |
nodes |
A list of |
edges |
A list of |
name |
The name of the graph |
kind |
The type of graph |
layout |
Whether to layout the graph or not |
layoutType |
Defines the layout engine. Defaults to dot, and see
|
attrs |
A list of graphviz attributes |
nodeAttrs |
A list of specific node attributes |
edgeAttrs |
A list of specific edge attributes |
subGList |
A list describing subgraphs for the graph parameter |
edgeMode |
Whether the graph is directed or undirected |
recipEdges |
How to handle reciprocated edges, defaults to
|
graph
is from the package graph-class
.
The user can specify either the graph
parameter and/or a
combination of nodes
and edges
. If either of the latter
parameters are not specified then graph
must be passed in, and
is used in the functions buildNodeList
and
buildEdgeList
(as appropriate - if nodes
is
passed in but edges
is not, only buildEdgeList
is
called) which are default transformer functions to
generate the pNode
and pEdge
lists for layout.
The edgeMode
argument specifies whether the graph is to be laid
out with directed or undirected edges. This parameter defaults to the
edgemode of the graph
argument - note that if graph
was
not passed in then edgeMode
must be supplied.
The kind parameter works as follows:
Determine the direction of the graph from the graph
object. This is the default and the recommended method.
An undirected graph
A directed graph
A strict undirected graph
A strict directed graph
Strict graphs do not allow self arcs or multi-edges.
If layout
is set to TRUE
, then the libgraph
routines are used to compute the layout locations for the graph.
Otherwise the graph is returned without layout information.
The subGList
parameter is a list describing any subgraphs,
where each element represents a subgraph and is itself a list with up
to three elements. The first element, graph
is required and
contains the actual graph
object for the subgraph. The second
element, cluster
is a logical value indicating if this is a
cluster
or a subgraph
(a value of TRUE
indicates
a cluster, which is also the default value if this element is not
specified). In Graphviz, subgraphs are more of an organizational
mechanism, whereas clusters are laid out separately from the main
graph and then later inserted. The last element of the list,
attrs
is used if there are any attributes for this subgraph.
This is a named vector where the names are the attributes and the
elements are the values for those attributes.
For a description of attrs
, nodeAttrs
and
edgeAttrs
, see the Ragraph
man page.
The recipEdges
argument can be used to specify how to handle
reciprocal edges. The default value, combined
will combine any
reciprocated edges into a single edge (and if the graph is directed,
will by default place an arrowhead on both ends of the edge), while
the other option is distinct
which will draw to separate
edges. Note that in the case of an undirected graph, every edge of a
graphNEL
is going to be reciprocal due to implementation issues.
An object of class Ragraph
Jeff Gentry
http://www.research.att.com/sw/tools/graphviz/
graphLayout
,
Ragraph
, plot
set.seed(123) V <- letters[1:10] M <- 1:4 g1 <- randomGraph(V, M, .2) z <- agopen(g1,name="foo") z z <- agopen(g1,name="foo",layoutType="neato")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.