On 14 June 2010 13:00, Tamas Nepusz
<address@hidden> wrote:
Hello,
> I use iGraph in R for plotting the undirected adjacencies between variables
> (o --- o) and the colliders (--> o <--). It seems to me that in iGraph it is
> not possible to plot a graph with both directed and undirected edges (I
> think it is called an ancestral graph and I think Pearl calls it a
> rudimentary pattern).
Well, you're right that an igraph graph can either be directed or
undirected, and a directed graph contains directed edges only. However,
you can *suppress* the arrows of a directed edge on the plot by using
the arrow.mode attribute. arrow.mode can take one of three values:
- 0: no arrowheads are plotted
- 1: an arrowhead pointing to the *source* of the edge is plotted
- 2: an arrowhead pointing to the *target* of the edge is plotted
- 3: both arrowheads are plotted
So, if you want to suppress the arrowheads on some of the edges, you can
do this:
> E(g)$arrow.mode <- 2
> undirected_edge_idxs <- c(0, 2, 7)
> E(g)[undirected_edge_idxs]$arrow.mode <- 0
> plot(g)
--
Tamas