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

  • Home
  • SEARCH
  • 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 7762993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:33:09+00:00 2026-06-01T14:33:09+00:00

Happy easters, everyone. I am currently learning topological sort and having a question about

  • 0

Happy easters, everyone.

I am currently learning topological sort and having a question about what topological sort tries to really sort.

The Algorithm Design Manual describes topological sort in this way:

Topological sorting is the most important operation on directed acyclic graphs (DAGs). It orders the vertices on a line such that all directed edges go from left to right.

This bold part confuses me. So does the topological sorting sort vertices or all directed edges?

Let’s take an example which is also in the book.

A DAG

So for the above DAG, we can get a topological sort (G, A, B, C, F, E, D).

I can understand this sort. Not only the vertices are sorted, but the edges are also sorted, i.e., G->A->B->C->F->E->D, this matches the above ADM book description: all directed edges go from left to right

But what if I remove the edge of B->C? The resulting graph is still a DAG, but will the topological sort is still (G, A, B, C, F, E, D)?

If it is Yes, then I think the edges are not sorted, as A->B->C does not exist any more, instead, it is A->B and A->C. So, it this case still a valid topological sort? Can we still
think (G, A, B, C, F, E, D) is a valid sort even if A is the parent of B and C?

Thanks

  • 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-01T14:33:11+00:00Added an answer on June 1, 2026 at 2:33 pm

    You can think of it as orderring of elements.

    let v1,v2,…,vn be elements. and let an edge (vi,vj) denote that vi<vj. topological sort guarantees that after the sorting: for every vi, and for every vj such that i < j, vj is not greater then vi

    Or in other notations: assume (vi,vj) indicate that vj is dependent on vi, topological sorts guarantees that each element “does not depend” on any elements that appears after it in the sort.

    So does the topological sorting sort vertices or all directed edges?

    topological sort sorts vertices, not edges. It uses edges as constraints for sorting the vertices.

    But what if I remove the edge of B->C?

    yes, every edge you add, just add a constraint. Note that there could be more then one feasible solution for topological sort [for example, for a graph without edges, any permutation is a feasible solution]. removing a constraint, makes any previous solution, which “solves a harder problem” still feasible.

    Can we still think (G, A, B, C, F, E, D) is a valid sort even if A is
    the parent of B and C?

    There is no problem with that! A appears before B,C in the topological sort, so there is no problem it is their father.

    Hope that makes it a bit more clear.

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

Sidebar

Related Questions

I'm a happy user of DevExpress components, though currently I'm still on a linux
Happy Friday SO! I'm building a multi-WinForm application and am having some troubles. I
Happy Friday. Having an interesting time debugging a zombie issue. I have a UITableView
Happy New Year 2010 everyone :) Just getting back into the Flash groove, and
I'm not really happy with the built-in JSF resource bundle possibilities, like: <h:outputFormat value=#{messages['form.label.create']}>
Happy Friday! I assume somebody out there has a simple answer to this question
I'm not really happy with my methods to build a tree structure in my
Happy New Year Everyone! I have this existing php code I did when I
I am really happy that I got my work in Java programming, and I
Happy coding weekend to everyone!!!. I'm stuck trying to send a JSON object via

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.