I have a graph
Since I can go from 1 to 2 to 3 (i.e. from 1 to 3 through 2), the edge from 1 to 3 is unnecessary.
Therefore, I want to remove the edge directly between 1 and 3.
How would I do this? I guess I should do breadth-first search to decide where I can go from 1.
So if I have all my nodes and edges
nodes = [1, 2, 3]
edges = [
{source: 1, target: 2},
{source: 1, target: 3},
{source: 2, target: 3}
]
I want to remove
{source: 1, target: 3},
since it is unnecessary because of transitivity, but how could I determine whether I should remove
{source: 1, target: 3},
instead of
{source: 2, target: 3}
?