igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Plotting a signed and directed graph


From: Gábor Csárdi
Subject: Re: [igraph] Plotting a signed and directed graph
Date: Tue, 14 Apr 2009 10:59:12 +0200

Tom,

it is possible, with 0.5.2 or later versions. (Because of the curved
edges.) 0.5.2 will be on CRAN at any time, in the meanwhile it is
here:

http://cneurocvs.rmki.kfki.hu/igraph/download/igraph_0.5.2.tar.gz
http://cneurocvs.rmki.kfki.hu/igraph/download/igraph_0.5.2.zip

The latter is for windows. Here is how to do it:

library(igraph)

# just to always get the same nice picture
set.seed(123)

# a small directed random graph to test
g <- random.graph.game(10, 20, type="gnm", directed=TRUE)

# signs are random, too
E(g)$sign <- sample( c(-1,1), ecount(g), replace=TRUE)

# mutual edges are curved
E(g)$curved <- is.mutual(g)

# -1 edges are dashed
E(g)$lty <- ifelse( E(g)$sign > 0, 1, 2)

# A nice layout
coords <- layout.fruchterman.reingold(g)

# And the plot
plot(g, layout=coords)

Best,
Gabor

On Tue, Apr 14, 2009 at 10:43 AM, Tom Backer Johnsen
<address@hidden> wrote:
> Gentlepersons:
>
> I would like to obtain a plot of a signed and directed graph.  The graph is
> small, 10 nodes or vertices.  Since the graph is directed, I would like to
> have a curved arrow if there are arcs in both directions, with continuous
> leines and dashed for the negative ones. After reading the graph (containing
> -1's zeroes, and +1's) I see that I can plot a directed graph using g <- as
> directed (g) and then plot (g).
>
> Is this possible?
>
> Tom
>
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>



-- 
Gabor Csardi <address@hidden>     UNIL DGM




reply via email to

[Prev in Thread] Current Thread [Next in Thread]