Documentation ¶
Overview ¶
go-grapher creates a graph using golang code. The visuaslization is outputed to html with d3. The data from d3 is updated via websockets. No need to refresh the page.
We have updated the websocket to use the std lib and consolidated the methods into a single golang package.
by Ray Bernard This program is a fork from https://github.com/fjukstad/gographer
Index ¶
- type AddEdgeMessage
- type AddNodeMessage
- type Client
- type Edge
- type EdgeGraphics
- type Graph
- func (g *Graph) AddEdge(from, to, id, weight int)
- func (g *Graph) AddGraphicEdge(from, to, id, weight int, typ, name, value string)
- func (g *Graph) AddGraphicNode(id int, name string, group int, size int, description string, fgcolor string, ...)
- func (g *Graph) AddNode(id int, name string, group int, size int)
- func (g *Graph) BroadcastAddEdge(e Edge)
- func (g *Graph) BroadcastAddNode(n Node)
- func (g *Graph) BroadcastRemoveEdge(e Edge)
- func (g *Graph) BroadcastRemoveNode(n Node)
- func (g *Graph) BroadcastRenameNode(n Node)
- func (g *Graph) DumpJSON(filename string)
- func (g *Graph) GetNumberOfNodes() (numberOfNodes int)
- func (g *Graph) Handler(conn *websocket.Conn)
- func (g *Graph) RemoveEdge(from, to, id int)
- func (g *Graph) RemoveNode(nodeId int)
- func (g *Graph) RenameNode(nodeId int, name string)
- func (g *Graph) ServerInfo() string
- type InitGraphMessage
- type Node
- type NodeGraphics
- type RemoveEdgeMessage
- type RemoveNodeMessage
- type SetNodeNameMessage
- type WSConnHandler
- type WSServer
- type WriteToJSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddEdgeMessage ¶
type AddNodeMessage ¶
type Edge ¶
type Edge struct { Source int `json:"source,int"` Target int `json:"target,int"` Id int `json:"id,int"` Weight int `json:"weight,int"` Graphics EdgeGraphics `json:"graphics,omitempty"` // contains filtered or unexported fields }
type EdgeGraphics ¶
type Graph ¶
type Graph struct { Nodes map[string]*Node `json:"nodes,omitempty"` Edges map[string]*Edge `json:"edges,omitempty"` // contains filtered or unexported fields }
gographer.go Begin
func NewGraphAt ¶
The functionality of starting wsserver on specified port
func (*Graph) AddEdge ¶
Add edge between Source and Target Edge is uniquely identified by tuple (source, target, id)
func (*Graph) AddGraphicEdge ¶
func (*Graph) AddGraphicNode ¶
func (*Graph) BroadcastAddEdge ¶
func (*Graph) BroadcastAddNode ¶
func (*Graph) BroadcastRemoveEdge ¶
func (*Graph) BroadcastRemoveNode ¶
func (*Graph) BroadcastRenameNode ¶
func (*Graph) GetNumberOfNodes ¶
func (*Graph) Handler ¶
This is invoked first for all new connections. * Output current graph state before giving out updates
func (*Graph) RemoveEdge ¶
func (*Graph) RemoveNode ¶
func (*Graph) RenameNode ¶
func (*Graph) ServerInfo ¶
type InitGraphMessage ¶
type InitGraphMessage struct { Command string `json:"command,string"` Graph string `json:"graph,string"` }
Communication.go Begin
type Node ¶
type Node struct { Id int `json:"id,int"` Name string `json:"name,string"` Group string `json:"group,string"` Size int `json:"size,int"` Graphics NodeGraphics `json:"graphics,omitempty"` // contains filtered or unexported fields }
type NodeGraphics ¶
type RemoveEdgeMessage ¶
type RemoveNodeMessage ¶
type SetNodeNameMessage ¶
type WSConnHandler ¶
type WSServer ¶
type WSServer struct { Hub *hub Server *http.Server Conn *connection ConnHandler WSConnHandler }
func (*WSServer) GetServerInfo ¶
func (*WSServer) SetConnectionHandler ¶
func (s *WSServer) SetConnectionHandler(connHandler WSConnHandler)
connHandler is an optional connection handler that may be registered * to receive new connections before they are attached to the hub. * Can be nil if no connection handler is desired.