#18929: Include igraph library
-------------------------------------+-------------------------------------
Reporter: borassi | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.8
Component: packages: | Resolution:
optional | Merged in:
Keywords: igraph library | Reviewers: Nathann Cohen
Authors: Michele Borassi | Work issues:
Report Upstream: N/A | Commit:
Branch: | fc693a955362964e4c7bb73c75b74c65e7dbebef
u/borassi/include_igraph_library | Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by dcoudert):
My first trial was with the source code from [1] and [2].
One difficulty is that [2] gives `python-igraph...` and not
`python_igraph...`
Now I'm trying with [4] and it's working... but then it says that igraph
is not installed.
So I'm running `./sage -i igraph` using the source code from [3] (should
work also with [1]).
The point is that before installing igraph, I installed this patch and
performed the following test:
{{{
sage: G = graphs.PetersenGraph()
sage: G.igraph_graph()
---------------------------------------------------------------------------
ImportError Traceback (most recent call
last)
<ipython-input-2-07a5568607db> in <module>()
----> 1 G.igraph_graph()
/Users/dcoudert/sage/local/lib/python2.7/site-
packages/sage/graphs/generic_graph.pyc in igraph_graph(self, vertex_attrs,
edge_attrs)
1432 raise ImportError("The package igraph is not
available. To " +
1433 "install it, run Sage with option -i
" +
-> 1434 "python_igraph.")
1435
1436 v_to_int = {v:i for i,v in enumerate(self.vertices())}
ImportError: The package igraph is not available. To install it, run Sage
with option -i python_igraph.
sage:
}}}
I don't know if the installation of `python_igraph` is expected to install
`igraph` as well or not. If not, then the error message should be
improved.
Now that it is working, I did
{{{
sage: G = graphs.PetersenGraph()
sage: H = G.igraph_graph()
sage: H.<TAB>
}}}
and got access to the list of methods.
It is surprizing to see that we have both graph algorithms and graph
generators (e.g. `Barabasi`, `Erdos_Renyi`, etc.), but I assume there is
nothing you can do to avoid that. Not a big deal.
Also, some methods for digraphs (e.g., `all_st_mincuts`) are accessible
from undirected graphs and so an error is raised, but again I assume there
is nothing we can do about it.
{{{
sage: H.is_directed()
False
sage: H.all_st_mincuts(0,2)
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call
last)
<ipython-input-22-8251331c5c90> in <module>()
----> 1 H.all_st_mincuts(Integer(0),Integer(2))
/Users/dcoudert/sage/local/lib/python2.7/site-
packages/python_igraph-0.7.0-py2.7-macosx-10.9-x86_64.egg/igraph/__init__.pyc
in all_st_mincuts(self, source, target, capacity)
390 graphs. Algorithmica 15, 351--372, 1996.
391 """
--> 392 value, cuts, parts = GraphBase.all_st_mincuts(self,
source, target, capacity)
393 return [Cut(self, value, cut=cut, partition=part)
394 for cut, part in izip(cuts, parts)]
NotImplementedError: Error at st-cuts.c:1320: S-t cuts can only be listed
in directed graphs, Unimplemented function call
}}}
Anyway, its working.
I will now try to understand the point of disagreement between you and
Nathann.
David.
--
Ticket URL: <http://trac.sagemath.org/ticket/18929#comment:30>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.