# [Networkit] How to read an edge list file?

Henning Meyerhenke meyerhenke at kit.edu
Fri Apr 17 18:07:17 CEST 2015

```Hi Steve,

You may want to try the approximate betweenness code as well, it's even
faster and gives meaningful results for the vertices with high BC values.

Best,
Henning

Am 17.04.15 um 18:03 schrieb Steve Koch:
> Thank you, Max! No, I think the reader is excellent I just didn't know
> where to look for the answers yesterday :)
>
> On Fri, Apr 17, 2015 at 9:49 AM, Maximilian Vogel
> <maximilian.vogel at student.kit.edu
> <mailto:maximilian.vogel at student.kit.edu>> wrote:
>
>     Hi Steve,
>
>     In addition to what Kolja explained to you, there is also an even
>     shorter way to read such graphs. You can use the generic EdgeList
>     Format and pass the other parameters directly, e.g.:
>     firstNode=8, continuous=False)
>
>>     And right now it appears to be crunching away at betweenness
>>     centrality calculation (multithreaded on 8 cores, woo hoo!). Right
>>     now my nodes are not consecutive (e.g. there are no nodes 15,
>>     21-28, etc.). Am I using the continuous=False parameter correctly?
>>     Or would it be recommended to pre-process my file and renumber the
>>     nodes so they start at 0 or 1 and don't skip any numbers?
>     Just look at the following example graph:
>     2---3---1
>     |   |
>     6---4   5
>     Node 5 does not have any edges, so it won't appear in the edge list.
>     With continuous=False, the firstNode parameter doesn't really matter
>     as the reader just counts the number of unique node ids among the
>     edges and initializes the graph that number. Then, a mapping is
>     required which in this case could be: 1 -> 0, 2 -> 1, 3 -> 2, 4 -> 3
>     and 6 -> 4, while node 5 would be missing in the Graph object in
>     NetworKit. On the other hand, with continuous=True the graph will be
>     initialized with the highst node id found in the file plus 1, if
>     firstNode=0. Then, isolated nodes will be contained in the Graph
>     object. In the case of betweenness centrality it won't make a
>     difference at all as isolated nodes have a betweenness centrality of
>     zero.
>     So it really depends on your data and from where you got it in order
>     to decide whether you should set continuous to true or false. In my
>     opinion, pre-processing shouldn't be necessary at all. However, if
>     you think that there is some functionality missing from the
>     EdgeListReader, you could tell us. :)
>
>     Cheers,
>     Max
>
>
>>
>>     Thank you!
>>
>>
>>
>>     On Thu, Apr 16, 2015 at 6:18 PM, Kolja Esders
>>     <kolja.esders at student.kit.edu
>>     <mailto:kolja.esders at student.kit.edu>> wrote:
>>
>>         Hi Steve,
>>
>>         that depends on the separator you use. The following formats
>>         for edge lists are available:
>>
>>         EdgeListCommaOne, EdgeListSpaceOne, EdgeListSpaceZero,
>>         EdgeListTabOne, and EdgeListTabZero.
>>
>>         The succeeding "One" and "Zero" indicate whether the index of
>>         the first node in the file is 1 or 0.
>>
>>         If the above formats don't work for you, there is also the
>>         possibility to use EdgeListReader directly.
>>
>>         Hope this helps.
>>
>>         Cheers,
>>         Kolja
>>
>>         On 17 April 2015 at 02:17, Kolja Es <kolja.esders at gmail.com
>>         <mailto:kolja.esders at gmail.com>> wrote:
>>
>>             Hi Steve,
>>
>>             that depends on the separator you use. The following
>>             formats for edge lists are available:
>>
>>             EdgeListCommaOne, EdgeListSpaceOne, EdgeListSpaceZero,
>>             EdgeListTabOne, and EdgeListTabZero.
>>
>>             The succeeding "One" and "Zero" indicate whether the index
>>             of the first node in the file is 1 or 0.
>>
>>             If the above formats don't work for you, there is also the
>>             possibility to use EdgeListReader directly.
>>             be equivalent to readGraph(filepath, Format.EdgeListSpaceOne).
>>
>>             Hope this helps.
>>
>>             Cheers,
>>             Kolja
>>
>>             On 17 April 2015 at 01:41, Steve Koch
>>             <stevekochscience at gmail.com
>>             <mailto:stevekochscience at gmail.com>> wrote:
>>
>>                 Hello, I am wondering what parameter should be sent to
>>                 readGraph in python in order to read an edge list file
>>                 instead of METIS? I gather it should be something like
>>                 Format.??? But am unable to find it by googling. Thank
>>                 you!
>>
>>
>>
>>
>>         _______________________________________________
>>         NetworKit mailing list
>>         NetworKit at ira.uni-karlsruhe.de
>>         <mailto:NetworKit at ira.uni-karlsruhe.de>
>>         https://lists.ira.uni-karlsruhe.de/mailman/listinfo/networkit
>>
>>
>
>
>     _______________________________________________
>     NetworKit mailing list
>     NetworKit at ira.uni-karlsruhe.de <mailto:NetworKit at ira.uni-karlsruhe.de>
>     https://lists.ira.uni-karlsruhe.de/mailman/listinfo/networkit
>
>

--

=======================================================
Karlsruhe Institute of Technology (KIT)
Institute of Theoretical Informatics (ITI)

Juniorprof. Dr. Henning Meyerhenke
Theoret. Informatics / Parallel Computing

Phone: +49-721-608-41876
Web: http://parco.iti.kit.edu/henningm/

KIT - University of the State of Baden-Wuerttemberg and
National Research Center of the Helmholtz Association
=======================================================

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5316 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20150417/d6a8913f/attachment-0001.p7s>
```