Hi,
I need to find out the self_loop count and loop count of the selected node in my diagram
Example :
It really depends on what you mean by “loop count”. Does this do what you want?
let reflexives = 0;
let simpleloops = 0;
node.findLinksOutOf().each(l => {
const other = l.toNode;
if (!other) return;
if (other === node) {
reflexives++;
} else {
other.findLinksOutOf().each(l2 => {
if (l2.toNode === node) simpleloops++;
});
}
});
If not, you can adapt the code to satisfy your requirements.