igraph-help
[Top][All Lists]

## Re: [igraph] Plotting an ancestral graph

 From: Alexander Savi Subject: Re: [igraph] Plotting an ancestral graph Date: Thu, 17 Jun 2010 22:19:40 +0200

Thank you Tamas and Gábor for your quick responses, it was very helpful.

Given the information below, is it possible to single out the number in front of the arrow and the number behind the arrow? In the example below, for E(g3)[0], I need the numbers 1 (in front of the arrow) and 2 (behind the arrow) to use in a loop. I've been puzzling a lot, but I haven't been able to 'get' those number out of the rest of the information. So I need a command that gives me back for instance the number in front of the arrow. I hope my question is clear.

> E(g3)
Edge sequence:

[0] 1 -> 2
[1] 1 -> 4
[2] 2 -> 1
[3] 2 -> 5
[4] 3 -> 4
[5] 4 -> 5

Thanks,

Alexander

On 14 June 2010 13:00, Tamas Nepusz 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

_______________________________________________
igraph-help mailing list
http://lists.nongnu.org/mailman/listinfo/igraph-help

reply via email to