How do I know my song doesn't have the same melody as an existing song, just in a different key? they sound pretty different even though the contour of the melodies are generally the same. the notes follow the same GENERAL direction, but still differ because the intervals are slightly different, by only by at most 1 whole step.
Melodic contour is the direction of tones ascending and descending in a melody without regard to the rhythm of the actual notes.
The general contour of the line is an important aspect of melody. For example, an 'arch-like' shape is common for many melodies where the line gradually rises hits a single highest not as a climax then gradually descends.
The specific intervals employed in the contour are important. Consider that two lines could generally have the same shape, but the specific intervals could determine that one melody is in the minor mode while the other is in major. You could even have a third line with the same general shape that is atonal and not in any key!
While rhythm is not normally considered when examining melodic contour it is very important for creating the final character of the actual melody.
Consider the tune 'Joy to the World' (the one by Handle nor Three Dog Night.) When rhythm is removed the first part of the tune is simply a descending scale. The contour is just a downward line. But, when the rhythm is added the melody becomes distinct and unique.
Similar things can be seem with rhythm by changing the meter of a melody. Often the melodic identity is maintained if you make such a meter change (you can still tell what the original melody is) but the character of the melody can change.
Comparing two similar melodies can be a tricky business especially if plagiarism is the concern.
If you compare only the melodic contour, I think you will find many melodies that appear similar to another. You have to add in the other factors like specific intervals, tonality, and rhythm to make a true comparison.