[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Graph Equality in Python
From: |
Gábor Csárdi |
Subject: |
Re: [igraph] Graph Equality in Python |
Date: |
Sun, 14 Dec 2014 09:50:42 -0500 |
Hi,
you can query the list of edges, sort them (in case they are returned
unsorted), and then just compare the sorted list.
Gabor
On Sun, Dec 14, 2014 at 8:54 AM, Robin Müller-Bady
<address@hidden> wrote:
> Dear all,
>
> I'm currently looking for a method in the igraph Python implementation that
> provides checking for graph equality of two graph, e.g. something like
>
>>>> g1 = Graph(3, directed=False)
>>>> g1.add_edges([(0,1), (1,2)])
>>>> g2 = Graph(3, directed=False)
>>>> g2.add_edges([(1,2), (0,1)])
>>>> g1.equals(g2)
> True
>
> I know that there is a "g1.isomorphic(g2)" function, but isomorphism is not
> necessarily equality, e.g.:
>>>> g3 = Graph(3, directed=False)
>>>> g3.add_edges([(0,1), (0,2)])
>>>> g3.equals(g2)
> False
>>>> g3.isomorphic(g2)
> True
>
> Is there anything like that?
> I'm (more or less) new to python, in case I was missing something I am very
> sorry in advance.
>
> Best regards,
>
> Robin
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help