Bug introduced in 12.1 and persisting through 12.3.1
Note: The 3rd argument of VertexInComponent was introduced in 12.1.

The code

    Graph[{v1, v2}, {v1 \[DirectedEdge] v2}], v1, {1}]

gives the correct answer {}, as there are no edges going into v1. The code

VertexInComponent[Graph[{v1, v2}, {}], v1, {1}]

obtained by removing the only edge from the previous line, gives the wrong answer {v1}. I think VertexInComponent doesn't behave properly on graphs with no edges.

I am using Mathematica 12.2.0.

  • $\begingroup$ Please do report this to Wolfram Support. It seems to me that this is a bug. I can reproduce it in M12.3 as well. Do not that the empty graph is effectively "undirected", so there's a difference there as well, but this doesn't quite explain how the problem occurs. $\endgroup$
    – Szabolcs
    Aug 5, 2021 at 14:14
  • 1
    $\begingroup$ this bug is fixed in version 13.0.0. $\endgroup$
    – kglr
    Dec 8, 2021 at 9:04


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.