Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8390485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:00:02+00:00 2026-06-09T19:00:02+00:00

I am implementing (considering it actually) a control that allows users to create a

  • 0

I am implementing (considering it actually) a control that allows users to create a web diagram out of a series of nodes. The purpose will be to create a “flow chart” of sorts out of a series of questions to be asked by another part of the software; for each question, the answer chosen determines which question should be asked next. It’s a little FSMish but much smarter than a linear progression of questions of the form “If you answered X to question Y, please answer the following…”. The graph is a web and not guaranteed to be a tree, because the user defining the graph may want to ask a couple follow-up questions and then return to the “normal” line of questioning, thus two different nodes may “merge” to the same child node. However, the web is guaranteed not to be circular and to have one starting point, thus there are a finite number of paths through the graph and all of a finite length.

Here’s the question. I would like to have an “arrange” button (or simply auto-arrange) that rearranges the nodes so that the number of lines connecting nodes of the web that have to cross each other is minimized. Most flow-charting tools have a feature to do this, but my Google-fu has failed to find a general-purpose algorithm of this type. I’ve identified it as the “crossing number” problem, but it appears that there is no general solution to finding the minimal crossing number of a graph with V nodes and E paths, and that any such solution would be NP-hard (if a particular sub-problem could be solved in a single operation, then the full problem can be solved in polynomial time). On top of that, none of the references I’ve found detail algorithms that can lay out a graph with a minimal (to say nothing of “minimum”) crossing number.

Any hints?

EDIT: I gave Sharkos the tick for his excellent references. However, assuming that the graph has a definite start point, is one-way and non-circular, a working algorithm (maybe not optimal) is actually pretty simple. In pseudocode:

"
Give all nodes an initial XScore, YScore and LinkScore of 0
Determine the start node (either designated, or the one not linked to by any other)
Set start node's XScore and YScore to 1
Set running YScore = 1
Start recursion
for each path from node
   if node on other end has XScore <= current      
      set other node's XScore to current + 1
   if node on other end has YScore <= running YScore
      set other node's YScore to running YScore
      increment other node's LinkScore
   Recurse with node on other end
   Increment running YScore

Order nodes by XScore, then YScore.

--If the graph happens to be planar, we're done.

--To minimize crossover:

for each XScore
   for each node with that XScore
      if the next node with the same XScore has a higher LinkScore
         swap the two nodes, exchanging YScores
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:00:05+00:00Added an answer on June 9, 2026 at 7:00 pm

    Here’s a Master’s thesis on the topic, which gives some algorithms with discussion, and which gives references to lots and lots of different people’s approaches, from exact algorithms to approximation algorithms.

    However, for a fairly simple, concrete pseudocode version of the ‘planarization method’, apparently (not an expert, though I have studied graph theory and it sounds plausibly useful) a common approximation, see section 2.5 in this chapter from the Handbook of Graph Drawing and Visualization, which is freely available online.

    Hopefully that’s the sort of thing you wanted?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to database design and I considering implementing something that will be time
I am considering implementing a Facebook-integration to my web app. I want to be
I'm considering implementing Facebook's comments plugin on my site. The problem is that I
Do applet javascript calls serialize in any proper way? I'm considering implementing a model
Implementing a custom membership provider, there are certain properties such as MinRequiredPasswordLength that only
when implementing a recursive function during development, i will use a counter and exit
Before implementing j_security_check using MySQL realm authentication in my web app. I had the
I'm implementing a coherent noise function, and was surprised to find that using gradient
The Memento Pattern itself seems pretty straight forward. I'm considering implementing the same as
We're implementing a new solution in our classic ASP environment that's using COM interop

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.