What is the right UML diagram for an alogorithm that lives inside a method? The algorithm is basically procedural. In "UML Demystified", an Activity diagram is presented as a tool for fleshing out the behavior use-cases, not really for representing procedural code within an object-oriented application. Since it's very flowchart-like it seems that it would work fine for representing an algorithm, but I'm wondering if there is a "best-practices" diagram for this.
After completing the contract for each method the SSD (System Sequence Diagram) is a natural.
What is the right UML diagram for an alogorithm that lives inside a method?
The "right" diagram is the one that most clearly communicates the points you think are important for other developers to know. I use sequence diagrams a lot for figuring out or documenting complex messaging sequences between objects. In your case, the algorithm is procedural and (if I'm understanding correctly) completely contained on the method's block diagram. Personally I wouldn't bother with a uml diagram in that situation--I'd just make notes explaining it on the block diagram itself.
It's easy to get caught up in all the technicalities of uml, but ultimately uml diagrams aren't the goal. They're just a tool to help you achieve your real goal--working software. My philosophy is to use uml when I need it... and even then I call my diagrams "uml-ish" because I'm sure they aren't strictly correct. But they're good enough to help me work through the problem.
I often use the State Diagram when describing induvidual VIs since all my larger VIs are state machines.