Yes. Your assumption is correct.
But, it is worth noting that function of means the same here as it does in mathematics. The in is just a preposition that doesn't significantly alter the meaning. (i.e. You could have said by function of and preserved the meaning.)
You have two entities. They are either friends or foes. There is some theoretical algorithm by which they diminish or enhance one another. And depending upon the relative value of this equation they are friends or foes.
It is, of course, ridiculous to assume that this is a simple equation where you can merely plug in some values and get a number, compare to a chart and decide friend vs. foe.
So, this functional relationship is really an attempt to describe a complex psychosocial relationship in simpler mathematical terms that are easier to grasp. In essence, it is a metaphor (as on some level are most equations … they have to make assumptions for variables that are not readily measured).
So, in summary: in function of is semantically equivalent to in relation to but these are both mathematical terms even if their use is effectively metaphorical.