Documentation
¶
Overview ¶
Package graphalg implements a set of structs and interfaces for running graph algorithms over sets of nodes and edges.
Package graphalg is a generated protocol buffer package.
It is generated from these files:
graphalg.proto
It has these top-level messages:
Weight Message SendMessageRequest Error SendMessageResponse TestMessage EdgeWeightRequest EdgeWeightResponse
Index ¶
- Variables
- func Join(n1 *Node, n2 *Node, w float64, f SenderRecieverMaker)
- func MakeChanPair() (SenderReciever, SenderReciever)
- func MakeDelayChanPair(d time.Duration) (SenderReciever, SenderReciever)
- func NewEdge(f SenderRecieverMaker) (*Edge, *Edge)
- func RegisterMessage(i interface{}) string
- func RegisterMessageServiceServer(s *grpc.Server, srv MessageServiceServer)
- func Run(a NodeAlgorithm, onDone func())
- type Base
- type ByMinEdge
- type Closer
- type Dispatcher
- type Doner
- type Edge
- type EdgeWeightRequest
- type EdgeWeightResponse
- type Edges
- type Error
- type Message
- type MessageMarshaler
- type MessageServiceClient
- type MessageServiceServer
- type Node
- func (n *Node) ClearQueue()
- func (n *Node) Edge(j int) *Edge
- func (n *Node) Edges() Edges
- func (n1 *Node) Join(n2 *Node, w float64, f SenderRecieverMaker)
- func (n *Node) Log(s string)
- func (n *Node) MinEdge() int
- func (n *Node) NodeUpdate(s string)
- func (n *Node) Print(v ...interface{})
- func (n *Node) Printf(str string, v ...interface{})
- func (n *Node) Println(v ...interface{})
- func (n *Node) Queue(e int, d interface{})
- func (n *Node) Queued() []QueuedMessage
- func (n *Node) Send(e int, d MessageMarshaler)
- type NodeAlgorithm
- type NodeID
- type QueuedMessage
- type Queuer
- type Reciever
- type SendMessageRequest
- func (*SendMessageRequest) Descriptor() ([]byte, []int)
- func (m *SendMessageRequest) GetAid() *graph.AlgorithmID
- func (m *SendMessageRequest) GetGid() *graph.GraphID
- func (m *SendMessageRequest) GetMsg() *Message
- func (*SendMessageRequest) ProtoMessage()
- func (m *SendMessageRequest) Reset()
- func (m *SendMessageRequest) String() string
- type SendMessageResponse
- type Sender
- type SenderReciever
- type SenderRecieverMaker
- type TestMessage
- type Weight
Constants ¶
This section is empty.
Variables ¶
View Source
var WeightInf = Weight{Cost: math.Inf(1)}
WeightInf is an edge with infinite weight
Functions ¶
func MakeChanPair ¶
func MakeChanPair() (SenderReciever, SenderReciever)
MakeChanPair is an edge sender/reciever built using a channel
func MakeDelayChanPair ¶
func MakeDelayChanPair(d time.Duration) (SenderReciever, SenderReciever)
func NewEdge ¶
func NewEdge(f SenderRecieverMaker) (*Edge, *Edge)
func RegisterMessage ¶
func RegisterMessage(i interface{}) string
func RegisterMessageServiceServer ¶
func RegisterMessageServiceServer(s *grpc.Server, srv MessageServiceServer)
func Run ¶
func Run(a NodeAlgorithm, onDone func())
Types ¶
type Dispatcher ¶
type Dispatcher interface { Dispatch(edge int, m interface{}) Edges() Edges Queued() []QueuedMessage ClearQueue() }
type Edge ¶
type Edge struct { Weight Weight Disabled bool SenderReciever // contains filtered or unexported fields }
func (*Edge) EdgeMessage ¶
func (e *Edge) EdgeMessage(s string, d tracer.MessageDir)
func (*Edge) EdgeUpdate ¶
func (e *Edge) EdgeUpdate()
func (*Edge) Send ¶
func (e *Edge) Send(m MessageMarshaler)
type EdgeWeightRequest ¶
type EdgeWeightRequest struct { From string `protobuf:"bytes,1,opt,name=From,json=from" json:"From,omitempty"` To string `protobuf:"bytes,2,opt,name=To,json=to" json:"To,omitempty"` Gid *graph.GraphID `protobuf:"bytes,3,opt,name=gid" json:"gid,omitempty"` Weight *Weight `protobuf:"bytes,4,opt,name=weight" json:"weight,omitempty"` }
func (*EdgeWeightRequest) Descriptor ¶
func (*EdgeWeightRequest) Descriptor() ([]byte, []int)
func (*EdgeWeightRequest) GetGid ¶
func (m *EdgeWeightRequest) GetGid() *graph.GraphID
func (*EdgeWeightRequest) GetWeight ¶
func (m *EdgeWeightRequest) GetWeight() *Weight
func (*EdgeWeightRequest) ProtoMessage ¶
func (*EdgeWeightRequest) ProtoMessage()
func (*EdgeWeightRequest) Reset ¶
func (m *EdgeWeightRequest) Reset()
func (*EdgeWeightRequest) String ¶
func (m *EdgeWeightRequest) String() string
type EdgeWeightResponse ¶
type EdgeWeightResponse struct { Error *Error `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` Weight *Weight `protobuf:"bytes,2,opt,name=weight" json:"weight,omitempty"` }
func (*EdgeWeightResponse) Descriptor ¶
func (*EdgeWeightResponse) Descriptor() ([]byte, []int)
func (*EdgeWeightResponse) GetError ¶
func (m *EdgeWeightResponse) GetError() *Error
func (*EdgeWeightResponse) GetWeight ¶
func (m *EdgeWeightResponse) GetWeight() *Weight
func (*EdgeWeightResponse) ProtoMessage ¶
func (*EdgeWeightResponse) ProtoMessage()
func (*EdgeWeightResponse) Reset ¶
func (m *EdgeWeightResponse) Reset()
func (*EdgeWeightResponse) String ¶
func (m *EdgeWeightResponse) String() string
type Error ¶
type Error struct { Error int32 `protobuf:"varint,1,opt,name=error" json:"error,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg" json:"msg,omitempty"` }
func (*Error) Descriptor ¶
func (*Error) ProtoMessage ¶
func (*Error) ProtoMessage()
type Message ¶
type Message struct {
Payload *google_protobuf.Any `protobuf:"bytes,4,opt,name=Payload,json=payload" json:"Payload,omitempty"`
}
func (*Message) Descriptor ¶
func (*Message) GetPayload ¶
func (m *Message) GetPayload() *google_protobuf.Any
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
type MessageMarshaler ¶
type MessageServiceClient ¶
type MessageServiceClient interface { SendMessage(ctx context.Context, in *SendMessageRequest, opts ...grpc.CallOption) (*SendMessageResponse, error) EdgeWeight(ctx context.Context, in *EdgeWeightRequest, opts ...grpc.CallOption) (*EdgeWeightResponse, error) }
func NewMessageServiceClient ¶
func NewMessageServiceClient(cc *grpc.ClientConn) MessageServiceClient
type MessageServiceServer ¶
type MessageServiceServer interface { SendMessage(context.Context, *SendMessageRequest) (*SendMessageResponse, error) EdgeWeight(context.Context, *EdgeWeightRequest) (*EdgeWeightResponse, error) }
func NewGRPCServer ¶
func NewGRPCServer() MessageServiceServer
type Node ¶
func (*Node) ClearQueue ¶
func (n *Node) ClearQueue()
func (*Node) NodeUpdate ¶
func (*Node) Queued ¶
func (n *Node) Queued() []QueuedMessage
func (*Node) Send ¶
func (n *Node) Send(e int, d MessageMarshaler)
Send - send a message to the specified
type NodeAlgorithm ¶
type NodeAlgorithm interface { Dispatcher Doner }
type QueuedMessage ¶
type QueuedMessage struct {
// contains filtered or unexported fields
}
type SendMessageRequest ¶
type SendMessageRequest struct { From string `protobuf:"bytes,1,opt,name=From,json=from" json:"From,omitempty"` To string `protobuf:"bytes,2,opt,name=To,json=to" json:"To,omitempty"` Gid *graph.GraphID `protobuf:"bytes,3,opt,name=gid" json:"gid,omitempty"` Aid *graph.AlgorithmID `protobuf:"bytes,4,opt,name=aid" json:"aid,omitempty"` Msg *Message `protobuf:"bytes,5,opt,name=msg" json:"msg,omitempty"` }
func (*SendMessageRequest) Descriptor ¶
func (*SendMessageRequest) Descriptor() ([]byte, []int)
func (*SendMessageRequest) GetAid ¶
func (m *SendMessageRequest) GetAid() *graph.AlgorithmID
func (*SendMessageRequest) GetGid ¶
func (m *SendMessageRequest) GetGid() *graph.GraphID
func (*SendMessageRequest) GetMsg ¶
func (m *SendMessageRequest) GetMsg() *Message
func (*SendMessageRequest) ProtoMessage ¶
func (*SendMessageRequest) ProtoMessage()
func (*SendMessageRequest) Reset ¶
func (m *SendMessageRequest) Reset()
func (*SendMessageRequest) String ¶
func (m *SendMessageRequest) String() string
type SendMessageResponse ¶
type SendMessageResponse struct {
Error *Error `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"`
}
func (*SendMessageResponse) Descriptor ¶
func (*SendMessageResponse) Descriptor() ([]byte, []int)
func (*SendMessageResponse) GetError ¶
func (m *SendMessageResponse) GetError() *Error
func (*SendMessageResponse) ProtoMessage ¶
func (*SendMessageResponse) ProtoMessage()
func (*SendMessageResponse) Reset ¶
func (m *SendMessageResponse) Reset()
func (*SendMessageResponse) String ¶
func (m *SendMessageResponse) String() string
type Sender ¶
type Sender interface {
Send(MessageMarshaler)
}
type SenderReciever ¶
func MakeGRPCEdge ¶
func MakeGRPCEdge(g graph.GraphID, a graph.AlgorithmID) SenderReciever
MakeGRPCEdge is an edge sender/reciever built using a channel
type SenderRecieverMaker ¶
type SenderRecieverMaker func() (SenderReciever, SenderReciever)
type TestMessage ¶
type TestMessage struct {
Value int32 `protobuf:"varint,1,opt,name=Value,json=value" json:"Value,omitempty"`
}
func (*TestMessage) Descriptor ¶
func (*TestMessage) Descriptor() ([]byte, []int)
func (*TestMessage) ProtoMessage ¶
func (*TestMessage) ProtoMessage()
func (*TestMessage) Reset ¶
func (m *TestMessage) Reset()
func (*TestMessage) String ¶
func (m *TestMessage) String() string
type Weight ¶
type Weight struct { Cost float64 `protobuf:"fixed64,1,opt,name=Cost,json=cost" json:"Cost,omitempty"` Lsn string `protobuf:"bytes,2,opt,name=Lsn,json=lsn" json:"Lsn,omitempty"` Msn string `protobuf:"bytes,3,opt,name=Msn,json=msn" json:"Msn,omitempty"` }
func (*Weight) Descriptor ¶
func (*Weight) ProtoMessage ¶
func (*Weight) ProtoMessage()
Click to show internal directories.
Click to hide internal directories.