speedygrapher

package module
v0.0.0-...-e1a66ee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

README

speedy-grapher

handy tool for transforming CSV data into a Graph Visualization

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDstNodeAsync

func AddDstNodeAsync(record Record, graph *GraphAsync, dstSet *StringSetAsync, errChan chan<- error, wg *sync.WaitGroup)

func AddEdgeAsync

func AddEdgeAsync(record Record, graph *GraphAsync, edgeSet *EdgeSetAsync, errChan chan<- error, wg *sync.WaitGroup)

func AddSrcNodeAsync

func AddSrcNodeAsync(record Record, graph *GraphAsync, srcSet *StringSetAsync, errChan chan<- error, wg *sync.WaitGroup)

func CoordinatedGraphUpdate

func CoordinatedGraphUpdate(record Record, o *GraphOrchestrator, wg *sync.WaitGroup)

func CreateDOTFile

func CreateDOTFile(filePrefix string, g gographviz.Interface) error

func CsvToGraph

func CsvToGraph(infile string, recordProducer func(*csv.Reader, *FieldnameMap) (Record, error)) (gographviz.Interface, error)

Types

type AnnotatedEdge

type AnnotatedEdge struct{ Src, Dst, Label string }

type EdgeSet

type EdgeSet map[AnnotatedEdge]struct{}

func NewEdgeSet

func NewEdgeSet() *EdgeSet

func (*EdgeSet) Add

func (s *EdgeSet) Add(elem AnnotatedEdge)

func (*EdgeSet) Has

func (s *EdgeSet) Has(elem AnnotatedEdge) bool

type EdgeSetAsync

type EdgeSetAsync struct {
	Set EdgeSet
	sync.RWMutex
}

func NewEdgeSetAsync

func NewEdgeSetAsync() *EdgeSetAsync

func (*EdgeSetAsync) Add

func (s *EdgeSetAsync) Add(elem AnnotatedEdge)

func (*EdgeSetAsync) Has

func (s *EdgeSetAsync) Has(elem AnnotatedEdge) bool

type FieldnameMap

type FieldnameMap map[int]string // TODO: Support fieldnames from JSON

mapping of csv column numbers to their respective field names

func CsvExtractFieldnames

func CsvExtractFieldnames(fh *csv.Reader) (*FieldnameMap, error)

func NewFieldnameMap

func NewFieldnameMap() *FieldnameMap

func (FieldnameMap) UpdateFromSlice

func (f FieldnameMap) UpdateFromSlice(s []string) (*FieldnameMap, error)

Note: Update expects a []string of fieldnames, and then imports each string and position into the map

This most useful when paired with something like csv.Reader.Read(), which returns []string

type GraphAsync

type GraphAsync struct {
	gographviz.Graph
	sync.RWMutex
}

func NewGraphAsync

func NewGraphAsync() *GraphAsync

type GraphOrchestrator

type GraphOrchestrator struct {
	Metadata map[string]string // only use this for arbitrary metadata not compatible with DOT attributes; otherwise use Graph.Attrs
	Graph    *GraphAsync
	SrcSet   *StringSetAsync
	DstSet   *StringSetAsync
	EdgeSet  *EdgeSetAsync
	Errors   chan error
}

func NewGraphOrchestrator

func NewGraphOrchestrator() (*GraphOrchestrator, error)

type Record

type Record map[string]string

func CsvProduceRecord

func CsvProduceRecord(fh *csv.Reader, fnames *FieldnameMap) (Record, error)

func NewRecord

func NewRecord() Record

type StringSet

type StringSet map[string]struct{}

func NewStringSet

func NewStringSet() *StringSet

func (*StringSet) Add

func (s *StringSet) Add(elem string)

func (*StringSet) Has

func (s *StringSet) Has(elem string) bool

type StringSetAsync

type StringSetAsync struct {
	Set StringSet
	sync.RWMutex
}

func NewStringSetAsync

func NewStringSetAsync() *StringSetAsync

func (*StringSetAsync) Add

func (s *StringSetAsync) Add(elem string)

func (*StringSetAsync) Has

func (s *StringSetAsync) Has(elem string) bool

type StringSetter

type StringSetter interface {
	Add(elem string)
	Has(elem string) bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL