Code Monkey home page Code Monkey logo

graph's Introduction

Graph

Single Source Shortest Path(SSSP)

  1. BFS: O(V+E)
  2. Dijkstra[Using Priority Queue(Best)]: O((V+E)logV)
  3. Dijkstra[Using set(when update is required)]: O((V+E)logV)
  4. Bellman-Ford: O(VE)

All Pair Shortest Path

  1. Floyd-Warshall: O(N^3)

Topological Sort

  1. Topological sort[Using BFS]
  2. Topological sort[Using DFS]
  3. Questions:
    1. https://codeforces.com/problemset/problem/825/E

Disjoint Set (Union-Find) Data Structure

  1. DSU using size
  2. DSU using rank

Problems:

  1. city and flood
  2. city and campers
  3. city and fireman vincent
  4. city and soldiers
  5. city and campers 2
  6. colourful array Nice problem🔥🔥🤯🤯
  7. Remove Max Number of Edges to Keep Graph Fully Traversable

Cycle Detection

  1. Khan's Algorithm[BFS for topological sort]: It only works for Directed Graph.
  2. Union-Find Method: Uses the Union-Find data structure to detect cycles during the union operation. It only works for an Un-Directed Graph
  3. DFS Method: Uses depth-first search to detect back edges. It works for both.

Minimum Spanning Tree(MST)

  1. Prim's Algo
  2. Cruskal's Algo

Strongly connected components(scc) -> Kosaraju Algo: follow three steps:

  1. Sort the nodes on the basis of finishing time of dfs.
  2. Reverese the edges
  3. Run the dfs on nodes in their sorted finishing time.
  4. Code

Problem Patterns

  1. Graph Coloring

graph's People

Contributors

chhipanikhil9 avatar

Watchers

 avatar

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.