Class NetworkitBinaryWriter

Inheritance Relationships

Base Type

Class Documentation

class NetworkitBinaryWriter : public NetworKit::GraphWriter

Writes a graph written in the custom Networkit format. Note that there are multiple versions of the Networkit binary format. Since Networkit 9.1 (December 2021), the writer always writes files using format version 3. Reading a binary file with version < 3 and re-writing it, implicitly upgrades the format to the current version. Further information can be found here: https://github.com/networkit/networkit/blob/master/networkit/cpp/io/NetworkitBinaryGraph.md

Note
A new version 4 is slated for an upcoming release (time of statement: February 2026). This version supports writing/reading graphs with deleted nodes. As with version 3, all networks written with the new code are automatically upgraded to the newest version 4. If you want to use v4 right away, you can use nightly builds (see Readme on github).

Public Functions

NetworkitBinaryWriter(uint64_t chunks = 32, NetworkitBinaryWeights weightsType = NetworkitBinaryWeights::AUTO_DETECT, NetworkitBinaryEdgeIDs edgeIndex = NetworkitBinaryEdgeIDs::AUTO_DETECT)
virtual void write(const Graph &G, std::string_view path) override
std::vector<uint8_t> writeToBuffer(const Graph &G)