Why Don’t We Have a General-Purpose Tree Editor?
pcmonk.wordpress.com
pcmonk.wordpress.com
For extremely simple stuff, you can use TGF [2] to represent the graph and something like yEd [3] to view it.
None of these tools have any real provision for structured proofs etc., but that could be built.
[1] http://www.graphviz.org/Documentation/dotguide.pdf
[2] http://docs.yworks.com/yfiles/doc/developers-guide/tgf.html
The other tools have promise as well.
graph graphname { a -- b -- c; b -- d; }
-- or like this for a directed graph (the -> arrows show you which direction the links are going):
digraph graphname { a -> b -> c; b -> d; }
You can break up that first line into a -> b and b -> c and get the same graph if you want. It's not necessary here but it is when you have lots of outgoing links from the same node.
The other things you can type in are basically formatting options for the various utilities. You then feed these text files to various command line tools to do things like get a PNG of your graph:
dot -Tpng my_text_file.dot -o my_graph_image.png
That's it. The rest is just playing with it to get what you want.
https://en.wikipedia.org/wiki/DOT_%28graph_description_langu...
It can get complex, but the basic syntax is as simple as what this article suggests.
I would like to be able to add nodes as easily as I add cards in Trello.
E.g.
http://yuml.me/1ec584ad http://yuml.me/1ec584ad.svg http://yuml.me/1ec584ad.json http://yuml.me/edit/1ec584ad
Look at, for instance, source code. In many languages, we represent code in a tree-like structure, just with text and braces/parenthesis/tabs as indentations. But we all know that there are major limitations on how to represent a class. If you have 200 methods in a class, said class is unwieldy. If your methods are very deep, the whole thing also becomes unwieldy, so we make them smaller. We'd still do that with huge monitors that could show lots and lots of code at once: Without abstraction, any nested structure is hard to manage.
Many text editors will collapse levels for you, but really, how often do you all use them? Whenever you need to use them, it's a smell, because it means that the structure is getting too complex for a mind to handle.
This is not an issue that is unique to code. Any tree structure has the same issue of abstraction: We are not designed to handle more than one layer at a time, unless we are dealing with a tiny number of nodes. We have trouble seeing trees and navigating trees, so of course we can't have good general tree editors. I've seen four attempts at just general tree visualizers at work in the last year. The most successful barely pay lip service to regular tree 'views', and instead try to answer secondary questions that would help us know how we want to explore the tree.
And, as others here have already said, there's always non graphical representations. find, awk and grep can go very far when you are trying to find things on a tree. Proper indexing does a good job too.
I agree with you on everything except this: code folding is very useful in creating a high level view of code to reason about. I would argue further for code bubbles, but they haven't really been done right yet; perhaps we will eventually see some interesting good solutions in LightTable.
I've considered writing a plugin for LightTable or perhaps Sublime Text but I have no experience with either of their API's and I am not sure whether it would even be possible.
Definitely...Also, trees are pretty abstract data structures. You can imagine a min-heap as a tree but for practical purposes you can also think of it as an array where there are special rules for interacting with elements (adding, removing, finding the child of a node, etc). It could be a pain to try to generalize something so abstract and with so much room for complexity by making a tree editor...
It's the same reason why UI's for software development haven't taken off. When something is that abstract and complicated, it's almost harder interacting with an interface that tries to 'dumb it down'. Not to mention the lack of control such interfaces would introduce.
This seems to be a bit of a red herring: you can think of an array as a contiguous region of bare bits in memory where there are special rules for interacting with elements—and similarly for any data structure—but that point of view doesn't seem to be the most useful (except possibly, in the array case, for programming in C).
cyclical, not cyclical. root node or loose. for an editor you probably don't even have to worry about the rest such as direction of traversal etc.
Exactly - my response was basically - "We don't have a general purpose tree editor because we don't have general purpose trees".
I tend to see sexps as a general tree and emacs+paredit[1] as a general tree editor, and even though I completely agree about your point on 'if you need folding maybe your design is wrong hence no need for tree structures'. I really feel limited whenever I use a non sexp based language. It's like having you're own little private refactorer at your fingertips. And even for small code it's a noted pleasure.
[1] emacs or whatever program you use, as long as it give you tree walking keybindings.
Yes, we are only built to think of an idea/code/story/essay at one "level" at a time. You are either thinking about the overall structure of the code, or a particular line. A particular scene, or the overall plot.
But that's precisely why a tree editor, one that separates the levels for you, is so useful. You can always "zoom in" to the details by going right, and "zoom out" to the big picture by going left.
Have a look at Gingko, for our approach to solving this problem: http://gingkoapp.com
Looks really cool. I always felt spreadsheets were too grid-oriented and flow charts too much about vectors and nodes. Treesheets looks like a great mashup of those two.
[1]: https://mindnode.com/assets/images/screens/iphone-1-1136x640...
Edit: The simplest tree editor is probably the file system on your computer. However, the problem is for proof's I suspect your going to want to have some sort of graph structure.
PS: If your willing to do some light coding XQuery/XSL-FO let's you transform the raw XML into various more user friendly formats like PDF's. However, if your structure is really nested that quickly get's hard for people to understand.
Online, there's Text2MindMap[1] which is quick and easy to use, and offers a rubber-band like ability to reposition nodes, but in my experience, once past a couple of hundred nodes (I do some fairly large maps) performance gets really laggy, especially if you've got an otherwise populated Chrome session running.
Offline, there's the FreeMind[2] tool, Java based. My main problem with it is that editing is incredibly fussy.
What I prefer mostly is GraphViz[3], which is not just a mind-mapping tool, but can be used as such. The advantage here is that what you're editing is a simple text file, with graphic output created by running one of the graphviz commands over it (dot, neato, twopi, circo, fdp, sfdp). For a traditional mind map, the 'circo' command is probably what you're looking for. While not as interactive as other methods, if you're working on a complex space, the lack of constant overhead for graphical presentation is a plus, as is the simplicity of the base language. What I'm still looking to do is to write a simple outline -> GraphViz converter which sets up edges based on indent levels and parent, which would further simplify the input problem.
________________________________
Notes:
http://www.youtube.com/watch?v=Ekq56VZqQvs&t=5m25s
earlier version: http://www.youtube.com/watch?v=KN3tKT0E0t8&t=14m30s
(EDIT: also at: http://www.youtube.com/watch?v=KN3tKT0E0t8&t=19m40s as he updates the layout algo in real time (!))Worth watching as he puts it through its paces.
If I was hiring someone to create a generic tree editor, his number would be top of my call list :)
This takes me back to high school when a friend and I goofed around with spatial navigation through hierarchical structures. Of course that was in the era of the 486, and we had no idea what we were doing, trying to build something based on vector graphics with Pascal on DOS... so this was what we were dreaming of but couldn't make (nor properly articulate).
It's also nice that he abstracted the layout so thoroughly that he can not only create a variety of 2D and 3D views, but also map the underlying data structure onto actual game elements in the game's main display, as you can see in one or two of the other demo videos.
My favorite is OmniGraffle... you can enter nodes in a text-entry outline style mode and the results are updated instantly. The default styles and stencils, while recognizable as being generated by OG, are inoffensive, and the layout tools are among the best of any layout or presentation software.
Others have mentioned GraphViz, which is a general purpose graph description utility.
Outliners as a general category of software have existed since the 1980s and seen an ebb and flow of popularity. Just a few off the time of my head... Think, More, Acta, OmniOutliner.
The Frontier scripting language in particular stands out as a programming environment completely integrated into an outliner paradigm. My first exposure to code folding came when discovering Frontier sometime in the mid-'90s. As Apple put its Mac scripting focus on Applescript, Userland reimagined Frontier as a web site programming environment: templating, scripting, and content management all rolled into one. But at the same time it was a general purpose scripting environment.
Maybe my graphing needs are not so deep that these tools (or some combination with a few others) wouldn't suffice for a variety of tree/graph related tasks.
If you need a tree, it's most likely that you want some custom operations on that tree (e.g. parsing text into the tree, pretty-printing the tree, traversing the tree in various ways, etc.)
At some point, the tree is just a data structure and what you're interested in are full-blown, non-trivial algorithms/programs for fairly domain-specific tasks. In these cases, a library (or even custom implementation) for a general purpose programming language is more useful than a tool (a la Excel or vim).
Viewed in this light, it's not unsurprising that we have many domain-specific tools for manipulating trees. Most of the proof assistants have a GUI based on Gentzen-style sequents.
LaTeX has styles for type setting proofs which look like the ASCII ones in the article.
Tools for generating parsers often have tree-based UI's.
And so on.
I think, though, that there's enough common ground between the various domain-specific tree editors that some kind of useful intersection exists. Then the domain-specific tree editors would simply be plugins.
At any rate, thanks for provoking the discussion.
I've done talks about Xiki at RubyConf, Strange Loop, and QCon. Here's a quick 3 minute video - https://www.youtube.com/watch?v=bUR_eUVcABg. I'm doing a Kickstarter campaign soon, to bring Xiki support to vim, sublime, and possibly other text editors!
You can drag and drop folders and files. You can see the hierarchy on one side of your screen, and then the contents of a single node on another. Minimizing/expanding usually works. You can rename things in-place.
If you're imagining tree structures that don't map really well to this kind of GUI, then the reason your tree editor doesn't exist should be apparent.
There's a forked version that can save to the local filesystem here: https://github.com/interstar/OWL
https://github.com/mgraczyk/GraphCompiler
The data structures can be used directly in Python or parsed/consumed elsewhere. I think it is pretty useful, and I have used it in a couple of places where moderately complicated trees are used to generate C/C++ code.
As long as I am on the topic of this, you know that you are in under explored territory where the first man page you visit for debugging your first non-trivial problem starts with "This is not the function you are interested in." (man getdents).
Beyond this, yEd[2] is really quite cool (even if it does have a very dated UI).
[1] https://www.evernote.com/shard/s3/sh/67c67a48-8b3d-4eac-b7ee...
I am currently working on a web based version of such an editor at JetBrains. You can take a look at it here: http://jb-proj-demo.appspot.com/ (It's open source and it's available on github here: https://github.com/JetBrains/jetpad-projectional)
We have quite a smart layout here which was implemented from scratch.
I grudgingly use calibre for epub/mobi conversion. Calibre's UI is ugly and it is not very usable: there are three separate pairs of arrows on the ebook preview screen! How would you decide which pair is for pgup/pgdn? And what would a user expect the use is for other two sets?
Hard to do without graphics, and once you introduce graphics, you end up with endless non-productive futzing by non-graphics artists trying to be amateur graphics artists with move this one pixel over to get an artistic look or whatever other graphical effect. Unfortunately the user isn't a graphics artist and is theoretically hired to write code or memos or reviews, so they're both working way out of their core competency AND usually not any good at graphics arts. And if you don't allow hours of futzing, a competitor will, and you'll be destroyed in the marketplace. People like futzing even if its by definition totally anti-productive, which isn't all that weird given the popularity of the open plan office and so on.
Nothing is ever new in IT. In the early years of desktop publishing, productivity suffered dramatically because a simple memo meeting notice which took 10 minutes on typewriter and xerox, now took at least 3 hours of font selection (at least 6 different fonts and sizes per page) and endless clip art and at least 10 revisions to get it "just right".
[1] http://leoeditor.com/tutorial-basics.html#selecting-and-movi... [2] http://leoeditor.com/tutorial-programming.html [3] http://leoeditor.com/tutorial-pim.html#clones
It's status somewhat resembles Org Mode: it has its own format (which hasn't caught on as interchange format) but has sufficient manipulation and export power to allow some people to spend their life inside it.
---
The second thing that spings to mind is YAML which is usually used for trees but the actual data model allows graphs. Is there any structured YAML editor (a-la paredit)?
Maybe not a general purpose tree editor, but at least it's helped me out so far :)
If you like a plain text solution the TGF Format might suit your needs. It can also be visualized and edited in yED but it's very limited in its feature set.
A very nice and simple solution for visualization of small trees is to parse plain text with XSLT and transform it into SVG [2].
For are more programmable concept i would recommend to have a look at the combination of D3js [3] + JSON (or XML).
[1] http://www.yworks.com/en/products_yed_about.html [2] http://www.xml.com/lpt/a/1472 [3] http://d3js.org
I only skimmed, but the article didn't seem to address the questions raised ("why?"), but instead described the problem and proposed solutions.
I think an answer to the question would be far more interesting and revealing... it might simply be that 1. it's hard; and 2. text is far better at hierarchical structures. Like his examples, lisp, programming languages in general, arithmetic algebra.
So I think the hint is that the Human Processing System is adapted to handling hierarchical structures linguistically (i.e. symbolically: speech, writing, text). I suspect there is a very good and deep reason for this, to do with the kinds of operations (transformations) typically needed. But I don't know what that reason is.
Org-mode (and outliners in general) are tree editors. If they support links then they are graph editors.
- a representation that can be shared by various tools, possibly in parallel. Allow attaching arbitrary attributes
- ability to map between equivalent but different representations (adjacency matrix, node/link/port etc.)
- plugins that operate on a specific rep. and map to some visual representation
- a language for programmatic construction (or may be a library)
- efficient storage representation (one or more)
- communication protocol for sharing/moving subgraphs
- key/mouse bindings when viewed graphically
- macros/functions to encapsulate useful patterns
- graph manipulation & mapping tools (e.g. mapping a circuit schematic to a PCB, compiling, etc.)
[Sorry for the frequent editing - I was trying to get the list right. Still not quite right.]
Imagine being able to dump plain-text files for real trees when diffing-merging. The way differences are shown to the user could be like a project i did a few years ago to show differences in graphs (applied to basic-blocks graphs). Here is the link: http://corelabs.coresecurity.com/index.php?module=Wiki&actio...
From their homepage:
> Leo is a PIM, IDE and outliner that accelerates the work flow of programmers, authors and web designers. Leo's unique features organize data in a revolutionary way:
> * Leo outlines are views on an underlying graph.
> * Outline nodes can reside in many places within a single outline.
> * Leo is fully scriptable in Python.
> * Leo scripts have full access to Leo's source code and all outline data.
> * Outline-oriented markup generates external files from outlines.
Screenshot: http://freemind.sourceforge.net/wiki/index.php/File:FreeMind...
Website: http://freemind.sourceforge.net/wiki/index.php/Main_Page
https://github.com/SonyWWS/ATF
See many examples in the gallery: https://github.com/SonyWWS/ATF/wiki/ATF-Gallery
Similarly, proofs are only treelike at a very small depth before becoming directed graphs, and most modern data stores like XML and JSON which form trees tend to have additional logical (if not formal) schemas that add complexity to the problem.
Each frame held other frames, or could hold text, a spreadsheet or a database.
It wasn’t a DAG (directed acyclic graph) which was frustrating sometimes.
I think you could program leaves to link to other leaves, but I wasn’t any good at programming. It had its own programming language FRED.
The people who grokked it loved it.
I think there is still a [closed source](http://www.framework.com/) community supporting it, last time I looked.
I hope you will use markup with something like YAML or [JSON-LD](http://manu.sporny.org/2014/json-ld-origins-2/) to store your links.
(by the way, I love your blog)
Graph layout algorithms have come to mind for a topic on my blog from time to time. It's a woefully underdeveloped field, and it could be good blog fodder...
My favorite casual text editor is this one [1]. So likewise I imagine a graph editing program that's very simple and one could use it anywhere. Say you click and that creates a new node and a text area pops up for you to type things in. Then you can create a new node, drag to form an edge, etc. The only thing is that I imagine I'd hate working around the force-guided graph layout algorithms the entire time, cause stuff would keep bouncing around. I'd want to be able to drag and drop nodes to move them away momentarily, zoom in and out and pan to focus my attention on some small part of the graph, and then toggle the layout algorithm to snap things back into place.
Everything would be stored locally in the DOM (or, say, in the url), so you could bookmark and share easily, and import/export to JSON or edge-list representations. And... yeah that's about it. I can't imagine wanting colors or styling, but if the design is simple enough you could have plugins for that (and plugins for layout algorithms, etc). I also can't imagine how one would do text navigation on nodes of large degree... Even if you did come up with a system, it would necessarily depend on the graphical layout decisions (which change dynamically) and that would require you to tie the graph data structure to its geometric interpretation, which smells like spaghetti design to me.
It's something to think about. If your ideas are along similar lines, I'd be happy to team up and start a github repo. I just can't commit to working on it all that often.
[1]: data:text/html, <textarea style="font-size: 1.5em; width: 100%; height: 100%; border: none; outline: none; font-family:monospace" autofocus /> (copy and paste this as a url)
EDIT: I suppose if you really wanted a keyboard-based system you could have a text representation of the graph (as a vertex list + edge list) and have the graph update in real time. When you make changes in one side the changes automatically update in the other side. Then you could use keyboard or mouse however you see fit.
It's a full tree editor, that is being used for everything from PhD theses, to television screenplays.
http://gingkoapp.com https://www.youtube.com/watch?v=egCKZHsICm8
Text editors are useful because standards have evolved with them. We have standards for trees - XML and JSON for example. CSV editors are useful because there are ways to convert other table data into CSV to work with. If you just allowed a tree editor like XCode's plist editor to import other file types it would be the same situation.
I think I could work off of code-highlighting files to figure out where to break code out into different nodes.
Then, I would look for matching terms in each node, and make connections. Connections could also be made based on containment (part of a class, or a child function, or a where clause).
One hotkey to follow a connection to it's destination (and select that node). Another to pull it in and make it share the screen with the current node (and select it). Pressing the "pull in" key would push a node off the screen if it were already on screen.
Of course, maybe you would only want to explode some of your code as nodes. You could highlight part of you file and hit "explode" to break it out into nodes for a minute.
[1]: http://littleoutliner.com/ [2]: https://en.wikipedia.org/wiki/Dave_Winer#Career
Also it will serve for a html/js workshop for kids. They have a hard time setting up and working with regular editors and the file system.
The program is general purpose (different kind of node can be handled with plugged-in "drivers").
If you're interested, drop me a mail.
http://www.hdfgroup.org/products/java/hdfview/
There's also:
The deficiencies in the generally available tools are obvious, but refined versions do exist here and there.
It's an interesting project, though, I'll try to check it out and see what I can learn from it.
I use workflowy everyday and it's really cool; it doesn't feel very actively developed though, and that's a shame.
Workflowy is an enlighteningly simple app (it's really just bullet lists with zooming) but it's incredibly effective for what it does, and the free-form nature of it makes it easy to just brain-dump random notes to get your thoughts out into text. I use it to do rubber ducking [1], because just the act of putting my problem into text helps me organize my thoughts. I can't say enough good things about it.
so I have no idea.
There's a screenshot and a live demo. Workflowy is more advanced and capable. I made my app solely to note down everything. I have been using it for 4 solid years now and it has helped me organize my life.
[1]: http://www.folderagent.com/images/blog/fa-rules-tree.png
It is hard to do them all, or to come up with one solution that pleases everybody, therefore everybody is doing his own tree. Maybe that's not the most general solution, but in reality you really need this one particular choice of tree representation to do your job.
ETA: incidentally, architecturally it is structured for easy plugin / "script" extensibility, like a low key emacs.
and in the special case of extremely sparse graphs like trees, the adjacency matrix isn't going to win very often.
your copy of CLRS should discuss all of this. and for practical uses of non-adjacency matrix representations of trees, you can take a look at every functional programming language, ever.
Deleted comment