Reputation: 679
First, thanks for taking the time to read and respond.
Second, the question:
I am trying to form a weighted undirected graph from my symmetric adjacency matrix, A
, where the ij-th element is the edge weight between nodes i and j:
import igraph as ig
g = ig.Graph.Weighted_Adjacency(A, attr="weight", loops=False, mode=ADJ_MAX)
I get this a name error right off the bat:
NameError: name 'ADJ_MAX' is not defined
Now, I can convert my directed graph to an undirected one by:
g = ig.Graph.Weighted_Adjacency(A, attr="weight", loops=False)
g.to_undirected()
but I am wondering what the problem is.
Upvotes: 0
Views: 409
Reputation: 48071
Use ig.ADJ_MAX
instead of ADJ_MAX
. ADJ_MAX
is defined in the namespace of the igraph
module.
Alternatively, you could type from igraph import ADJ_MAX
, which pulls the ADJ_MAX
constant into your local namespace, and then you can use it without the qualification.
Upvotes: 1