assortativity in python interface

Asked by h0cked

I can't find the assortativity measurements in the python interface... did I miss something?
In R, there is one (assortativity.degree)... the interface doesn't exist in the python version?

I'm using the trunk version (0.6-main).

Also, when I try to build the python api document, it's not complete... THANKS! And I can't find anywhere there is a api document for 0.6 online...

Thanks,

Question information

Language:
English Edit question
Status:
Answered
For:
igraph Edit question
Assignee:
Tamás Nepusz Edit question
Last query:
Last reply:
Revision history for this message
Tamás Nepusz (ntamas) said :
#1

The assortativity measures are there; look for Graph.assortativity(), Graph.assortativity_degree() and Graph.assortativity_nominal().

Re the API documentation: I'll check it during the weekend and let you know.

Revision history for this message
h0cked (timobj) said :
#2

Great! Thanks!

Revision history for this message
Tamás Nepusz (ntamas) said :
#3

Checked the build script for the documentation in the 0.6 release and it works for me perfectly fine. Is there any specific error message you get when running scripts/mkdoc.sh in the folder for the Python interface?

Note that the API docs for the 0.6 release are not online yet because 0.6 itself is still being developed.

Revision history for this message
h0cked (timobj) said :
#4

No, I didn't get any error message, except a warning:
Warning: Module igraph.summary is shadowed by a variable with the same name.
which I assume is not a big deal...

And it did generate some of the api docs, but it doesn't seem to be not complete.
I only get the following, and the two I really need are the api docs for igraph.Graph and igraph.GraphBase.

Thanks!

Everything
All Classes
igraph.app.shell.ClassicPythonShell
igraph.app.shell.ConsoleProgressBarMixin
igraph.app.shell.IDLEShell
igraph.app.shell.IPythonShell
igraph.app.shell.ProgressBar
igraph.app.shell.Shell
igraph.app.shell.TerminalController
igraph.statistics.Histogram
igraph.statistics.RunningMean
All Functions
igraph.app.shell.main
igraph.statistics.mean
igraph.statistics.median
igraph.statistics.percentile
igraph.statistics.power_law_fit
igraph.statistics.quantile
All Variables
igraph.app.__package__
igraph.app.shell.__package__
script-igraph.__package__

Revision history for this message
Tamás Nepusz (ntamas) said :
#5

Yes, the warnings can safely be ignored for the time being. It's weird why you are not getting any API docs for the remaining packages and classes as it works fine for me. I have now pushed an improved version of scripts/mkdoc.sh to the Bazaar repository. Can you please try the following?

1. After having built the package with "python setup.py build", make a symlink of build/lib.*/igraph/_igraph.so to igraph/_igraph.so (where all paths are relative to the dir where setup.py is)

2. Re-run scripts/mkdoc.sh

If this does not resolve your issue, please report the version number of epydoc you are using. I have 3.0.1 and it seems to work.

Revision history for this message
h0cked (timobj) said :
#6

Sorry, probably I didn't clarify my platform.
I'm on Mac OS X 10.7 Lion, all the dependencies are installed through fink. The version number of epydoc-py27 in fink is 3.0.1-4. And I built the igraph lib using:

./bootstrap
CFLAGS=-I/sw/include LDFLAGS=-L/sw/lib ./configure
./boostrap
make
sudo make install

then build the python package

cd interfaces/python
python setup.py build

which are all successful.

Then I followed your instruction did:

ln -s build/lib.macosx-10.7-x86_64-2.7/igraph/_igraph.so igraph/_igraph.so
cd scripts
./mkdocs

Now I am getting a couple errors:
1) readlink: illegal option -- m,
I changed -m to -f, which gives me the right folder path "/Users/jbian/dev/igraph/interfaces/python/doc/api"

2) I am getting numerous error messages like the following:
In /Users/jbian/dev/igraph/interfaces/python/igraph/__init__.py:
| Import failed (but source code parsing was successful).
| Error: ImportError: No module named _igraph (line 34)

3) Eventually, it failed at
UNEXPECTED ERROR:
'Text' object has no attribute 'data'

So, I turned on --debug in epydoc, and it gives me this:
Traceback (most recent call last): Progress: 00:04
  File "/sw/bin/epydoc", line 13, in <module>=========================================================================================--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------]
    cli() Parsing docstrings: igraph.drawing.text
  File "/sw/lib/python2.7/site-packages/epydoc/cli.py", line 965, in cli
    main(options, names)
  File "/sw/lib/python2.7/site-packages/epydoc/cli.py", line 757, in main
    exclude_parse=exclude_parse)
  File "/sw/lib/python2.7/site-packages/epydoc/docbuilder.py", line 275, in build_doc_index
    parse_docstring(val_doc, docindex, suppress_warnings)
  File "/sw/lib/python2.7/site-packages/epydoc/docstringparser.py", line 265, in parse_docstring
    api_doc.summary, api_doc.other_docs = api_doc.descr.summary()
  File "/sw/lib/python2.7/site-packages/epydoc/markup/restructuredtext.py", line 179, in summary
    try: self._document.walk(visitor)
  File "/sw/lib/python2.7/site-packages/docutils/nodes.py", line 137, in walk
    if child.walk(visitor):
  File "/sw/lib/python2.7/site-packages/docutils/nodes.py", line 129, in walk
    visitor.dispatch_visit(self)
  File "/sw/lib/python2.7/site-packages/docutils/nodes.py", line 1604, in dispatch_visit
    return method(node)
  File "/sw/lib/python2.7/site-packages/epydoc/markup/restructuredtext.py", line 307, in visit_paragraph
    m = self._SUMMARY_RE.match(child.data)
AttributeError: 'Text' object has no attribute 'data'

Thanks!

Revision history for this message
Tamás Nepusz (ntamas) said :
#7

Indeed, I'm getting the same exception on Mac OS X. I'll convert this to a bug report.

Revision history for this message
Tamás Nepusz (ntamas) said :
#8

Monkey-patched docutils on-the-fly to make things work on Mac OS X. See the following commit:

http://bazaar.launchpad.net/~igraph/igraph/0.6-main/revision/2627

The bottom line is that you should update the source tree and use the new scripts/mkdoc.sh -- hopefully this will make things work.

Can you help with this problem?

Provide an answer of your own, or ask h0cked for more information if necessary.

To post a message you must log in.