func main(){ g := gographer.New() rand.Seed(time.Now().UTC().UnixNano()) numNodes := 50 for i := 0; i < numNodes; i++ { id := rand.Intn(numNodes) description := "Description for node " +strconv.Itoa(id) fgcolor := randomColor() bgcolor := randomColor() shape := randomShape() x := rand.Intn(500) y := rand.Intn(500) height := 50// rand.Intn(50) width := 50//rand.Intn(50) typ := randomType() name := randomName() value := randomValue() g.AddGraphicNode(id, "node "+strconv.Itoa(id), id, 1,description, fgcolor, bgcolor, shape, x, y, height, width) g.AddGraphicEdge(id,rand.Intn(numNodes),id, 1, typ,name,value) } gopath := os.Getenv( "GOPATH" ); rootServeDir := gopath + "/src/github.com/fjukstad/gographer/root_serve_dir/" log.Println("Graph created, go visit at localhost:8080") panic(http.ListenAndServe(":8080", http.FileServer(http.Dir( rootServeDir )))) }
func New() *Node_t { n := new(Node_t) nodemap := make(nodemap_t) n.Nodemap = &nodemap graph := gographer.New() n.graph = graph return n }
func main() { g := gographer.New() rand.Seed(time.Now().UTC().UnixNano()) numNodes := 50 for i := 0; i < numNodes; i++ { id := rand.Intn(numNodes) g.AddNode(id, "node "+strconv.Itoa(id), id, 1) g.AddEdge(id, rand.Intn(numNodes), id, 1) } gopath := os.Getenv("GOPATH") rootServeDir := gopath + "/src/github.com/fjukstad/gographer/root_serve_dir/" go makeRandomChanges(g) log.Println("Graph created, go visit at localhost:8080") panic(http.ListenAndServe(":8080", http.FileServer(http.Dir(rootServeDir)))) }