Set the type of the node if the user specifies it
Support self loops
Merge pull request #3 from virtuald/master

Set the type of the node if the user specifies it