[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Plotting an ancestral graph
From: |
Tamas Nepusz |
Subject: |
Re: [igraph] Plotting an ancestral graph |
Date: |
Mon, 14 Jun 2010 12:00:00 +0100 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
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