0

I'd like to read a .gdf file into igraph. Is there a function that does this and returns an igraph object? Im using the igraph R package

I came across "read_graph()" when looking through the igraph documentation, which handles foreign file formats. It seems as though .gdf files are not a format that this function can convert.

luism
  • 33
  • 6
  • 2
    Where exactly does this `gdf` file come from? Assuming it's from a GUESS software graph, you might try this package: https://github.com/mikajoh/readgdf. It appears to just be a text file that you can probably read and parse yourself if you'd rather not have the dependency. It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Feb 15 '23 at 21:36
  • Hi, yes the file is from a GUESS program. I also came across that package, but wanted to ask this question to see if there are any other solutions, maybe even already included in igraph. Could you elaborate on how to parse the file myself? That would be a grat help. Also I dont see how adding some lines of code for reproducibility would help here, since neither the content of the file nor my previous approach via read_graph() are relevant to the solution – luism Feb 15 '23 at 22:10
  • From what I saw online it looked like the file was basically just a structured text file. If you provided a sample we could confirm that. It’s a lot easier to write code to parsed a specific file and test with than write a general parser without any test case. – MrFlick Feb 16 '23 at 00:53
  • 2
    That package has one file with R code for parsing the file. You can see exactly what it does at https://github.com/mikajoh/readgdf/blob/master/R/read_gdf.R. It seems like it should be very easy to just use that package. That is not a very common format so there is no support for in in igraph itself. – MrFlick Feb 16 '23 at 15:38
  • As of version 1.4.1, R/igraph does not contain functionality for reading GDF files. – Szabolcs Feb 16 '23 at 16:19
  • Okay thanks for the help, I guess the mentioned package is a good starting point then. – luism Feb 17 '23 at 10:30

0 Answers0