ASCII-visualize a graph Your mission, should you choose to accept it, is to input a series of point pairs that form a graph, like this:


  A,B C,A B,A A,D A,E F,G C,G


You must then output an ASCII visualization of the graph.

For example, A,B C,A C,D could be:

A-----------------B
 \                
  \                  
   C---------D


Edit: As per the comments, here are some input constraints:


each node has at most 5 connections (+20 if you can handle more)
the graph is planar, i.e. no lines cross (+200 if you can handle even one crossover!)
there are at most 16 nodes (+20 if you can handle more)


Your score is 999 - (your code length) + (any bonuses).

Start your engines :)
APL (171 166 162 chars, all bonuses: 999 - 171 166 162  + 20 + 20 + 200 = 1068 1073 1077) 

This is the longest golfed APL program I've written so far. This might be slightly cheating, but there's nothing in the question that actually disallows this. What I'm doing is putting all the nodes on a vertical line and drawing the graph as an arc diagram. It is obviously still a graph though.

It still took me a few hours.

V←' '⍴⍨99,⍨2×⍴P←∪,C←(2,⍨2÷⍨⍴G)⍴G←G/⍨⎕A∊⍨G←⍞⋄V[2×⍳⍴P;50]←P⋄M←1⋄G←⍴D←{⍵[⍋⍵]}¨↓P⍳C⋄{V[A B←⍵;L←50+M×⌽⍳G]∘←'-'⋄V[A+⍳B-A;⊃L]∘←'|'⋄V[⍵;⊃L]∘←'+'⋄M×←¯1⋄G-←1}¨2×D[⍒|-/↑D]⋄V


The nodes must be single uppercase letters, so it supports 26 nodes maximum. It can handle crossed lines, and each node can have as many connections as the display will handle.

Example output:

A,B C,A C,D

      +-A--+                                              
      |    |                                              
      +-B  |                                              
           |                                              
        C+-+                                              
         |                                                
        D+   

A,B C,A B,A A,D A,E F,G C,G

          +--A-+-+-+                                           
          |    | | |                                           
          |  B-+ | |                                           
          |      | |                                           
        +-+--C   | |                                           
        |        | |                                           
        |    D---+ |                                           
        |          |                                           
        |    E-----+                                           
        |                                                      
        |   +F                                                 
        |   |                                                  
        +---+G                                                 


 T,H E,Q U,I C,K B,R O,W N,F O,X J,U M,P S,O V,E R,T H,E L,A Z,Y D,O G,S

               +---+----------T                                                 
               |   |                                                            
               |   +-------+--H                                                 
               |           |                                                    
               |           +--E---------+-------+                               
               |                        |       |                               
               |              Q---------+       |                               
               |                                |                               
               |     +--------U---------------+ |                               
               |     |                        | |                               
               |     +--------I               | |                               
               |                              | |                               
               |              C-------+       | |                               
               |                      |       | |                               
               |              K-------+       | |                               
               |                              | |                               
               |       +------B               | |                               
               |       |                      | |                               
               +-------+------R               | |                               
                                              | |                               
             +----------------O-----+-----+-+ | |                               
             |                      |     | | | |                               
             |                W-----+     | | | |                               
             |                            | | | |                               
             |           +----N           | | | |                               
             |           |                | | | |                               
             |           +----F           | | | |                               
             |                            | | | |                               
             |                X-----------+ | | |                               
             |                              | | |                               
             |                J-------------|-+ |                               
             |                              |   |                               
             |                M---+         |   |                               
             |                    |         |   |                               
             |                P---+         |   |                               
             |                              |   |                               
             |   +------------S-------------+   |                               
             |   |                              |                               
             |   |            V-----------------+                               
             |   |                                                              
             |   |            L-+                                               
             |   |              |                                               
             |   |            A-+                                               
             |   |                                                              
             |   |           +Z                                                 
             |   |           |                                                  
             |   |           +Y                                                 
             |   |                                                              
             +---|------------D                                                 
                 |                                                              
                 +------------G