A graph transformation tool that converts edge list files to different formats.
make
./graph_transform_tool [options] <input1> [input2 ...]
Options:
-f, --format <graph|igraph>: output format (default:graph)-e, --out-ext <ext>: output extension (default: format name)-g, --graph-id <id>: graph id forigraphheader (default:1)-i, --input <path>: input file (can be repeated)
Convert SNAP to data.graph-style (header t <V> <E>, edges e u v):
./graph_transform_tool -f graph -e graph dataset/Ca-AstroPh.txt
Convert SNAP to yeast.igraph-style (header t # <id>, edges e u v 0):
./graph_transform_tool -f igraph -e igraph -g 1 dataset/Ca-AstroPh.txt
Outputs are written to transformed/ next to the binary, with the input basename and chosen extension.
- Handles arbitrary whitespace, CRLF line endings, and comment headers (
#,%,//). - Node ids are remapped to a compact 0..N-1 range.
- Self-loops are removed, and multiple edges between the same two vertices are collapsed to one.
- Vertex labels and edge labels are set to
0by default.