[ 
https://issues.apache.org/jira/browse/BEAM-3891?focusedWorklogId=82390&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-82390
 ]

ASF GitHub Bot logged work on BEAM-3891:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 20/Mar/18 18:22
            Start Date: 20/Mar/18 18:22
    Worklog Time Spent: 10m 
      Work Description: tgroh commented on a change in pull request #4907: 
[BEAM-3891] Add a suborder parameter to Networks#topologicalOrder
URL: https://github.com/apache/beam/pull/4907#discussion_r175874852
 
 

 ##########
 File path: 
runners/core-construction-java/src/main/java/org/apache/beam/runners/core/construction/graph/Networks.java
 ##########
 @@ -144,7 +146,18 @@ public final NodeT apply(NodeT input) {
   }
 
   /** Returns a set of nodes sorted in topological order. */
-  public static <NodeT, EdgeT> Iterable<NodeT> topologicalOrder(Network<NodeT, 
EdgeT> network) {
+  public static <NodeT> Iterable<NodeT> topologicalOrder(Network<NodeT, ?> 
network) {
+    return topologicalOrder(network, null);
+  }
+
+  /**
+   * Returns a set of nodes sorted in topological order.
+   *
+   * <p>The {@code nodeSubOrder} is used to provide a stable order over which 
to consider the nodes.
+   * If {@code nodeSubOrder} is null, the nodes are considered in arbitrary 
order.
+   */
+  public static <NodeT> Iterable<NodeT> topologicalOrder(
+      Network<NodeT, ?> network, @Nullable Comparator<? super NodeT> 
nodeSubOrder) {
 
 Review comment:
   Basically done - moved `topologicalOrder` to an internal method 
('`computeTopologicalOrder`') and created the network that's the same, but 
explicitly has the comparator as the node order

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 82390)
    Time Spent: 1h  (was: 50m)

> There should be some way to perform a Topological Sort with a stable output
> ---------------------------------------------------------------------------
>
>                 Key: BEAM-3891
>                 URL: https://issues.apache.org/jira/browse/BEAM-3891
>             Project: Beam
>          Issue Type: Bug
>          Components: runner-core
>            Reporter: Thomas Groh
>            Assignee: Thomas Groh
>            Priority: Major
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> This really means that there is some way to produce the same iterable, order 
> included, based on some property of the nodes. This can be done via 
> performing a sort before the elements are added to the collection of nodes 
> under consideration.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to