package gograph
import "bitbucket.org/ww/gograph"


type DiGraph struct {
    // contains unexported fields
Directed Graph

func (dg *DiGraph) AddEdge(l uint64, r uint64, e interface{})
Add an edge to the graph. The third value is an annotation for
the edge which may be nil

func (dg *DiGraph) Degree(n uint64) int
Calculate the degree of a node, in-degree + out-degree

func (dg *DiGraph) DelEdge(l uint64, r uint64)
Remove an edge from the graph

func (dg *DiGraph) Empty() bool
Return true if the graph is empty

func (dg *DiGraph) GetEdge(l uint64, r uint64) (interface{}, bool)
Return the annotation on the edge if present in the graph

func (dg *DiGraph) HasEdge(l uint64, r uint64) bool
Check if the given edge is in the graph

func (dg *DiGraph) InDegree(n uint64) int
Calculate the in-degree of the given node - this is an inefficient
implementation in order to save space by not having a reverse

func (g *DiGraph) Neighbours(n uint64) (out chan uint64)
Return map of neighbours and the annotation on the connecting

func (dg *DiGraph) Nodes() (out chan uint64)
Put the nodes in the graph out the channel. May contain
duplicates... TODO minimise duplicates with bloom filter

func (dg *DiGraph) Order() int
Return the number of nodes in the graph

func (dg *DiGraph) OutDegree(n uint64) int
Calculate the out-degree of the given node

type Graph interface {
    Order() int
    Empty() bool
    Nodes() chan uint64
    AddEdge(uint64, uint64, interface{})
    DelEdge(uint64, uint64)
    HasEdge(uint64, uint64) bool
    GetEdge(uint64, uint64) (interface{}, bool)
    OutDegree(uint64) int
    InDegree(uint64) int
    Degree(uint64) int
    Neighbours(uint64) chan uint64

func NewDiGraph(htfactory hashtable.HashTableFactory, args ...interface{}) (g Graph)

type INode uint64

func (i *INode) Hash() uint64

func (i *INode) String() string

type MemoryNodeIndex map[uint64]Node

func (ni MemoryNodeIndex) Get(i uint64) (Node, bool)

func (ni MemoryNodeIndex) Put(n Node)

type Node interface {
    Hash() uint64
    String() string

func NewSNode(s string) Node

type NodeIndex interface {
    Get(uint64) (Node, bool)

func NewMemoryNodeIndex() NodeIndex

type SNode struct {
    // contains unexported fields

func (n *SNode) Hash() uint64

func (n *SNode) String() string

type TriGraph struct {
    // contains unexported fields

func NewTriGraph(htfactory hashtable.HashTableFactory, args ...interface{}) *TriGraph

func (tg *TriGraph) Add(s, p, o uint64, e interface{})

func (tg *TriGraph) Del(s, p, o uint64)

func (tg *TriGraph) Get(s, p, o uint64) (interface{}, bool)

func (tg *TriGraph) Query(s, p, o *uint64) (ss []uint64, ps []uint64, os []uint64)