GraphComparison {sharp}R Documentation

Edge-wise comparison of two graphs

Description

Generates an igraph object representing the common and graph-specific edges.

Usage

GraphComparison(
  graph1,
  graph2,
  col = c("tomato", "forestgreen", "navy"),
  lty = c(2, 3, 1),
  node_colour = NULL,
  show_labels = TRUE,
  ...
)

Arguments

graph1

first graph. Possible inputs are: adjacency matrix, or igraph object, or output of GraphicalModel, VariableSelection, BiSelection, or output of SimulateGraphical, SimulateRegression.

graph2

second graph.

col

vector of edge colours. The first entry of the vector defines the colour of edges in graph1 only, second entry is for edges in graph2 only and third entry is for common edges.

lty

vector of line types for edges. The order is defined as for argument col.

node_colour

optional vector of node colours. This vector must contain as many entries as there are rows/columns in the adjacency matrix and must be in the same order (the order is used to assign colours to nodes). Integers, named colours or RGB values can be used.

show_labels

logical indicating if the node labels should be displayed.

...

additional arguments to be passed to Graph.

Value

An igraph object.

See Also

SelectionPerformanceGraph

Examples

# Data simulation
set.seed(1)
simul1 <- SimulateGraphical(pk = 30)
set.seed(2)
simul2 <- SimulateGraphical(pk = 30)

# Edge-wise comparison of the two graphs
mygraph <- GraphComparison(
  graph1 = simul1,
  graph2 = simul2
)
plot(mygraph, layout = igraph::layout_with_kk(mygraph))

[Package sharp version 1.4.6 Index]