igraph-help
[Top][All Lists]
Advanced

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

[igraph] problems with "circle" graphs


From: Laurin Müller
Subject: [igraph] problems with "circle" graphs
Date: Wed, 24 Feb 2010 16:10:14 +0100

Hi,

i need do convert graphNEL graphs to igraph because i want to use the
method:  get.all.shortest.paths

i works fine except when i have a circle graph like in function
testGraphCircle() below:

  1 - 2
 /     \
6       3     
 \     /
  5 - 4


       > testGraphCircle <- function(){
+  # create graphNEL object
+  g = new("graphNEL")
+  # add nodes
+    g = addNode("1",g)
+    g = addNode("2",g)
+    g = addNode("3",g)
+    g = addNode("4",g)
+    g = addNode("5",g)
+    g = addNode("6",g)
+  # add edges
+    g = addEdge("1","2",g,1)
+    g = addEdge("2","3",g,1)
+    g = addEdge("3","4",g,1)
+    g = addEdge("4","5",g,1)
+    g = addEdge("5","6",g,1)
+    g = addEdge("6","1",g,1)
+  # return graphNEL
+  g
+ }
> g <- testGraphCircle()
> g
A graphNEL graph with undirected edges
Number of Nodes = 6 
Number of Edges = 6 
> ig <- igraph.from.graphNEL(g)
> ig
Vertices: 12 
Edges: 6 
Directed: FALSE 
Edges:
              
[0] '1' -- '2'
[1] '2' -- '6'
[2] '1' -- '1'
[3] '1' -- '1'
[4] '1' -- '1'
[5] '1' -- '1'
> 

the graphNEL has 6 vertices
BUT the resulting igraph has 12 vertices

Might that be a bug or am I using something wrong.

thanks for your help in advance and
best regards,
Laurin

PS: i am using R 2.10 and igraph version 0.5.3:
> version
               _                            
platform       i686-pc-linux-gnu            
arch           i686                         
os             linux-gnu                    
system         i686, linux-gnu              
status                                      
major          2                            
minor          10.0                         
year           2009                         
month          10                           
day            26                           
svn rev        50208                        
language       R                            
version.string R version 2.10.0 (2009-10-26)
> packageDescription("igraph")
Package: igraph
Version: 0.5.3
Date: Nov 22, 2009
Title: Network analysis and visualization
Author: Gabor Csardi <address@hidden>
Maintainer: Gabor Csardi <address@hidden>
Description: Routines for simple graphs and network analysis. igraph
        can handle large graphs very well and provides functions for
        generating random and regular graphs, graph visualization,
        centrality indices and much more.
Depends: stats
Suggests: stats4, rgl, tcltk, RSQLite, digest, graph, Matrix
License: GPL (>= 2)
URL: http://igraph.sourceforge.net
Packaged: 2009-11-22 12:32:44 UTC; csardi
Repository: CRAN
Date/Publication: 2009-11-22 16:20:35
Built: R 2.10.0; i686-pc-linux-gnu; 2010-02-22 15:36:48 UTC; unix

--
File: /home/laurin/R/i686-pc-linux-gnu-library/2.10/igraph/Meta/package.rds 
> 





reply via email to

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