Tiago de Paula Peixoto | 5 Oct 2009 17:45
Picon
Gravatar

[announcement] New version from graph-tool

I'm happy to announce version 2.0.0 from graph-tool!

What is new?
============

Python module
-------------

It is the first stable release since years ago, and marks a full
transition of graph-tool from a stand-alone program to a full python
module. It is pointless to summarize all the differences, since
everything changed. The new version is, for me, a lot more comfortable
to work with, and the internals are a lot cleaner. Everything
integrates nicely with scipy/numpy, and I hope graph-tool will be a
nice addition to this framework.

More algorithms
----------------

The number of algorithms has increased significantly. Now there is
support for maximum flow, pagerank, motifs, isomorphism, and many
more. Most algorithms in the Boost Graph Library are now available in
graph-tool.

Documentation
-------------

This version includes full documentation, with code examples,
available online and from the docstrings. The documentation has 100%
coverage of every function and data structure.
(Continue reading)

Claudio Martella | 5 Oct 2009 19:03
Picon
Gravatar

Re: [announcement] New version from graph-tool

This sounds like a great news, i wasn't expecting this news so early.
Just one question: i see that most of the most important algorithms
(at least for me) are already there. What about shortest paths
(Dijkstra and Floyd-Warshall i.e.)?
Is it missing in the doc or you plan them for the future?

Congratulations again for your great work.

Claudio

On Mon, Oct 5, 2009 at 5:45 PM, Tiago de Paula Peixoto <tiago <at> forked.de> wrote:
> I'm happy to announce version 2.0.0 from graph-tool!
>
> What is new?
> ============
>
> Python module
> -------------
>
> It is the first stable release since years ago, and marks a full
> transition of graph-tool from a stand-alone program to a full python
> module. It is pointless to summarize all the differences, since
> everything changed. The new version is, for me, a lot more comfortable
> to work with, and the internals are a lot cleaner. Everything
> integrates nicely with scipy/numpy, and I hope graph-tool will be a
> nice addition to this framework.
>
> More algorithms
> ----------------
>
(Continue reading)

Tiago de Paula Peixoto | 5 Oct 2009 19:35
Picon
Gravatar

Re: [announcement] New version from graph-tool

Hi Claudio

Claudio Martella wrote:
> This sounds like a great news, i wasn't expecting this news so early.
> Just one question: i see that most of the most important algorithms
> (at least for me) are already there. What about shortest paths
> (Dijkstra and Floyd-Warshall i.e.)?
> Is it missing in the doc or you plan them for the future?

Shortest paths is still not there, since I wanted to make it
configurable, with the "visitor" approach from the BGL reflected in
graph-tool. But I decided to make a release without it, otherwise I
will keep indefinitely including things.  It is definitely on the
list.

> Congratulations again for your great work.

Thanks!

Cheers,
Tiago

_______________________________________________
graph-tool mailing list
graph-tool <at> forked.de
http://lists.forked.de/mailman/listinfo/graph-tool
Alexandre Hannud Abdo | 5 Oct 2009 22:49
Picon
Gravatar

Re: [announcement] New version from graph-tool

Ni!

:D Great news!

Congratulations, I've been using the devel version for a while and
working with the python module is a joy.

Having now full docstring documentation and examples therein makes
graph-tool very easy to learn. :)

ale
~~

On Mon, 2009-10-05 at 17:45 +0200, Tiago de Paula Peixoto wrote:
> I'm happy to announce version 2.0.0 from graph-tool!
> 
> What is new?
> ============
> 
> Python module
> -------------
> 
> It is the first stable release since years ago, and marks a full
> transition of graph-tool from a stand-alone program to a full python
> module. It is pointless to summarize all the differences, since
> everything changed. The new version is, for me, a lot more comfortable
> to work with, and the internals are a lot cleaner. Everything
> integrates nicely with scipy/numpy, and I hope graph-tool will be a
> nice addition to this framework.
> 
(Continue reading)

Claudio Martella | 6 Oct 2009 16:49
Picon
Gravatar

Re: [announcement] New version from graph-tool

On Mon, Oct 5, 2009 at 7:35 PM, Tiago de Paula Peixoto <tiago <at> forked.de> wrote:
> Hi Claudio
>
> Claudio Martella wrote:
>> This sounds like a great news, i wasn't expecting this news so early.
>> Just one question: i see that most of the most important algorithms
>> (at least for me) are already there. What about shortest paths
>> (Dijkstra and Floyd-Warshall i.e.)?
>> Is it missing in the doc or you plan them for the future?
>
> Shortest paths is still not there, since I wanted to make it
> configurable, with the "visitor" approach from the BGL reflected in
> graph-tool. But I decided to make a release without it, otherwise I
> will keep indefinitely including things.  It is definitely on the
> list.

I perfectly understand your decision. I have a question on this issue.
I see that the distance_histogram basically calculates all-pairs
shortest paths (ASSP) as it returns all the shortest distances. So
some sort of ASSP is already implemented. Is it possible to access it
already? Do you have any workaround suggestion for me?

>> Congratulations again for your great work.
>
> Thanks!
>
> Cheers,
> Tiago
>
>
(Continue reading)

Tiago de Paula Peixoto | 7 Oct 2009 13:24
Picon
Gravatar

Re: [announcement] New version from graph-tool

Claudio Martella wrote:
> I perfectly understand your decision. I have a question on this issue.
> I see that the distance_histogram basically calculates all-pairs
> shortest paths (ASSP) as it returns all the shortest distances. So
> some sort of ASSP is already implemented. Is it possible to access it
> already? Do you have any workaround suggestion for me?

The distance_histogram() function uses BFS/Dijkstra internally in C++, but
unfortunately this is not exposed yet in the python interface. If you want to
calculate ASSP now with graph-tool you have basically two options:

1 - Do it in python. This is relatively simple, if you want to do it
    naively:

    def dist_from_source(g, source):
        dist = g.new_vertex_property("int")
        dist.a = -1
        dist[source] = 0
        queue = [source]
        while len(queue) > 0:
            v = queue[0]
            del queue[0]
            for w in v.out_neighbours():
                if dist[w] == -1:
                    dist[w] = dist[v] + 1
                    queue.append(w)
        return dist

    If edges are weighted, you can use a priority queue instead.

(Continue reading)

Juan Manuel Tirado | 7 Oct 2009 15:44
Picon

local_clustering returned array

I have the following code

g=load_graph("graph.xml")
clust=local_clustering(g)

for i in clust.get_array():
     print i


This code returns something like
0.0
0.333333
1.5
....etc

What I would like to do is to print the vertex identifier that corresponds to every clustering coefficient. The output to get is something like:

edge1 0.0
edge2 0.33333
edge3 1.5
.....etc.

I suppose that this is really simple, but I'm newbie at python I do not get how to do it. I appreciate your help and comments.

Juan

_______________________________________________
graph-tool mailing list
graph-tool <at> forked.de
http://lists.forked.de/mailman/listinfo/graph-tool
Tiago de Paula Peixoto | 7 Oct 2009 19:06
Picon
Gravatar

Re: local_clustering returned array

Hi Juan,

Juan Manuel Tirado wrote:
> What I would like to do is to print the vertex identifier that corresponds
> to every clustering coefficient. The output to get is something like:
>
> edge1 0.0
> edge2 0.33333
> edge3 1.5
> .....etc.
>
> I suppose that this is really simple, but I'm newbie at python I do not get
> how to do it. I appreciate your help and comments.

This is indeed simple. All you have to do is iterate through the graph.
(I assume you mean "vertex" instead of "edge" above).

    for v in g.vertices():
        print int(v), clust[v]

This will print something line:

0 0.0
1 0.33333
2 1.5
...

Note also that the values of clust.get_array() are such that the i-th
value corresponds to the i-th vertex, where i is the vertex index.

Did I understand you question correctly?

Cheers,
Tiago

_______________________________________________
graph-tool mailing list
graph-tool <at> forked.de
http://lists.forked.de/mailman/listinfo/graph-tool
Juan Manuel Tirado | 7 Oct 2009 21:47
Picon

Re: local_clustering returned array

Thanks for the answer. Yes, this solves my "problem". As you can suppose, I'm a newbie at Python.

Thank you so much.

Juan


Hi Juan,

Juan Manuel Tirado wrote:
> What I would like to do is to print the vertex identifier that corresponds
> to every clustering coefficient. The output to get is something like:
>
> edge1 0.0
> edge2 0.33333
> edge3 1.5
> .....etc.
>
> I suppose that this is really simple, but I'm newbie at python I do not get
> how to do it. I appreciate your help and comments.

This is indeed simple. All you have to do is iterate through the graph.
(I assume you mean "vertex" instead of "edge" above).

   for v in g.vertices():
       print int(v), clust[v]

This will print something line:

0 0.0
1 0.33333
2 1.5
...

Note also that the values of clust.get_array() are such that the i-th
value corresponds to the i-th vertex, where i is the vertex index.

Did I understand you question correctly?

Cheers,
Tiago


_______________________________________________
graph-tool mailing list
graph-tool <at> forked.de
http://lists.forked.de/mailman/listinfo/graph-tool


_______________________________________________
graph-tool mailing list
graph-tool <at> forked.de
http://lists.forked.de/mailman/listinfo/graph-tool
Juan Manuel Tirado | 9 Oct 2009 16:01
Picon

Vertex label reordering

Hi everyone,

   I've been working around with graph-tool and I have found a strange behaviour.

   A have this input .dot file

graph G {
0 ;
10 ;
200 ;
1000 ;
0--200 ;
10--200 ;
1000--200 ;
1000--10 ;
}

I load the graph in graph_tool using g=load_graph("example.dot") and everything is OK. Now I want to know the output_degree of the node with identifier 200 (index 2). I use:

g.vertex(2).out_degree() that returns 2

Obviously vertex with identifier 200 (index 2) must return 3.

I have executed g.save("graphtool_dump.dot") with the following output:
graph G {
0;
10;
1000;
200;
0--200 ;
10--200 ;
1000--200 ;
1000--10 ;
}

The nodes have been reordered (probably following alphabetic order) and now the vertex with identifier "200" is in position 3 instead of 2. This behaviour can be very annoying in some cases, and can lead to confusion. Does exist any way to avoid this reordering? 

Thanks in advance,

Juan


_______________________________________________
graph-tool mailing list
graph-tool <at> forked.de
http://lists.forked.de/mailman/listinfo/graph-tool

Gmane