[Networkit] How to read an edge list file?

Steve Koch stevekochscience at gmail.com
Fri Apr 17 17:14:01 CEST 2015


Thank you, this is exactly what I needed. I also realized I could have
answered the question by looking at the graphio.py source code (which
doesn't get crawled by Google).

For the particular file I have, the nodes start at 8 and are not
consecutive.  I was able to read the graph successfully with:

reader = graphio.EdgeListReader('\t', 8, continuous=False)
G = reader.read("myfile.txt")

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?

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 to
> use EdgeListReader directly.
> Here graphio.EdgeListReader(' ', 1).read(filepath) would be equivalent to readGraph(filepath,
> Format.EdgeListSpaceOne).
>
> 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 to
>> use EdgeListReader directly.
>> Here graphio.EdgeListReader(' ', 1).read(filepath) would 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> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20150417/2470d1df/attachment.html>


More information about the NetworKit mailing list