[Networkit] How to read in a large graph (and output a sparse matrix)

Elisabetta Bergamini elisabetta.bergamini at kit.edu
Mon Aug 1 10:19:46 CEST 2016

Hi Raphael,

Have you tried the following?

G = networkit.readGraph("dgraph.edgelist", networkit.Format.EdgeListSpaceOne)

Also, notice that EdgeListSpaceOne assumes the index of the first node in your edge list is 1 and that the node IDs are contiguous (and that your graph is undirected). Is that the case? If not, you should use a different format.
If you have more questions, feel free to ask.


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

Elisabetta Bergamini
Theoret. Informatics / Parallel Computing

Phone: +49-721-608-41821
Web: http://parco.iti.kit.edu/bergamini

KIT - The Research University in the Helmholtz Association

On Aug 1, 2016, at 10:05, Raphael C <drraph at gmail.com> wrote:

> This is my first attempt to use networkit.
> I have a simple edge list text file of size
> 1.2GB. It was 62500000 edges and about half that many vertices. Each
> line looks like
>     287111206 357850135
> I would like to read in the graph and output a sparse adjacency
> matrix.
> I am using python and have networkit 4.1.1 which seems to be the
> latest version available through pip.
> I tried to find the right function in the docs. I have attempted.
> G = networkit.readGraph("dgraph.edgelist", fileformat = "EdgeListSpaceOne")
> G = networkit.readGraph("dgraph.edgelist", Format.EdgeList)
> But both return error messages.  In fact the latter returns
> NameError: name 'Format' is not defined
> How do you read in a graph?
> Raphael
> _______________________________________________
> 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: <http://lists.ira.uni-karlsruhe.de/pipermail/networkit/attachments/20160801/d34ad970/attachment.html>

More information about the NetworKit mailing list