//TODO: properties plumbing. Notice AbstractNodeRenderer, AbstractEdgeRenderer, AbstractLabelRenderer

//TODO: import filters from JUNG. DropSoloNodes for instance

//TODO: Iterator-styled GraphTraversal (!!)

TreeView --> pairnei ena graph (mono dag?) kai ton parousiazei ws "dentro". Malista, einai Graph to idio. Duplication eswteriko. ?

na mporeis na filtrareis epi topou enan grafo. Px, an egw pw addEdge(n1, n2), na mporw
na exw ftia3ei etsi ton grafo wste aytomata na agnoei tin akmi otan n1==n2, i na petaei exception, whatever


serializable, saveable, loadable, copyable


Closures, apo edw, mi patas ekei, ws ekei (me metwpo epektasis).

einai view. To layout afora tous komvous mono, akmes draw opou na'nai.
diladi layout to closure, alla draw ton grafo olokliro.
Composite apo renderers! Grid: ypodoxeas allwn layout, apla orizei to xwro!
Tree: comparator, policy gia xwro per nodes paidiwn, ki anadromi (ane3artiti ap'to policy!)!!!
(diladi na einai built-in i anadromi, pou na xrisimopoiei anadromika to user-defined policy)
p

ta nodeLocators (oi metasximatismoi twn points, px flip) prepei na EXEI SXESI me NodeLocators?
De mporei na doulepsei me kati allo, px me synola apo Points?

prepei na einai dentro,as yparxei ypostiri3i apo kleisimata gia dimiourgia dentrwn apo grafo.

*****************
graph has MULTIPLE STRATEGIES for storing and querying, by node, by edge, by node-value,
    by edge-value, by edge-node

-hashSet, arrayList
--sparse node, sparse edge --> storage strategy
--fast iteration (linked or not) --> iteration strategy
****
node locator: strategy for assigning position to new nodes


**
animation: an Iterator<NodeLocator>!
**********
NodeFactory: configure equals, hashSet, set or bag semantics
EdgeFactory: <=> 
NO!!! GraphFactory: set/bag, per node, per edge semantics must be defined in GRAPH,
as well as strategies.
*******
Directed - undirected? (no need to! All directed! Edge renderer can draw "as if" undirected!)
*****
Nodes and edges can be used simultaneously in setGraphs and bagGraphs.
*******
views - granularity: node, edge (not a bunch)
*******

************
label should be changeable, per Graph? or per GraphView? only view needs a label. 
default should be toString(), but can be changed with a different label strategy (event),
per GraphView/Graph
When missing from Graph, use default from GraphView
Assign a name (with a NodeNamer)

nodeFactory: generates nodes that have a predefined toString. What about changing this? (event)
*************

Edges should be drawn LAST, having complete control of the graphView. (So that special care
can be taken of intersected edges).

******
Layout! Composites! Opws awt!
Px BipartiteLayout (Graph g1, g2), i BipartiteLayout(Graph, SideChooser function)
Rotate, scale, flip NodeLayout
Restrict layout to SPECIFIC RECTANGLE!
TreeLayout -> CircularLayout

Kane efarmogi me dentro, opou kaneis Anim otan kanei klik se komvo, kanontas rotate ta paidia tou



-------------------
Giati to invert kai to update den epistrefoun tin idia akmi? Giati einai immutable i akmi?
Giati to mutability tou edge douleyei anapoda apo to shareability tou edge, meta3y pollwn grafwn,
dynatotita pou krinetai pio simantiki apo to na epistrefetai to idio edge meta apo update. O kindynos pou
prosti8etai einai an to proyparxon edge einai kleidi se Map - i diaxeirisi olwn twn emplekomenwn Map
dystyxws den mporei na einai aytomati. Vevaia, protimotero einai na xrisimopoieitai to Map tou idiou tou edge.
An afe8oun ta pragmata sti tyxi tous, tote yparxei periptwsi ena edge na alla3ei apo enan Primary grafo,
kai oi deytereyontes grafoi pou exoun tin idia akmi na min mporoun na enimerwsoun tis listes akmwn twn komvwn
tis akmis - 8a emfanizoun tin palia katastasi, omws to edge.n1 kai edge.n2 8a einai ta nea. Etsi 8a katarriptontan
to semantic oti e.n1 einai o komvos arxis kai e.n2 einai o komvos telous, ma episis, 8a mporousan aytes oi
metavlites (sti periptwsi tou update, kai oxi tou invert), na deixnoun se pantelws asxetous komvous.

Alli mia pi8anotita 8a itan to edge na mi gnwrizei tous komvous sta akra tou ws metavlites, alla na exei
dyo akra *gia ka8e grafo ston opoio anikei*. Etsi, 8a mporouse na moirazetai i idia akmi, se pollaples faseis
se diaforous grafous - omws ayto 8a itan para poly argo - ena hash toulaxiston gia ka8e access komvou akmis.
Episis 8a itan afysiko - ti 8a pei, i idia akmi, me diaforetikous komvous, se allous grafous?

Telos pantwn. H sxediasi pou epistrepei tin synypar3i kai twn dyo dynatotitwn, pou kri8ike ws akatallili
logw polyplokotitas kai taxytitas, einai:
SecondaryManager, pou katagrafei ka8e dimiourgoumeno SecondaryGraph, me weak references. 
--Gia ka8e edge pou prosti8etai se secondary graph, enimerwnetai o SecondaryManager, kai vriskei
  i dimiourgei ena Set apo secondary graphs, tou opoiou melos einai to edge. Mesw tou Flyweight pattern,
  gia na apofeyx8ei i dimiourgia enos kainourgiou set gia ka8e akmi. Ta sets 8a prepei na einai kataxwrymena
  se ena HashMap, me kleidi to hash tous (!), wste na mporei na eleg8ei an ena set pou 8eloume na dimiourgisoume
  yparxei idi - xwris na to ftia3oume eidika gia ton elegxo. Giati ayto px mporei na ginei gia 10.000 akmes mazemena.
  Omws ta Set de mporoun na perilamvanoun akrivws SecondaryGraph, giati aytoi oi grafoi de 8a mporousan pote na
  ginoun garbage collected. Ara WeakReference. Kai yparxei to provlima, ka8e pote elegxoume ta set an exoun stale
  grafous (collected). Ki otan ginetai kapoios collected, iterate OLWN twn sets, kai (pi8ani) enimerwsi tous.

--Gia ka8e edge pou afaireitai apo secondary graph, i idia diadikasia me tin parapanw.

Pleon, se ka8e PrimaryGraph, amesws afou allaxtei ena edge, kai prin to fire tou antistoixou event,
8a prepei na zitaei apo to SecondaryManager na aposteilei tin allagi tis akmis se ka8e SecondaryGraph
pou periexei tin akmi (ayto itan to zitoumeno), etsi wste na yparxei consistensy meta3y olwn twn emfanisewn
tis idias akmis. 

---------------------------
Order in graphs:

H sxediasi tis parousis vivlio8ikis diaferei simantika apo aytin tis yWorks sto simeio tis diata3is
komvwn/akmwn se ena grafo. To yWorks dinei plires API gia na orizei kaneis "prin" i "meta" apo poion
komvo i akmi 8elei na topo8etisei ton neo komvo i ti nea akmi. Eimai vevaios oti gia na yparxei oli ayti
i ypostiri3i, 8a to xreiastikan. Omws epele3a na aplopoiisw poly tin katastasi, orizontas tin diata3i twn
komvwn kai twn akmwn ws "unspecified". An kai stin ousia, panta oi komvoi topo8etountai sto telos, kai panta
oi akmes topo8etountai teleytaies stis antistoixes listes. Apo to na exw mia ypostiri3i gia mia sygkekrimeni
diata3i (an kai einai poly eykolo na ylopoii8ei i proseggisi tou yWorks, i anagkaia ypostiri3i vrisketai idi
sto ounos.util.Sequence), epele3a na exw perissoteri ypostiri3i gia polles taytoxrones diaforetikes diata3eis,
me pio isxyra mesa orizomenes (Comparator). (TODO). 8a i8ela na exw enan tropo argotera, px, pou na diasxizw
tis akmes enos komvou kata gwnia, dw8entos enos layout.


---------------------------
On JDSL's Graph.opposite(Edge) method: This allows for an edge to have different direction for each graph.
It makes origin/destination queries inefficient. This also could be extended in the case of the edges "directed
or not" property. An edge could be directed in one graph and undirected in another. Undoubtly, leaving edges
without n1 and n2 is more complete and correct. One could even implement hyperedges as such edges. This power
though comes at the cost of making the api more complicated. It was a very difficult desicion for me to
choose e.n1 and e.n2. The cost of the extra indirection is slight, I cannot argue that e.n1 is a critical
operation. But convulting the api like this has major implications: consider Path abstraction. It wouldn't it
be possible to define it as a root node and a list of edges - each each would need to be accompanied by
an owner graph. I am not sacrificing Path's beauty for the dubious advantage of keeping object identity in
the rare event of edge modification. 

----------------------------
Elleipseis: Den yparxei api gia na parw ena ListIterator pou na 3ekinaei se sygkekrimeno komvo i akmi. Enw
ayto einai dynaton. Parepiptontws, i diata3i twn akmwn den einai plirws tropopoiisimi (fysika): oi OUT akmes
einai panta prin tis IN. 