Warning: this section has not been implemented and presents only the conceptual idea of the implementation.
Ordering amendments in voting order is a time-consuming task. The order is defined by a set of rules. This problem can be solved with a topological sort with constraints. The conceptual algorithm is straightforward:
Gather all amendments graphs extracted from the amendment document.
Create a fictitious root node in the merged graph Gm.
For each graph Ga in the gathered amendments graphs:
Add to- or reuse in Gm the location nodes in Gm for each location part in Ga.
Add to- or reuse in Gm the action node.
Add the amendment node to Gm.
Assign weights to all the location and action nodes.
Sort the amendment nodes based on the weight of the shortest path to the root node.
Once the amendment nodes are sorted it is easy to create the ordered list as the system thinks it should be. The system can then use that ordered list to determine whether it differs from the current ordering in the amendment document and warn the user if they differ.
The tricky part of such an implementation is not the algorithm: it is understanding the ordering rules and defining a weighting scheme based on those rules. These ordering rules are different for each legal system. It may very well be that for some systems it may not be possible to express the rules as a weighting scheme. In all cases, the final order must be left to the user.