'Graph' object has no attribute 'remove_edge'

1,106 views
Skip to first unread message

nikezeus

unread,
Oct 31, 2009, 10:22:57 PM10/31/09
to networkx-discuss
hello every body;

I run this command;
g.remove_edge(3,4)
and I get this error
AttributeError: 'Graph' object has no attribute 'remove_edge'

how to fix this problem and similars?

Aric Hagberg

unread,
Nov 1, 2009, 7:59:45 AM11/1/09
to networkx...@googlegroups.com

You have an older version of NetworkX which uses the name "delete_edge()"
instead. So you can either use that or upgrade to a newer version from
http://networkx.lanl.gov

Aric

franck kalala

unread,
Nov 1, 2009, 2:20:20 PM11/1/09
to networkx...@googlegroups.com
Thanks Aric,

I run this code

*************************************************************************************
# -*- coding: utf-8 -*-
#!/usr/bin/env python
"""
Create an G{n,m} random graph with n nodes and m edges
and report some properties.

This graph is sometimes called the Erdős-Rényi graph
but is different from G{n,p} or binomial_graph which is also
sometimes called the Erdős-Rényi graph.
"""
__author__ = """Aric Hagberg (hag...@lanl.gov)"""
__credits__ = """"""
#    Copyright (C) 2004-2006 by
#    Aric Hagberg <hag...@lanl.gov>
#    Dan Schult <dsc...@colgate.edu>
#    Pieter Swart <sw...@lanl.gov>
#    Distributed under the terms of the GNU Lesser General Public License
#    http://www.gnu.org/copyleft/lesser.html

from networkx import *
import sys

n=10 # 10 nodes
m=20 # 20 edges

G=gnm_random_graph(n,m)

# some properties
print "node degree clustering"
for v in nodes(G):
    print v,degree(G,v),clustering(G,v)

# print the adjacency list to terminal
write_adjlist(G,sys.stdout)
**************************************************************************************
it working but with the following warning message:
/usr/lib/pymodules/python2.6/matplotlib/numerix/__init__.py:18: DeprecationWarning:
**********************************************************
matplotlib.numerix and all its subpackages are deprecated.
They will be removed soon.  Please use numpy instead.
**********************************************************

  warnings.warn(msg, DeprecationWarning)
/usr/lib/pymodules/python2.6/networkx/generators/hybrid.py:16: DeprecationWarning: the sets module is deprecated
  import sets
****************************************************************************************
how to fix this problem?

Franck

Reply all
Reply to author
Forward
0 new messages