igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] igraph - pyhton interface <<error while using Read_Adjacenc


From: Tamas Nepusz
Subject: Re: [igraph] igraph - pyhton interface <<error while using Read_Adjacency method in Graph>>
Date: Sat, 8 Nov 2008 18:27:42 +0000

Hi Shrijeet,

import igraph
newgraph = igraph.Graph()
f="adjmat.txt"
newgraph.Read_Adjacency(f,"edge")
Read_Adjacency is a static method of the Graph object, therefore you shouldn't call it on a Graph instance that you constructed in the second line. If you want to create a graph from an adjacency matrix stored in a file, you should do it as follows:

from igraph import *
g = Graph.Read_Adjacency("adjmat.txt")

It is even easier using the load() function:

from igraph import *
g = load("adjmat.txt", format="adjacency")

This works with igraph 0.5.1, so in case you are still getting error messages, please check the version number of your igraph installation:

import igraph
print igraph.__version__

--
Tamas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]