Skip to content

Instantly share code, notes, and snippets.

View iamSahdeep's full-sized avatar
:shipit:
Focusing

Sahdeep Singh iamSahdeep

:shipit:
Focusing
View GitHub Profile
@iamSahdeep
iamSahdeep / graph-component-size-count.dart
Created March 4, 2022 20:51
Dart implementation of counting the number of components in the graph and finding the size of the largest component in it.
/// find the number of connected components within the undirected graph.
/// Component is independent or individual graph within the graph-network
/// Also getting the size of the largest component in it.
const graph = {
0: [8, 1, 5],
1: [0],
5: [0, 8],
8: [0, 5],
2: [3, 4],
3: [2, 4],
@iamSahdeep
iamSahdeep / graph-has-path-problem.dart
Created March 4, 2022 18:14
Has-Path problem for both Unidirectional and Bidirectional Graphs, dart implementation.
/// A HAS-PATH problem, Given source and destination
/// find if there exist any path between them in the
/// acyclic/Directed/Unidirectional Graph,
/// also cyclic/undirected/bidirectional graph.
const graphDirected = {
"f": ["g", "i"],
"g": ["h"],
"h": [],
"i": ["g", "k"],
@iamSahdeep
iamSahdeep / bfs-dfs-dart.dart
Last active March 3, 2022 17:28
Breadth First Traversal + Depth First Traversal implemented in Dart (Recursive and Iterative both)
import 'dart:collection';
const graph = {
"a": ["b", "c"],
"b": ["d"],
"c": ["e"],
"d": ["f"],
"e": [],
"f": [],
};
@iamSahdeep
iamSahdeep / AnimatedGrid
Last active July 12, 2021 12:28
AnimatedGrid to convert Grid into List with Animation. Somewhat like this : https://i.stack.imgur.com/HtR9K.gif
// AnimatedGrid : Transforming Grid to List
// Somewhat like this : https://i.stack.imgur.com/HtR9K.gif
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@iamSahdeep
iamSahdeep / liquid_swipe_example.dart
Created May 7, 2021 14:59
A liquid swipe example gist
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:liquid_swipe/liquid_swipe.dart';
import 'package:flutter/scheduler.dart' show timeDilation;
void main() {
/// Comment or uncomment to run both examples
runApp(
//WithBuilder(),
WithPages()
@iamSahdeep
iamSahdeep / Flutter Web Custom Cursors
Created July 27, 2020 05:56
Simple example to convert your widget into the Mouse Cursor in Flutter Web
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(
MaterialApp(
theme: ThemeData(scaffoldBackgroundColor: darkBlue),