All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
NetworKit::SNAPGraphWriter Class Reference

Write graph in the Georgia Tech SNAP (Small-world Network Analysis and Partitioning) (http://snap-graph.sourceforge.net/) file format (do not confuse this with the Stanford Network Analysis Project.) From the SNAP user guide: More...

#include <SNAPGraphWriter.h>

Public Member Functions

 SNAPGraphWriter ()=default
 
virtual void write (const Graph &G, const std::string &path) override
 
- Public Member Functions inherited from NetworKit::GraphWriter
virtual ~GraphWriter ()=default
 

Detailed Description

Write graph in the Georgia Tech SNAP (Small-world Network Analysis and Partitioning) (http://snap-graph.sourceforge.net/) file format (do not confuse this with the Stanford Network Analysis Project.) From the SNAP user guide:

A sample graph file in the SNAP format (.gr extension) (lines beginning with a # symbol indicate comments)

p denotes the problem line p <n> <m> <undirected/directed> <weight_type> <0 or 1-indexed>

n indicates the number of vertices.

m denotes the number of edges.

The third parameter can be either u denoting a undirected graph, or d denoting a directed graph. Internally, an edge <u, v> in an undirected graph is stored as two directed links u->v and v->u.

weight_type can be u (unweighted), i (integer), l (long, 8 bytes on 64-bit architectures), f (float), or d (double)

For the fifth parameter, 0 indicates that the valid range of vertex IDs is 0 to n-1. 1 indicates that it is 1 to n.

The problem line is followed by a listing on exactly m edges. The format is <u v="" w>=""> for a weighted graph, and <u v>=""> for an unweighted graph.

Good job

Constructor & Destructor Documentation

NetworKit::SNAPGraphWriter::SNAPGraphWriter ( )
default

Member Function Documentation

void NetworKit::SNAPGraphWriter::write ( const Graph G,
const std::string &  path 
)
overridevirtual

The documentation for this class was generated from the following files: