Skip to content

Commit

Permalink
Remove topological sort as it seemed very out of place
Browse files Browse the repository at this point in the history
  • Loading branch information
erikbrinkman committed Aug 18, 2018
1 parent 0756e60 commit 506b693
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 66 deletions.
19 changes: 0 additions & 19 deletions README.md
Expand Up @@ -26,7 +26,6 @@ var dag = d3.sugiyama();
* [Hierarchy](#hierarchy)
* [Stratify](#stratify)
* [DAG](#dag) ([Node](#node))
* [Topological Sort](#topological-sort)
* [Sugiyama](#sugiyama)


Expand Down Expand Up @@ -268,15 +267,6 @@ Return `true` if *function* returns true for at least one node in the DAG.
Set the *value* of every node to be the sum of this *functions* return value on the current node's data and the value of every descendant's return value.


### Topological Sort

This function allows getting a topological ordering of the nodes.

<a name="topologicalSort" href="#topologicalSort">#</a> d3.**topologicalSort**()

Assigns each node a `value` from `0` to `node.descendants().length - 1` corresponding to a valid topological sort.


### Sugiyama

This constructs a layered representation of the DAG meant for visualization.
Expand Down Expand Up @@ -375,12 +365,3 @@ Positions nodes in each layer so that the total distance of edges is minimized.
<a name="coordMinCurve" href="#coordMinCurve">#</a> d3.**coordMinCurve**(*layers*)

Positions nodes in each layer so that the curves between nodes is minimized, and ties are broken by minimum distance.


## To Do

- Update two layer to
- Allow greedy swaps after each layer to minimize crossings.
- Allow no two layer change so just greedy minimization is run.
- Allow doing sweep up and down potentially several times.
- Add source code links. / Update documentation.
1 change: 0 additions & 1 deletion index.js
Expand Up @@ -12,7 +12,6 @@ export { default as layeringCoffmanGraham } from "./src/sugiyama/layering/coffma
export { default as layeringLongestPath } from "./src/sugiyama/layering/longestPath";
export { default as layeringSimplex } from "./src/sugiyama/layering/simplex";
export { default as sugiyama } from "./src/sugiyama/index";
export { default as topologicalSort } from "./src/topologicalSort";
export { default as twolayerMean } from "./src/sugiyama/twolayer/mean";
export { default as twolayerMedian } from "./src/sugiyama/twolayer/median";
export { default as twolayerOpt } from "./src/sugiyama/twolayer/opt";
5 changes: 4 additions & 1 deletion src/sugiyama/decross/twoLayer.js
@@ -1,7 +1,10 @@
// Order nodes using two layer algorithm
import median from "../twolayer/median";

// FIXME Add number of passes, with 0 being keep passing up and down until no changes for two passes up and down, or one pass?
// TODO Add number of passes, with 0 being keep passing up and down until no changes (is this guaranteed to never change?, maybe always terminate if no changes, so this can be set very high to almost achieve that effect)
// TODO Add optional greedy swapping of nodes after assignment
// TODO Add two layer noop. This only makes sense if there's a greedy swapping ability

export default function() {
let order = median();

Expand Down
2 changes: 2 additions & 0 deletions src/sugiyama/layering/topological.js
@@ -1,6 +1,8 @@
// Assign a value for the layer of each node that is a topological ordering
export default function() {

// TODO Add option to optimally assign layer to minimize number of dummy nodes, similar to simplex

function layeringTopological(dag) {
let layer = 0;
dag.eachBefore(n => n.layer = layer++);
Expand Down
5 changes: 0 additions & 5 deletions src/topologicalSort.js

This file was deleted.

40 changes: 0 additions & 40 deletions test/topologicalSort-test.js

This file was deleted.

0 comments on commit 506b693

Please sign in to comment.