i have a graph stored as an adjacency list in a database.
i want to display the graph to a maximum of 6 nodes away from a given starting node. this would be easy if there were no cycles--i could just use pro-order traversal or some other time tested method. i want to be able to detect a cycle and deal with it accordingly in the display.

any pseudocode would be helpful.