The DiGraph constructor checks the data to determine the graph 
characteristics from the data if they are left as defaults, which for 
multiedges is None. In your case you are constructing a graph with vertices 
but no edges for which the constructorsets multiedges to True. (digraph.py 
lines 809-817)   Add `multigraph=False` to the DiGraph constructor 
arguments if you do not want a multi-Digraph:

vertices = [1,2,3,-1,-2,-3]
roots = [[1,-2],[1,-3],[3,2],[1,-1]]
G = DiGraph(dict.fromkeys(vertices,dict()), multiedges=False);G


giving:

Digraph on 6 vertices



On Monday, February 24, 2014 9:41:18 PM UTC, [email protected] wrote:
>
> I want to construct a poset from a digraph, but, for some reason, the 
> digraph thinks it has multiple edges, so sage constructs a poset whose 
> Hasse diagram is a multi-digraph (and this is inconvenient, but a 
> surmountable problem). Any ideas what is causing this? (It's entirely 
> possible this is sensible behavior and I've missed something in the 
> documentation.)
>
> sage: vertices = [1,2,3,-1,-2,-3]
> sage: roots = [[1,-2],[1,-3],[3,2],[1,-1]]
> sage: G = DiGraph(dict.fromkeys(vertices,dict()))
> sage: for v in roots:
>     if v[0]==-v[1]:
>         G.add_edge(v[0],v[1])
>         G.show()
>     else:
>         G.add_edge(v[0],-v[1])
>         G.add_edge(v[1],-v[0])
>         G.show()
> ....:
> sage: G
> Multi-digraph on 6 vertices
> sage: G.edges()
> [(-3, -1, None),
>  (-2, -1, None),
>  (1, -1, None),
>  (1, 2, None),
>  (1, 3, None),
>  (2, -3, None),
>  (3, -2, None)]
> sage: G.has_multiple_edges()
> False
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" 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-support.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to