Reputation: 3
I am on Windows 10 and managed to download the python-igraph package with no problem. I put it under the folder of site-packages in anaconda under the name igraph. I then tried to import an edgelist but it returned with the error of module igraph has no attribute Read.Edgelist. The code is below:
%matplotlib inline
import matplotlib.pyplot as plt
from random import uniform, seed
import numpy as np
import time
from igraph import *
g = Graph.Read_Edgelist("C:/facebook_combined.txt")
I'm using this guy's code from this blog here: https://hautahi.com/im_greedycelf. Is it possible that igraph is no longer able to read external files? I'm very confused.
Even trying to create a simple graph also yielded an error message:
import igraph
g = Graph.Tree(127, 2)
summary(g)
Error: name 'Graph' is not defined
Am I doing something wrong? If so, can someone put a link to the required libraries I have to download and tell me which folder to put it under? I'm not really sure how the installers they mentioned on here: https://pypi.org/project/python-igraph/ work.
Upvotes: 0
Views: 343
Reputation: 5757
Your first snippet didn't work because Read_Edgelist
is an instance method.
So you need to create an object first and then call the Read_Edgelist
function on that.
For example
g = Graph()
g.Read_Edgelist("C:/facebook_combined.txt")
Your second snippet didn't work because your import statement is import igraph
Then you must use
g = igraph.Graph.Tree(127,2(
summary(g)
Hope that helps!
Upvotes: 1