Template Class EdgeListReader

Inheritance Relationships

Base Types

Class Documentation

template<typename IDType, typename NNZType, typename ValueType>
class sparsebase::io::EdgeListReader : public sparsebase::io::Reader, public sparsebase::io::ReadsCSR<IDType, NNZType, ValueType>, public sparsebase::io::ReadsCOO<IDType, NNZType, ValueType>

Reader for the Edge List file format.

Reads files of the following format:

  • Each line contains 2 ids (vertices for a graph, cols/rows for a matrix) followed by an optional weight

  • Delimiters should be spaces or tabs

  • Each line represents a connection between the specified ids with the given weight

Public Functions

explicit EdgeListReader(std::string filename, bool weighted = false, bool remove_duplicates = false, bool remove_self_edges = false, bool read_undirected_ = true, bool square = false)

Constructor for the EdgeListReader class

Parameters
  • filename – path to the file to be read

  • weighted – should be set to true if the file contains weights

  • remove_duplicates – if set to true duplicate connections will be removed

  • remove_self_edges – if set to true connections from any vertex to itself will be removed

  • read_undirected_ – if set to true for any entry (u,v) both (u,v) and (v,u) will be read

virtual format::CSR<IDType, NNZType, ValueType> *ReadCSR() const override

Reads the file to a CSR instance and returns a pointer to it.

virtual format::COO<IDType, NNZType, ValueType> *ReadCOO() const override

Reads the file to a COO instance and returns a pointer to it.

~EdgeListReader() override