Simple graph package for go. Uses d3js for visualization and websockets for communication.
go run test_graph/visualization.go
and visit localhost:8080 in your browser
Import it:
import "github.com/fjukstad/gographer"
Using it:
graph = gographer.New();
// (ID, NodeStringID, GroupName, Size)
graph.AddNode( 1, "NodeStringID", "GroupName", 1 )
graph.AddNode( 2, "NodeStringID", "GroupName", 1 )
// (Source, Target, EdgeID, weight )
grap.AddEdge( 1, 2, 0, 1 )
graph.AddEdge( 2, 1, 100, 15 )
graph.DumpJSON( "graph.json" )
http.ListenAndServe( ":8080", http.FileServer( http.Dir( "." ) ) )
Open localhost:8080 in a webbrowser to view the graph. Have a look at localhost:8080/canvas.html for the visualization using the HTML canvas element for rendering. Visit localhost:8080/cytoscape.html for a visualization using the cytoscape.js library.
Modify the d3js implementation and visualization to your preferences.
- gographer.go contains source code to get started with a graph library
- visualizer.go contains source code to host the visualizations
- root_serve_dir/index.html contains the empty shell for the visualization
- root_serve_dir/js/ contains source code for the visualization
- root_serve_dir/css/ contains css files for visualization
- graph.json contains the output from gographer.go (graph).