java - determine if two vertices are connected jGraphX -


is there method determine if 2 vertices connected in jgraphx? method isconnectable() returns true if vertex connected.

you can check checking edges. in example, being cell1 first cell have , cell2 cell want check if connected cell1.

for (int = 0; < cell1.getedgecount(); i++) {    mxcell source = ((mxcell) cell1.getedgeat(i)).getsource();    mxcell target = ((mxcell) cell1.getedgeat(i)).gettarget();    if (source == cell2 || target == cell2)        return true;    else        return false; } 

you need check both source , target 'cause can't sure if cell1 source or target in iteration. way, iterate every cell connected cell1 , checks if equal second cell.


Comments