如何在mxgraph中验证从目标到源的传入边缘

嗨,我在边缘验证方面遇到了问题

注意:任何方法都是最受欢迎的,但应该解决问题

下面是我的要求

  1. source 可以有任何以下 Action_* 像这样

源 -> Action_1 -> Action_2

  1. 我想避免任何 Action_* 反对/朝向源

来源 -> Action_1 <- Action_2

下面的 Gif 显示了我的要求

在上面的 gif 中,出现的文字是我想避免的文字

这是我尝试过的

graph.multiplicities.push(new mxMultiplicity(
   true, 'Source', null, null, 1, 1, ['Action_1','Action_2'],
   'Source can have 1 Action and from there it can be multiple',
   null));

graph.multiplicities.push(new mxMultiplicity(
    false, 'Source', null, null, 0, 0, null,
   'Source Must Have No Incoming Edge',
   null)); // Type does not matter
graph.multiplicities.push(new mxMultiplicity(
   true, 'Source', null, null, 1, 1, ['Action_1','Action_2'],
   'Source can have 1 Action and from there it can be multiple',
   null));

graph.multiplicities.push(new mxMultiplicity(
    false, 'Source', null, null, 0, 0, null,
   'Source Must Have No Incoming Edge',
   null)); // Type does not matter

这是我提到的演示https://jgraph.github.io/mxgraph/javascript/examples/validation.html ,这里是它的代码 https://github.com/jgraph/mxgraph/blob/master/javascript/examples /validation.html

这是Multiplicity参数

mxMultiplicity(source,type,attr,value,min,max,validNeighbors,countError,typeError,validNeighborsAllowed) 

这是它的文档:https : //jgraph.github.io/mxgraph/docs/js-api/files/view/mxMultiplicity-js.html

这是我尝试过的