Skip to content

Spurious GraphCycleException #3

@sgilbertson

Description

@sgilbertson

I'm working with an admittedly heavily-modified Expr4j, but I haven't touched Graph.java, and I'm getting GraphCycleExceptions like:
Circular reference found: G71 - I71 (visited: [J71, H71, I71, G71, D71, E71, $B$50])

It's happening in cases when there is no real circular reference. It seems like the problem is that "visited" as seen in Graph.checkCycle includes a whole tree of visited nodes, whereas a true circular reference would require all of the ranges in that list to be in a single line drawn through that tree.

Has anybody else looked at this issue?

In the example above:

  • J71 is used in H71, I71 and D71
  • H71 is not used in any of the other expressions
  • I71 is not used in any of the other expressions
  • G71 is used in I71
  • D71 is used in E71, G71, I71 and H71
  • E71 is used in G71
  • B50 is used in J71, E71, I71 and H71

Drawing that as a tree there's no circle, but there are branches. In the drawing below, all the lines go up and none go down, so there's no circle. Yet I get a "circular reference" exception.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions