Giter Club home page Giter Club logo

Comments (3)

stchang avatar stchang commented on July 21, 2024

Thanks for the report.

I'm wondering if tsort is the right function to use here? Since you already know the root, would a simple bfs give you what do want?

That being said, it still might be a good idea to add another argument for specifying a starting dfs node. It's currently possible in a roundabout way using the #:order argument, but a cleaner solution would be better. (I won't be able to get to it right away, but I'll leave this issue open in the meantime.)

from graph.

elfprince13 avatar elfprince13 commented on July 21, 2024

Yeah, I have a DAG representing a partial ordering, and need to be able to flatten it into a list consistent with that partial ordering, but only from the subgraph rooted at a particular node. Obviously one solution would just be to do a full tsort and trim the list to that node, but I'm going to be doing this a lot, and would prefer not to have the extraneous sibling nodes possibly taking up space in the list. I thought about trying to do some hacks with #:order, but suspect that would be quite inefficient.

from graph.

elfprince13 avatar elfprince13 commented on July 21, 2024

As a concrete example, let's say I have the following relationships.

B -> A
C -> A
D -> A
E -> B
E -> C
F -> D
F -> E

If I want to list the nodes in subgraph rooted at E, sorted consistently with their partial order, then one strategy would be to list out the whole graph, F D E B C A, and then trim it to just E B C A, but since F E B C D A is also a valid topological sort, I could potentially end up with E B C D A, in which D is extraneous.

from graph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.