Learn R Programming

ggraph (version 2.0.6)

get_con: Create a connection extractor function

Description

Connections within the ggraph terminology are links between nodes that are not part of the network structure itself. In that sense connections do not affect the layout calculation in any way and will not be drawn by the standard geom_edge_* functions. A connection does not need to only be defined by a start and end node, but can include intermediary nodes. get_con helps in creating connection data by letting you specify start and end nodes and automatically finds the shortest path within the graph structure that connects the given points. If this is not what is needed it is also possible to supply a list of vectors giving node indices that define a connection.

Usage

get_con(
  from = integer(),
  to = integer(),
  paths = NULL,
  ...,
  weight = NULL,
  mode = "all"
)

Value

A function that takes a layout_ggraph object and returns the given connections

Arguments

from, to

The index of the start and end nodes for the connections

paths

A list of integer vectors giving the index of nodes defining connections

...

Additional information to be added to the final data output

weight

An expression to be evaluated on the edge data to provide weights for the shortest path calculations

mode

Character constant, gives whether the shortest paths to or from the given vertices should be calculated for directed graphs. If out then the shortest paths from the vertex, if in then to it will be considered. If all, the default, then the corresponding undirected graph will be used, ie. not directed paths are searched. This argument is ignored for undirected graphs.

See Also

Other extractors: get_edges(), get_nodes()