I wrote a simple csv-parser that can be used to convert csv-files (with a specific structure) to a nodes list and edges list that can be imported into Gephi, and can also be more easily imported into a Neo4j Graph Database, using the csv-importer functions.
The program was created specifically to be used with file structures that I tend to work with a lot, and therefore it may be of little use to other people (see the Readme on Github for more details). Still, there might be elements in the code that are of interest to others.
The source code for the plugin is available on Github, and open sourced with the GPL 3.O license. The readme file on Github also includes instructions to build the program. It was created with C++ (including standard libraries) and Qt4, so you should be able to build it on OSX as well, if you want. I don’t plan to make an OSX build myself.
I build the program for Linux as well as Windows:
The Windows distribution was statically built, so it can be ran by just running the csv-parser executable. The Linux distribution makes use of shared libraries, and it should be able to find those in the folder in which the program is distributed if you run the program through the included script file. Run the script from the terminal:
- Open a terminal (CTRL-ALT-T)
- Browse to the path where you unpacked the csv-parser
- Usually it is necessary to first run the following command: chmod +x ./csv-parser.sh
- Then you can run the program with the command: ./csv-parser.sh
If that doesn’t work, then I probably messed up the script (I am not that experienced at writing scripts yet), but you can probably solve it by installing the qt4 libraries for linux.
Issues and fixes
- 2017-06-06: I slightly improved handling of file names when saving files. The extension ‘.csv’ is now automatically added when not added by the user.
- 2017-03-01: Based on some experiences writing another program, I performed some optimisations, as well as simplifications to the code. The functionality of the program has not changed, but memory usage has decreased.
- 2016-11-17: I encountered issues with the way that text fields are imported. That should be solved in the latest version of the program. I also encountered an issue with sources and targets being reversed when exporting the edge list. That has also been resolved.
- 2016-11-08: I noticed that the last column of input files was not read. This issue is fixed in the latest version of the program.