Skip to content

Instantly share code, notes, and snippets.

@rishabh625
rishabh625 / markdown-details-collapsible.md
Created November 29, 2021 15:24 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
func getShortestPath(startNode *Node, endNode *Node, g *ItemGraph) ([]string, int) {
visited := make(map[string]bool)
dist := make(map[string]int)
prev := make(map[string]string)
//pq := make(PriorityQueue, 1)
//heap.Init(&pq)
q := NodeQueue{}
pq := q.NewQ()
start := Vertex{
Node: startNode,
@rishabh625
rishabh625 / graph.go
Created August 22, 2021 15:14
create graph
type ItemGraph struct {
Nodes []*Node
Edges map[Node][]*Edge
Lock sync.RWMutex
}
// AddNode adds a node to the graph
func (g *ItemGraph) AddNode(n *Node) {
g.Lock.Lock()
package datastruct
// Enqueue adds an Node to the end of the queue
func (s *NodeQueue) Enqueue(t Vertex) {
s.Lock.Lock()
if len(s.Items) == 0 {
s.Items = append(s.Items, t)
s.Lock.Unlock()
return
}