All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EdgeListReader.h
Go to the documentation of this file.
1 /*
2  * EdgeListReader.h
3  *
4  * Created on: 18.06.2013
5  * Author: cls
6  */
7 
8 #ifndef EDGELISTREADER_H_
9 #define EDGELISTREADER_H_
10 
11 #include <fstream>
12 #include <iostream>
13 #include <string>
14 #include <map>
15 
16 
17 #include "GraphReader.h"
18 
19 namespace NetworKit {
20 
28 
29 public:
30 
31  EdgeListReader() = default; //nullary constructor for Python shell
32 
40  EdgeListReader(const char separator, const node firstNode, const std::string commentPrefix = "#", const bool continuous = true, const bool directed = false);
41 
47  Graph read(const std::string& path);
48 
54 // virtual void write(const Graph& G, std::string path);
55 
59  std::map<std::string,node> getNodeMap();
60 
61 protected:
62  char separator;
63  std::string commentPrefix;
65  bool continuous;
66  std::map<std::string,node> mapNodeIds;
67  bool directed;
68 
69 private:
70  Graph readContinuous(const std::string& path);
71 
72  Graph readNonContinuous(const std::string& path);
73 
74 };
75 
76 } /* namespace NetworKit */
77 #endif /* EDGELISTREADER_H_ */
char separator
character separating nodes in an edge line
Definition: EdgeListReader.h:62
Abstract base class for graph readers.
Definition: GraphReader.h:21
std::map< std::string, node > getNodeMap()
Write the graph to a file.
Definition: EdgeListReader.cpp:34
std::string commentPrefix
Definition: EdgeListReader.h:63
Graph read(const std::string &path)
Given the path of an input file, read the graph contained.
Definition: EdgeListReader.cpp:22
index node
Definition: Globals.h:23
A reader for various edge list formats, in which each line contains an edge as two node ids...
Definition: EdgeListReader.h:27
bool directed
Definition: EdgeListReader.h:67
A graph (with optional weights) and parallel iterator methods.
Definition: Graph.h:79
std::map< std::string, node > mapNodeIds
Definition: EdgeListReader.h:66
bool continuous
Definition: EdgeListReader.h:65
node firstNode
Definition: EdgeListReader.h:64