#15875: Add is_subposet
-------------------------------------+-------------------------------------
Reporter: csar | Owner:
Type: enhancement | Status: new
Priority: minor | Milestone: sage-6.4
Component: combinatorics | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/csar/ticket/15875 | 7ecc981596c8b9b1cc90fe444a81bfe2bc80b4d6
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by ncohen):
Replying to [comment:14 jmantysalo]:
> Would implementing `P.is_subposet(Q)` as
`P.hasse_diagram().is_subgraph(Q.hasse_diagram().transitive_closure())` be
too slow?
"depends". It means a copy of Q's graph even if `P` is only one vertex. In
other cases it will be optimal.
> I am not sure if I can make faster version by manually calling digraph
functions in a loop. But of course it is much faster to get `False` if
some element of `P` is not an element of `Q` at all by first checking for
that. But will `transitive_closure())` eat memory?
It will eat some memory indeed, but it will be freed then. Ideally, we
would need a dense representation for Q's transitive closure and a sparse
representation of P. We can iterate over all edges of `P`, and check every
time that it is an edge of Q's transitive closure.
The most costly part of it will probably be the vertex labelling.
Nathann
--
Ticket URL: <http://trac.sagemath.org/ticket/15875#comment:15>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" 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-trac.
For more options, visit https://groups.google.com/d/optout.