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 6819377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:17:57+00:00 2026-05-26T21:17:57+00:00

The Wiki page says Any undirected graph may be made into a DAG by

  • 0

The Wiki page says

Any undirected graph may be made into a DAG by choosing a total order for its vertices and orienting every edge from the earlier endpoint in the order to the later endpoint.

But I don’t know how to get the total order of an undirected graph. Should I use DFS? If so, how would I proceed?

More info: I’m working on an un-directed graph which has one source and one sink. I’m trying to direct these edges so that by following the edge direction I can get from the source to the sink.

  • 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-05-26T21:17:58+00:00Added an answer on May 26, 2026 at 9:17 pm

    A total order is basically just arranging all the vertices in some order — think of it as labelling each vertex with a number from 1 to |V(G)|. This gives us a consistent way to know which vertex is higher for any pair of vertices we examine.

    Yes, you can obtain a total ordering with depth-first search. Just assign each vertex the value of an incrementing counter each time you explore a vertex in DFS. This is how you can get a total ordering.

    But you don’t need to explicitly get a labelling of a total ordering to get a DAG. If we use the above time-of-exploration as our ordering, then we can proceed as follows: Orient edges as you do the DFS traversal, pointing each undirected edge away from the vertex that you’re currently expanding.

    Basically, we have vertices explored earlier pointing to vertices explored later.

    eg. if you had

      A
     / \
    B---C
    

    and you started by exploring A, you would orient edges incident on A away from A:

    A --> B
    A --> C
    B --- C
    

    Now say you choose B to explore next in your DFS traversal. Then you would leave the edge between A and B alone, because you’ve already oriented that edge (A has already been fully expanded). The edge between B and C was untouched, so orient that away from our current vertex, B, to get:

    A --> B
    A --> C
    B --> C
    

    When you explore C, all of its neighbours have been fully expanded, so there is nothing left to do for C, and there are no more vertices left to explore.

    Response to “More Info”:

    In that case, just make sure you expand the source vertex first and just don’t explore the sink. Eg. for

    A-B-C
    |/
    D
    

    where D is the source and B is the sink, you could: expand D, then A, then C. You would get:

    D --> A
    D --> B
    A --> B
    C --> B
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Kdevelop wiki says (bottom of the page) *For cases where KDevelop is still
The question look simple but i can't find any information on Firebreath's wiki page
The documentation says to look at this page: http://wiki.apache.org/solr/HowToContribute#Working_With_Patches But it hasn't been very
The note at the bottom of this Mozilla wiki page currently says: Using canvas.drawWindow()
I want link wiki-page to issue text. []() syntax links into issues pool. [[text|page]]
In the Wiki page for Sudoku solutions , one solution claims to use the
I know there is a wiki page about it , but since I'm very
I want to add a screencast to a fogbugz wiki page. Is it possible,
I created a new content type for a wiki page library. I added this
How to set custom header logo on your Track Wiki project page? How to

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.