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

Steve Koch stevekochscience at gmail.com
Fri Apr 17 18:03:37 CEST 2015

```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> 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.:
> 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> 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
>>
>>  Hope this helps.
>>
>>  Cheers,
>> Kolja
>>
>> On 17 April 2015 at 02:17, Kolja Es <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
>>>
>>>  Hope this helps.
>>>
>>>  Cheers,
>>> Kolja
>>>
>>> On 17 April 2015 at 01:41, Steve Koch <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
>> https://lists.ira.uni-karlsruhe.de/mailman/listinfo/networkit
>>
>>
>
>
> _______________________________________________
> NetworKit mailing list
> NetworKit at ira.uni-karlsruhe.de
> https://lists.ira.uni-karlsruhe.de/mailman/listinfo/networkit
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20150417/0a8efd4e/attachment.html>
```