graph algorithm

A graph consists of nodes and edges. A graph is connected if there is a path between any two nodes.