Initial Commit
This commit is contained in:
23
directedGraph.go
Normal file
23
directedGraph.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
const SIZE_GRAPH int = 10
|
||||
|
||||
type DirectedGraph struct {
|
||||
count int
|
||||
nodes [SIZE_GRAPH]Node
|
||||
Head *Node
|
||||
}
|
||||
|
||||
func (self *DirectedGraph) AddNode(node *Node) {
|
||||
|
||||
if self.count > SIZE_GRAPH {
|
||||
panic("Graph has gotten too big")
|
||||
}
|
||||
|
||||
if self.Head == nil && self.count == 0 {
|
||||
self.Head = node
|
||||
}
|
||||
|
||||
self.nodes[self.count] = *node
|
||||
self.count++
|
||||
}
|
||||
Reference in New Issue
Block a user