pulumi/pkg/graph/graph.go
Sean Gillespie 99da1f5350
Spruce up the stack graph command:
1. Output different-colored edges for parent-child resource
    relationships
    2. Allow the changing of edge colors via command-line parameters
    3. Allow the skipping of the parent-child graph or the
    dependency graph when calculating all edges

This modifies the Graph interface slightly to allow an edge to specify
what color should be used when drawing it.
2018-02-22 17:31:45 -08:00

37 lines
2 KiB
Go

// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
// Package graph defines LumiGL graphs. Each graph is directed and acyclic, and the nodes have been topologically
// sorted based on dependencies (edges) between them. Each node in the graph has a type and a set of properties.
//
// There are two forms of graph: complete and incomplete. A complete graph is one in which all nodes and their property
// values are known. An incomplete graph is one where two uncertainties may arise: (1) an edge might be "conditional",
// indicating that its presence or absence is dependent on a piece of information not yet available (like an output
// property from a resource), and/or (2) a property may either be similarly conditional or computed as an output value.
//
// In general, LumiPacks may be evaluated to produce graphs. These may then be compared to other graphs to produce
// and/or carry out deployment plans. This package therefore also exposes operations necessary for diffing graphs.
package graph
// Graph is an instance of a LumiGL digraph. Each is associated with a single LumiPack as its input, along
// with a set of optional arguments used to evaluate it, along with the output DAG with node types and properties.
type Graph interface {
Roots() []Edge // the root edges.
}
// Vertex is a single vertex within an overall LumiGL graph.
type Vertex interface {
Data() interface{} // arbitrary data associated with this vertex.
Label() string // the vertex's label.
Ins() []Edge // incoming edges from other vertices within the graph to this vertex.
Outs() []Edge // outgoing edges from this vertex to other vertices within the graph.
}
// Edge is a directed edge from one vertex to another.
type Edge interface {
Data() interface{} // arbitrary data associated with this edge.
Label() string // this edge's label.
To() Vertex // the vertex this edge connects to.
From() Vertex // the vertex this edge connects from.
Color() string // an optional color for this edge, for when this graph is displayed.
}