Here is an example that looks less artificial:
sage: list(set([-1,-2]))
[-2, -1]
sage: list(set([-2,-1]))
[-1, -2]
sage: G=Graph(); G.add_vertex(-2); G.add_vertex(-1)
sage: H=Graph(); H.add_vertex(-1); H.add_vertex(-2)
sage: G == H
True
sage: G.vertices() == H.vertices()
True
sage: list(G.vertex_i
On Tue, 21 Oct 2014 11:11:24 +
Vincent Delecroix <20100.delecr...@gmail.com> wrote:
> > G=Graph()
> > for i in range(0,10): G.add_vertex(randint(1,1000))
> > for x in G.vertex_iterator(): print x
> > G.vertices()
> >
> > gives them in about random order.
>
> Nope. The order is not random. It
> G=Graph()
> for i in range(0,10): G.add_vertex(randint(1,1000))
> for x in G.vertex_iterator(): print x
> G.vertices()
>
> gives them in about random order.
Nope. The order is not random. It is the one you get by doing list(set(X)).
sage: list(set(G.vertices())) == list(G.vertex_iterator())
On Mon, 20 Oct 2014, Erik Massop wrote:
Shortly, do (di)graphs have some kind of order of vertices?
If the vertices happen to have a total ordering everything should be
fine.
OK. Then I can use it on poset, because "labels" for vertices in Hasse
diagram are just natural numbers. But...
On Mon, 20 Oct 2014 20:11:31 +0300 (EEST)
Jori Mantysalo wrote:
> When I hit this, I was making a code for posets, but this is actually more
> general question. Shortly, do (di)graphs have some kind of order of
> vertices?
Sort of. The code seems to assume this in various places, and uses
pyth
Hi,
For these kind of questions, please use sage-support (an other google
groups) or better http://ask.sagemath.org (as it may be useful for
other users).
To create a digraph, you need to use
sage: G = DiGraph({'b': ['a']})
sage: G.edges()
And you have methods G.outgoing_edges() and G.i