グラフの作成

$R
> set.seed(123)      #生成される構造を固定するためにawr.seed関数を123で初期化する
> V <- letters[1:10]
> M <- 1:4
> library(graph)
> ls("package:graph") #パッケージに含まれる関数を見る
  [1] "DFS"                   "Dist"                  "MultiGraph"          
  [4] "aM2bpG"                "acc"                   "addEdge"             
  [7] "addNode"               "adj"                   "attrDataItem"        
 [10] "attrDataItem<-"        "attrDefaults"          "attrDefaults<-"      
 [13] "aveNumEdges"           "boundary"              "buildRepDepGraph"    
 [16] "calcProb"              "calcSumProb"           "clearNode"           
 [19] "clusteringCoefficient" "combineNodes"          "complement"          
 [22] "connComp"              "degree"                "dumpGXL"             
 [25] "duplicatedEdges"       "eWV"                   "edgeData"            
 [28] "edgeData<-"            "edgeDataDefaults"      "edgeDataDefaults<-"  
 [31] "edgeL"                 "edgeMatrix"            "edgeNames"           
 [34] "edgeRenderInfo"        "edgeRenderInfo<-"      "edgeSetIntersect0"   
 [37] "edgeSetUnion0"         "edgeWeights"           "edgemode"            
 [40] "edgemode<-"            "edges"                 "eweights"            
 [43] "extractFromTo"         "extractGraphAM"        "extractGraphBAM"     
 [46] "fromGXL"               "ftM2adjM"              "ftM2graphNEL"        
 [49] "ftM2int"               "graph.par"             "graph.par.get"       
 [52] "graph2SparseM"         "graphBAM"              "graphIntersect"      
 [55] "graphRenderInfo"       "graphRenderInfo<-"     "graphUnion"          
 [58] "gxlTreeNEL"            "inEdges"               "int2ftM"             
 [61] "intersection"          "intersection2"         "isAdjacent"          
 [64] "isConnected"           "isDirected"            "join"                
 [67] "leaves"                "listEdges"             "mgEdgeData"          
 [70] "mgEdgeData<-"          "mostEdges"             "nodeData"            
 [73] "nodeData<-"            "nodeDataDefaults"      "nodeDataDefaults<-"  
 [76] "nodeRenderInfo"        "nodeRenderInfo<-"      "nodes"               
 [79] "nodes<-"               "numEdges"              "numNoEdges"          
 [82] "numNodes"              "parRenderInfo"         "parRenderInfo<-"     
 [85] "pathWeights"           "randomEGraph"          "randomGraph"         
 [88] "randomNodeGraph"       "removeAttrDataItem<-"  "removeEdge"          
 [91] "removeEdgesByWeight"   "removeNode"            "reverseEdgeDirections"
 [94] "sparseM2Graph"         "subGraph"              "subsetEdgeSets"      
 [97] "threshold"             "toDotR"                "toGXL"               
[100] "ugraph"                "ugraphOld"             "union"               
[103] "updateGraph"           "validGraph"            "validateGXL"         
> g1 <- randomGraph(V,M,0.2)
> g1
A graphNEL graph with undirected edges
Number of Nodes = 10
Number of Edges = 16
> class(g1)
[1] "graphNEL"
attr(,"package")
[1] "graph"
> slotNames(g1)
[1] "nodes"      "edgeL"      "edgeData"   "nodeData"   "renderInfo"
[6] "graphData"
> library(Rgraphviz)
 要求されたパッケージ grid をロード中です
> plot(g1)
> setwd("/home/tetsuo/2011/1101")
> getwd()
[1] "/home/tetsuo/2011/1101"
> png("110124_randomGraph.png")
> plot(g1)
> dev.off()
null device
          1
> q()
$exit