Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graph_editor(p) should work for p a poset #8016

Open
rlmill mannequin opened this issue Jan 20, 2010 · 3 comments
Open

graph_editor(p) should work for p a poset #8016

rlmill mannequin opened this issue Jan 20, 2010 · 3 comments

Comments

@rlmill
Copy link
Mannequin

rlmill mannequin commented Jan 20, 2010

Obviously graph_editor(p) doesn't work on its own, since p is not a graph. However, it should be possible to implement a few functions for p to make this work:

File "sage/graphs/graph_editor.py", line 111, in graph_editor
    if not isinstance(graph.get_pos(), dict):
AttributeError: 'FinitePoset' object has no attribute 'get_pos'

While wishing, it would also be nice if the graph editor could be adapted to remember vertex labels, at least in the case that the labels are strings.

Depends on #30540

CC: @saliola @rkirov @qed777

Component: combinatorics

Issue created by migration from https://trac.sagemath.org/ticket/8016

@jm58660
Copy link
Mannequin

jm58660 mannequin commented Oct 21, 2015

comment:1

If the name of variable to save the (undirected) graph is P, then it is easy to just say

d = DiGraph()
d.add_vertices(P.vertices())
pos = P.get_pos()
for e in P.edges(labels=False):
    if pos[e[0]][1] < pos[e[1]][1]:
        d.add_edge(e)
    else:
        d.add_edge([e[1], e[0]])
P = Poset(d).canonical_label()

to convert it to poset. But really somebody should expand the code to handle digraphs.

@slel
Copy link
Member

slel commented Oct 11, 2020

comment:2

Somewhat related:

@slel
Copy link
Member

slel commented Oct 11, 2020

Dependencies: #30540

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant