Graph-Easy
==========

See Graph::Easy under LIMITATIONS for some hot topics.

In addition:

Important short-term TODO:

* flow-invariant via "right, left, front, back" needs fixing
* edges between groups (ala "( 1 [A ]) -> ( 2 [B] )") or between a node
  and a group are not handled correctly by the layouter yet
  (needs a change of render order, first groups, then inter-group links,
   as well as a change to A* to get different start/end cells from the
   group(s))
* bidirectional self-loops are rendered with only one arrow: [A] <--> [A]
* layout() will grow nodes base on layout contraints, an as_txt() afterwards
  will produce these sizes, even when the input did not specify a node size.
* "[A],[B],[C] -> [ very wide node ] { size: 7,1; }" results in A being very
  broad, and B and C being very small. They should be roughly the same size.
  (for multicelled nodes: find smallest row/column, increase, until all
   columns/rows are equal size, the distribute remaining nec. min. size
   to all columns/rows)
* as_txt(): the following are wrong as txt:
  + 4_autosplit_offset.txt
  + 3_autosplit_hangt.txt
* It would be good if we could remove Node::Empty (it blocks a cell
  just to draw the right/bottom border pieces)
  (we might put these "invisible" nodes into a different "cells" field,
   which will be rendered, but not queried for path finding etc)
* implement HTML nodes as triangles, house, etc. using slanted edges
* define missing HTML edge pieces: CROSS/JOINT sections w/ end/start points
* as_html(): output of node-clusters is slightly wrong
* as_html(): there is no space between two nodes placed next (with filler
	     cell) to each other. Make filler cells output a &nbsp;
* put framebuffer related routines into own package (Graph::Easy::As_ascii)
  to avoid the dilemma that we need them from both Node and Graph.
  Likewise, some routines used by objects (e.g. graph, node etc) should
  be in a super-package and inherited)
* as_txt: output of autosplit nodes is broken when no label gets set
  "[A|B]" results in "[ A|B ] { label: A; }"
* use "shape: record" and label="{ { 00 | 01 | 02 } | { 10 | 112 | 12 } }" to
  implement auto-split nodes in graphviz (including <port>'s and rerouting
  edges to the ports)
* use "dotted filled" for graphviz to render node borders correctly
* joints in as_boxart() have problems with the joint character:
	┌───┐
	│ A │
	└───┘
	  │       ┌────┐
	  ┼─────> │ A1 │
	  │       └────┘
	  │       ┌────┐
	  └─────> │ A2 │
                  └────┘

Parser:

* edge parsing " -- test \>-->" => "test >" as edge label
* parse nested graphs/groups/nodes
* support for node splitting ala:

    "[ A ] | [ B | C ] || [ D | E ]"

* use "{}" to nest blocks?
* Nodes with both "|" and "\|" in their name are not parsed correctly
* handle RGB colors with percentages or fractions like: rgb(100%,50%,0.5)
* quoting of "[" and "{" inside edge labels ala:

  [ A ] -- label \[ 8 ] --> [ B ]

Output:

* selfloop edges should counter the general flow:

                    Until not done
                  +----------------+
                  v                |
  +-------+     +--------------------+     +-----+
  | Start | --> | Main               | --> | End |
  +-------+     +--------------------+     +-----+

  versus (loop still going left):

                  Until not done
                +----------------+
                v                |
  +-----+     +--------------------+     +-------+
  | End | <-- | Main               | <-- | Start |
  +-----+     +--------------------+     +-------+

* support different edge starting point styles ala:

  ----->  |----->  o----->  +----->  *----->  >>---->

* support egde "style: invisible"
* as_txt(): output of node clusters is not optimal
* as_txt(): output of node chains is not optimal
* better support for different shapes (circle, box, rounded, polygon etc)
  in ASCII
* as_graphviz(): for nodes/groups/graph: support "border-style: double" etc
  together with fill colors (Needs postscript code in the style argument,
  and I have not yet an idea how to write this)
* need better support for different edge styles in Graphviz
* as_ascii() and others: grow cells around point-shaped nodes to intrude:

	...........................
        :      :  |   :     :     :
	:      :  |   :     :     :
	:      :  v   :     :     :
	...........................
        :       :   :       :     :
	:-----> : * : <---- :     :
        :       :   :       :     :
	...........................

* as_boxart has some incorrect corner pieces:
   echo "[A|B|C||D]" | perl examples/as_boxart
   ┌───┬───┬───┐
   │ A │ B │ C │
   └───┼───┴───┘
   │ D │
   └───┘
   echo "[A| |C||D| |E]" |perl examples/as_boxart
   ┌───┬  │───┐
   │ A │  │ C │
   └───┼   ───┤
   │   │  │   │
   │ D │  │ E │
   └───┘   ───┘

Layout:

* allow user to specify max graph width (in cells) to avoid overly wide graphs
* auto-grow nodes to be multicelled depending on the dimensions of their label
  ("main page" gets 2x1, while "a \nb \nc \nd \ne \n" gets 1x2 cells)
  This currently causes problems and wierd layouts.
* Use the seed to generate randomized layouts

Rendering/Layout:

* allow user to specifiy "align: left, top;" or "align: center, middle" to
  specify alignment of labels. (left|right|center|middle|top|bottom)
* add margin/padding attributes (especially usefull for HTML output)

Optimizer:

* write an optimizer for already laid out graphs to optimize layout
* less memory: store border and edge styles as ints instead of "solid" etc
* use AUTOLOAD for accessors in Node.pm: most are never used by normal code

* write our own Heap (which doesn't need objects) or use Heap::Simple:
  timing from todos/big.txt:
 Total Elapsed Time = 2.845439 Seconds
   User+System Time = 2.845439 Seconds
 Exclusive Times
 %Time ExclSec CumulS #Calls sec/call Csec/c  Name
  27.4   0.782  3.392     62   0.0126 0.0547  Graph::Easy::_find_path_astar  
  15.1   0.430  0.430 179301   0.0000 0.0000  Graph::Easy::Astar::Node::cmp  *
  14.8   0.423  1.042  15380   0.0000 0.0001  Heap::Binary::heapdown         *
  14.2   0.406  0.411  15327   0.0000 0.0000  Graph::Easy::_astar_near_nodes
  11.1   0.317  0.486 122985   0.0000 0.0000  Heap::Binary::moveto           *
  7.91   0.225  0.225  89840   0.0000 0.0000  Graph::Easy::_astar_distance
  7.77   0.221  0.221 138373   0.0000 0.0000  Graph::Easy::Astar::Node::heap *
  4.92   0.140  0.436  17788   0.0000 0.0000  Heap::Binary::heapup           *
  4.25   0.121  0.121  17788   0.0000 0.0000  Graph::Easy::Astar::Node::new  *
  4.22   0.120  0.120     62   0.0019 0.0019  Graph::Easy::_astar_boundaries
  2.78   0.079  0.384      1   0.0792 0.3837  Graph::Easy::_as_ascii
  2.53   0.072  0.072  15957   0.0000 0.0000  Graph::Easy::get_attribute
  2.39   0.068  0.086  17788   0.0000 0.0000  Graph::Easy::_astar_modifier
  2.07   0.059  0.058    464   0.0001 0.0001  Graph::Easy::Node::_near_places
  2.04   0.058  0.130   9028   0.0000 0.0000  Graph::Easy::Node::attribute
  1.83   0.052  0.488  17788   0.0000 0.0000  Heap::Binary::add
  1.41   0.040  0.070     34   0.0012 0.0021  Graph::Easy::BEGIN
  1.02   0.029  0.072      1   0.0287 0.0721  Graph::Easy::_prepare_layout
  0.98   0.028  0.032   1217   0.0000 0.0000  Graph::Easy::Edge::Cell::_init
  0.95   0.027  1.122  15389   0.0000 0.0001  Heap::Binary::extract_top
  0.74   0.021  0.021  17365   0.0000 0.0000  UNIVERSAL::isa
