Why Don't We Have a General-Purpose Tree Editor? (2014)
Because the use case of &quot;edit all graphs&quot; is too divergent to be solved by one program.<p>For simplicity, let me start with just trees. What kind of trees have we got?<p>Well, we&#x27;ve got programming language ASTs. In these trees, nodes tend to have only two or three children, each of which is probably a short word or a number, but they can easily extend hundreds of levels deep, or even thousands. (Before you disagree with this, go take a look at the dump of the AST of a modestly complicated Python function or something. Many programming language grammars are not optimized for this representation and end up with <i>way</i> more intermediate grammar nodes than you&#x27;d expect, which all seem like they&#x27;d be really easy to &quot;just&quot; collapse, but that causes its own problems.) The naive and obvious representations of all of this are difficult to navigate and consume the vast majority of the screen with whitespace. It rapidly becomes clear you need a specialized mechanism for dealing with this... then after a few iterations, if you do it right, you discover that you&#x27;ve reinvented... the original textual representation.<p>(This is not proof that textual representation is optimal in general. You can correctly argue that you end up there because the entire language was designed with that in mind in the first place, and that a language designed to be graph-based in the first place may work better. However, your tree viewer doesn&#x27;t have any of the latter <i>that doesn&#x27;t already have a special-purpose viewer</i> built for it, which your putatively generic code isn&#x27;t going to compete with.)<p>Database rows are just a graph, right? Well, that&#x27;s one top-level node for the result that contains the rows, and then, oh, let&#x27;s say 25,000 identically-structured children. How are you going to navigate that? Are you going to introduce a &quot;paging&quot; concept? If so, you&#x27;re going to complicate the other uses of this generic editor that don&#x27;t need it.<p>How about rich text? Rich text is just a tree. But is your generic tree editor going to require sub nodes for &quot;bold&quot;? For that matter, how does your generic editor handle either of &quot;text &lt;b&gt;bold&lt;&#x2F;b&gt; more text&quot; or &quot;text &lt;span class=&#x27;arbitrary_class&#x27;&gt;span&lt;&#x2F;span&gt; more text&quot;? There&#x27;s a lot of different rules that people may want to apply to tree nodes; do those look like one, two, or three nodes in your editor? I can make a case for all three, for instance, for the first one (imagine the word bold is bold in the first one, it&#x27;s a rich text display):<p><pre><code>     * text bold more text

     * text
       (bold) bold
       more text

     * text
       (bold) bold
     * more text
</code></pre>
(Note the new asterisk on the third line of the last one; it&#x27;s a new node. In the first one, we have &quot;special&quot; nodes that can be embedded, whereas others probably can&#x27;t be; that&#x27;s a heck of a concept to write into your generic editor and will have huge ramifications in all sorts of other places, not least of which is the graph data representation and API. In the second one we somehow have &quot;embedded&quot; nodes, which has the same problems, except it has <i>different</i> massive effects on the graph data structure and API. The third is conceptually simplest in a lot of ways, but maps neither to HTML nor to the human&#x27;s internal representation very well.) Now, how do your choices that you made for this rich text application map back to the other types of graphs you may want to support? Because each of those three choices will have different implications if you then try to support RDF graphs in the same visual layout.<p>Speaking of RDF... have you considered the visual differences between ordered trees and unordered trees? Box &amp; line graphs naturally represent unordered children, outline views impose a view of order even if one doesn&#x27;t exist, other layouts may have other consequences. You can&#x27;t just let the decision about outline vs. box &amp; line be determined by the orderedness of the nodes either, because there may be other properties of the graph that may be unsuitable for.<p>And then, of course, there&#x27;s the graphs that you want to view as box &amp; line diagrams, the ones you want to have fully manual layout for vs. the ones you want some degree of automation. And you&#x27;ve to deal with the boxes that are way too big for the display because they contain several dozen kilobytes of plain text. Can your boxes contain subgraphs within them? And under <i>any</i> display methodology (graphs, outlines, whatever), what does it look like when you have a node with 25,000 incoming links? Does that work well with graphs that have only a few nodes like that? What about graphs like friend networks on Facebook that consist almost entirely of nodes that have hundreds of links? Note that when you&#x27;ve seen graphs of Facebook, they never much resemble, say, LabView diagrams, they&#x27;re always these very zoomed-out representations with only entire regions colored and being discussed. How is your generic graph editor suitable for use on programming languages doing with this graph?<p>The theme here is not &quot;unsolvable problem&quot;. The theme here is &quot;unresolvable conflicts between different use cases&quot;. In an individual context, these issues are solvable, and have been reasonably solved. But trying to create a generic &quot;graph&quot; editor is, well, given the genericness of the term &quot;graph&quot; basically trying to create a generic &quot;editor&quot;.