Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

splits secondary rank between internet only and internet plus others #123

Merged
merged 1 commit into from May 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/layouts/ltrTreeLayout/ranker.js
Expand Up @@ -56,10 +56,8 @@ function normalizeRanks (graph) {

function forcePrimaryRankPromotions (graph, entryNodeName = 'INTERNET') {
let entryNodes = graph.entryNodes();
if (entryNodeName) {
if (entryNodes.includes(entryNodeName)) {
entryNodes = [entryNodeName];
}
if (entryNodes.includes(entryNodeName)) {
entryNodes = [entryNodeName];
}
for (let i = 0; i < entryNodes.length; i++) {
const entryNode = graph.getNode(entryNodes[i]);
Expand All @@ -69,16 +67,18 @@ function forcePrimaryRankPromotions (graph, entryNodeName = 'INTERNET') {

function forceSecondaryRankPromotions (graph, entryNodeName = 'INTERNET') {
let entryNodes = graph.entryNodes();
if (entryNodeName) {
if (entryNodes.includes(entryNodeName)) {
entryNodes = [entryNodeName];
}
if (entryNodes.includes(entryNodeName)) {
entryNodes = [entryNodeName];
}
for (let i = 0; i < entryNodes.length; i++) {
const outgoingNodes = graph.outgoingNodes(entryNodes[i]);
for (let j = 0; j < outgoingNodes.length; j++) {
const node = graph.getNode(outgoingNodes[j]);
node.rank = 1;
if (graph.incomingNodes(node.name).length === 1) {
node.rank = 1;
} else {
node.rank = 2;
}
}
}
}
Expand Down