Removed name field from nodes
Implemented FactorGraph for terminal edges
Rpelaced FactorGraph implementation with TerminalGraph
minor formatting