Graph Input control for interacts

5 views
Skip to first unread message

Rob Beezer

unread,
Mar 28, 2010, 7:02:14 PM3/28/10
to sage-devel
Kevin Clark and Rado Kirov have been advancing the graph editor lately
[1], [2]. Long-term I would love to see an interact control built on
their work. In an interact one could mouse-around building a graph
and watch various properties react. In the past I've built two
standalone applications to do this and it can be a very powerful tool
for certain types of investigations in graph theory. So I'm after the
following mythical capability:

@interact
def experiment(G=graph_input(200,300)):
L = G.line_graph()
print "G: ", G.eigenvalues()
print "L(G): ", L.eigenvalues()
plot(L)

So rather than begging for somebody else to tackle this, I tore into
it last night, totally unprepared. I can
(1) make a new control in sagenb/notebook/interact.py
(2) it "works" in an interact setup, though does not display on the
"canvas" (rather just before it)
(3) and the rest of the interact functions properly.
(4) I can locate the graph information (adjacencies, positions) in the
graph editor, and get them to display in an alert box

What I can't do is get information about the changed graph reflected
in the interact output, either on changes in the graph, or changes in
other interact controls. I don't know if the graph editor needs to be
modified to be a "control" or if I just don't know how to burrow into
it properly to get what I want. I think it is the control's
value_js and/or _adaptor methods that I don't know how to
implement (or which need support in the editor).

There needs to be some configurable way to say *when* the graph has
changed (edge/vertex deletion/creation, with or without vertex-
location rearrangement). In other words, when filling out an input
box, hitting enter/return says the input is complete, so the graph
editor needs to do something similar, I imagine.

So now I am admitting I'm stuck and am reduced to begging. ;-)
Anybody with the right tools, knowledge, and/or experience motivated
to make this happen? I'd love to collaborate, test, review, write
docstrings, etc, etc. to get this done.

Thanks,
Rob

[1] http://groups.google.com/group/sage-devel/browse_thread/thread/c262901cfafd3f45
[2] http://trac.sagemath.org/sage_trac/ticket/8222

Rado

unread,
Mar 28, 2010, 8:45:19 PM3/28/10
to sage-devel
That would be cool and not too hard to do. I can promise to write all
the functions needed at the JS graph_editor side. However, I am still
kinda clueless on the sage interact side.

It would be nice if there was something like "developer's guide to
interacts", explaining the logic behind interacts and the minimum code
to get a new interact (with any random JS) into Sage. Considering this
is the second request for interact extensions (there was the sage
bounty), seems to be quite a desirable direction to go. Also the small
matrix editor I posted a few days ago, could be wrapped as matrix
interact.

Rado

> [1]http://groups.google.com/group/sage-devel/browse_thread/thread/c26290...
> [2]http://trac.sagemath.org/sage_trac/ticket/8222

William Stein

unread,
Mar 30, 2010, 2:53:46 AM3/30/10
to sage-...@googlegroups.com
On Sun, Mar 28, 2010 at 5:45 PM, Rado <rki...@gmail.com> wrote:
> That would be cool and not too hard to do. I can promise to write all
> the functions needed at the JS graph_editor side. However, I am still
> kinda clueless on the sage interact side.

If you write the Javascript side, then I can do the interact side.

>
> It would be nice if there was something like "developer's guide to
> interacts", explaining the logic behind interacts and the minimum code
> to get a new interact (with any random JS) into Sage. Considering this
> is the second request for interact extensions (there was the sage
> bounty), seems to be quite a desirable direction to go. Also the small
> matrix editor I posted a few days ago, could be wrapped as matrix
> interact.

I think you basically have to follow what is done by any other
interact control in the file
interact.py, which is part of the Sage notebook code.

> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to sage-devel+...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>
> To unsubscribe from this group, send email to sage-devel+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
>

--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

Rob Beezer

unread,
Mar 30, 2010, 10:56:31 AM3/30/10
to sage-devel
On Mar 29, 11:53 pm, William Stein <wst...@gmail.com> wrote:
> On Sun, Mar 28, 2010 at 5:45 PM, Rado <rki...@gmail.com> wrote:
> > That would be cool and not too hard to do. I can promise to write all
> > the functions needed at the JS graph_editor side. However, I am still
> > kinda clueless on the sage interact side.
>
> If you write the Javascript side, then I can do the interact side.

Thanks, Rado and William! I've created a ticket, and will try to post
soon about my (limited) progress and what I think this needs on the
Javascript side.

http://trac.sagemath.org/sage_trac/ticket/8631

Rob

Reply all
Reply to author
Forward
0 new messages