Skip to content

Commit

Permalink
Merge pull request #587 from cndolo/refactor/edgelist-reader
Browse files Browse the repository at this point in the history
Use Memory Mapped Files in EdgeListReader
  • Loading branch information
fabratu committed Sep 8, 2020
2 parents 36a5fc5 + 9f7238d commit 02de60d
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 206 deletions.
14 changes: 5 additions & 9 deletions include/networkit/io/EdgeListReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ class EdgeListReader final : public GraphReader {
/**
* @param[in] separator character used to separate nodes in an edge line
* @param[in] firstNode index of the first node in the file
* @param[in] commentChar character used to mark comment lines
* @param[in] continuous boolean to specify, if node ids are continuous
* @param[in] directed treat graph as directed
* @param[in] commentPrefix prefix of comment lines
* @param[in] continuous boolean to specify if node ids are continuous
* @param[in] directed read graph as directed
*/
EdgeListReader(char separator, node firstNode, std::string commentPrefix = "#",
EdgeListReader(char separator, node firstNode, const std::string &commentPrefix = "#",
bool continuous = true, bool directed = false);

/**
Expand All @@ -48,7 +48,7 @@ class EdgeListReader final : public GraphReader {
/**
* Return the node map, in case node ids are not continuous
*/
std::map<std::string, node> getNodeMap();
const std::map<std::string, node> &getNodeMap() const;

private:
char separator; //!< character separating nodes in an edge line
Expand All @@ -57,10 +57,6 @@ class EdgeListReader final : public GraphReader {
bool continuous;
std::map<std::string, node> mapNodeIds;
bool directed;

Graph readContinuous(const std::string &path);

Graph readNonContinuous(const std::string &path);
};

} /* namespace NetworKit */
Expand Down
1 change: 1 addition & 0 deletions input/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This folder contains many smaller graphs. They are used in the testing suite and
|----------------------------------|-------------------------|-------------------------|--------------------|-----------------|-----------------|----------|----------|---------|
| airfoil1.gi | n/a | DibapGraphReader | 149370 | 4253 | 12289 | FALSE | FALSE | n/a |
| airfoil1.graph | Format.METIS | METISGraphReader | 116538 | 4253 | 12289 | n/a | n/a | n/a |
| alphabet.edgelist | Format.EdgeListTabOne | EdgeListReader | 69 | 5 | 4 | FALSE | TRUE | n/a |
| astro-ph.graph | Format.METIS | METISGraphReader | 1259548 | 16706 | 121251 | FALSE | FALSE | n/a |
| caidaRouterLevel.graph | Format.METIS | METISGraphReader | 7490360 | 192244 | 609066 | FALSE | FALSE | n/a |
| celegans_metabolic.graph | Format.METIS | METISGraphReader | 16015 | 453 | 2025 | FALSE | FALSE | n/a |
Expand Down
5 changes: 5 additions & 0 deletions input/alphabet.edgelist
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# weighted edgelist with non-numerical nodes
a b 3
a c 2
c d 1
d e 5
Loading

0 comments on commit 02de60d

Please sign in to comment.