Keyword | CPC | PCC | Volume | Score | Length of keyword |
---|---|---|---|---|---|

geeksforgeeks topological sort | 0.13 | 0.8 | 6165 | 31 | 30 |

geeksforgeeks | 0.12 | 0.2 | 1897 | 16 | 13 |

topological | 0.92 | 0.7 | 3932 | 7 | 11 |

sort | 1.65 | 0.3 | 3216 | 98 | 4 |

Keyword | CPC | PCC | Volume | Score |
---|---|---|---|---|

geeksforgeeks topological sort | 0.35 | 0.8 | 70 | 63 |

geeksforgeeks topological sorting | 2 | 0.2 | 9766 | 97 |

For example, a topological sorting of the following graph is “5 4 2 3 1 0”. There can be more than one topological sorting for a graph. For example, another topological sorting of the following graph is “4 5 2 3 1 0”.

Topological Sorting for a graph is not possible if the graph is not a DAG. For example, a topological sorting of the following graph is “5 4 2 3 1 0?. There can be more than one topological sorting for a graph. For example, another topological sorting of the following graph is “4 5 2 0 3 1″.

Last Updated : 05 Mar, 2021 Topological sorting for Directed Acyclic Graph (DAG) is a linear ordering of vertices such that for every directed edge u v, vertex u comes before v in the ordering. Topological Sorting for a graph is not possible if the graph is not a DAG. For example, a topological sorting of the following graph is “5 4 2 3 1 0”.

Explanation: The topological sorting of a DAG is done in a order such that for every directed edge uv, vertex u comes before v in the ordering. 5 has no incoming edge. 4 has no incoming edge, 2 and 0 have incoming edge from 4 and 5 and 1 is placed at last.