Template Numerical Library version\ main:4e6e2c1
Loading...
Searching...
No Matches
TNL::Graphs::Readers::EdgeListReader< Graph > Struct Template Reference

Reader for graphs in edge list format. More...

#include <TNL/Graphs/Readers/EdgeListReader.h>

Public Types

using DeviceType = typename Graph::DeviceType
using IndexType = typename Graph::IndexType
using ValueType = typename Graph::ValueType

Static Public Member Functions

static void read (const std::string &file_name, Graph &graph)
 Reads a graph from an edge list file.

Detailed Description

template<typename Graph>
struct TNL::Graphs::Readers::EdgeListReader< Graph >

Reader for graphs in edge list format.

This reader reads a graph from a file in edge list format, where each line represents an edge between two vertices, optionally with a weight. Lines starting with '#' are treated as comments and ignored.

Example of weighted edge list format:

# This is a comment
0 1 2.5
1 2 1.0
2 0 3.0

Example of unweighted edge list format:

# This is a comment
0 1
1 2
2 0
Template Parameters
GraphThe type of the graph to be read.

Member Function Documentation

◆ read()

template<typename Graph>
void TNL::Graphs::Readers::EdgeListReader< Graph >::read ( const std::string & file_name,
Graph & graph )
inlinestatic

Reads a graph from an edge list file.

Parameters
file_nameis the name of the file containing the edge list.
graphis the graph object to be populated.

The documentation for this struct was generated from the following file: