Looking for a graph (as in network, nodes) package

J

John Henry

I am looking for a ready made simple graph package. I found an
extensive one in the piana package but when I try to use just the
graph portion, it fails to load because of the line:

class Graph(object):
...

It seems that their Graph is subclassed from "object" but I couldn't
find a "object" class anywhere. So, I abandoned using that one.

Before I reinvent the wheel and start writing one myself, can somebody
point me to a ready made one? I am afraid Googling "Python Graph"
wouldn't be much help (millions and trillions of hits).

Thanks,
 
J

John Machin

John said:
I am looking for a ready made simple graph package. I found an
extensive one in the piana package but when I try to use just the
graph portion, it fails to load because of the line:

class Graph(object):

"fails to load" is insufficient information. Please provide the
traceback and the actual error message.

What version of Python are you using? That line should be OK from
Python 2.2 onwards.
...

It seems that their Graph is subclassed from "object" but I couldn't
find a "object" class anywhere. So, I abandoned using that one.

object is built-in to Python. It is the uber-class from which new-style
classes inherit.
New-style classes were introduced in Python 2.2

class Foo(object): # new-style class

class Bar: # old-style class
 
J

John Henry

Learn something new everyday.

Okay, when I run a test program:

import Graph

graph = Graph("1")


I got:

Traceback (most recent call last):
File "E:\test\Graph\test_graph.py", line 3, in ?
graph = Graph("1")
TypeError: 'module' object is not callable


Oh, wait....silly me. Should have been:

from Graph import Graph

<bonk, bonk, bonk>

Must be a Sunday.

Thanks,



E:\test\Graph>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top