Conversions

Converting GML file into Pajek file

On Icon we found a network Western US Power Grid. We downloaded it. Its description is in GML format.

> library(igraph)
> wdir <- "C:/Users/batagelj/Downloads/data/icon"
> setwd(wdir)
> G <- read_graph("power.gml",format="gml") 
> G
IGRAPH 7fdbd15 U--- 4941 6594 -- 
+ attr: id (v/n)
+ edges from 7fdbd15:
 [1]  7--  9  8--  9  9-- 10 10-- 11  6-- 14 13-- 14 14-- 15 14-- 16 15-- 17
[10] 15-- 18 19-- 20 20-- 21 15-- 30 34-- 35 35-- 36 36-- 37 37-- 38 37-- 39
[19] 37-- 40 42-- 43 37-- 48 45-- 48 46-- 48 47-- 48 11-- 51 22-- 52 25-- 54
[28] 26-- 59 42-- 59 59-- 60 60-- 61 10-- 62 32-- 63 64-- 69 65-- 69 66-- 69
[37] 36-- 70 67-- 70 69-- 70 68-- 71 70-- 71 73-- 74 10-- 76 49-- 76 77-- 78
[46] 79-- 80 80-- 81 82-- 83 14-- 84 72-- 87 77-- 87  5-- 89 56-- 89 88-- 89
[55] 88-- 90 89-- 91 74-- 92 12-- 95 27-- 95 44-- 95 93-- 95 94-- 95 95-- 96
[64] 35-- 98 41-- 98 29-- 99 43-- 99 58-- 99 75-- 99 83-- 99 99--101
+ ... omitted several edges
> write_graph(G,"power.net",format="pajek")

See also saving_igraph_network_as_pajek_project_file

> source("https://raw.githubusercontent.com/bavla/Rnet/master/R/igraph+.R")
> write.graph.paj(G,"power.net")



pajek/ev/pde/conv.txt · Last modified: 2022/04/27 03:44 by vlado
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki