{"modulePath":"github.com/2lambda123/openshift-origin","version":"v3.10.0+incompatible","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package genericgraph\n\n## Constants\n\n```go\nconst (\n\tUnknownEdgeKind = \"UnknownEdge\"\n\t// ReferencedByEdgeKind is the kind to use if you're building reverse links that don't have a specific edge in the other direction\n\t// other uses are discouraged.  You should create a kind for your edge\n\tReferencedByEdgeKind = \"ReferencedBy\"\n\t// ContainsEdgeKind is the kind to use if one node's contents logically contain another node's contents.  A given node can only have\n\t// a single inbound Contais edge.  The code does not prevent contains cycles, but that's insane, don't do that.\n\tContainsEdgeKind = \"Contains\"\n)\n```\n\n```go\nconst (\n\tUnknownNodeKind = \"UnknownNode\"\n)\n```\n\n## Functions\n\n```go\nfunc AddReversedEdge(g Interface, from, to graph.Node, edgeKinds sets.String) bool\n```\nAddReversedEdge adds a reversed edge for every passed edge and preserves the existing edge. Used to convert a one directional edge into a bidirectional edge, but will create duplicate edges if a bidirectional edge between two nodes already exists.\n\n```go\nfunc AllNodes(g Interface, node graph.Node) bool\n```\nAllNodes includes all nodes in the graph\n\n```go\nfunc EnsureUnique(g UniqueNodeInitializer, name UniqueName, fn NodeInitializerFunc) graph.Node\n```\n\n```go\nfunc ExistingDirectEdge(g Interface, from, to graph.Node, edgeKinds sets.String) bool\n```\nExistingDirectEdge returns true if both from and to already exist in the graph and the edge kind is not ReferencedByEdgeKind (the generic reverse edge kind). This will purge the graph of any edges created by AddReversedEdge.\n\n```go\nfunc GetContainingNode(g Graph, containedNode graph.Node) graph.Node\n```\nGetContainingNode returns the direct predecessor that is linked to the node by a ContainsEdgeKind.  It returns nil if no container is found.\n\n```go\nfunc GetTopLevelContainerNode(g Graph, containedNode graph.Node) graph.Node\n```\nGetTopLevelContainerNode traverses the reverse ContainsEdgeKind edges until it finds a node that does not have an inbound ContainsEdgeKind edge.  This could be the node itself\n\n```go\nfunc IsFromDifferentNamespace(namespace string, node graph.Node) bool\n```\nIsFromDifferentNamespace returns if a node is in a different namespace than the one provided.\n\n```go\nfunc NodesByKind(g Interface, nodes []graph.Node, kinds ...string) [][]graph.Node\n```\n\n```go\nfunc ReverseExistingDirectEdge(g Interface, from, to graph.Node, edgeKinds sets.String) bool\n```\nReverseExistingDirectEdge reverses the order of the edge and drops the existing edge only if both from and to already exist in the graph and the edge kind is not ReferencedByEdgeKind (the generic reverse edge kind).\n\n```go\nfunc ReverseGraphEdge(g Interface, from, to graph.Node, edgeKinds sets.String) bool\n```\nReverseGraphEdge reverses the order of the edge and drops the existing edge.\n\n## Types\n\n```go\ntype ByID []graph.Node\n```\nByID is a sorted group of nodes by ID\n\n```go\nfunc (m ByID) Len() int\n```\n\n```go\nfunc (m ByID) Less(i, j int) bool\n```\n\n```go\nfunc (m ByID) Swap(i, j int)\n```\n\n```go\ntype ByKey []Marker\n```\n\n```go\nfunc (m ByKey) Len() int\n```\n\n```go\nfunc (m ByKey) Less(i, j int) bool\n```\n\n```go\nfunc (m ByKey) Swap(i, j int)\n```\n\n```go\ntype ByNodeID []Marker\n```\n\n```go\nfunc (m ByNodeID) Len() int\n```\n\n```go\nfunc (m ByNodeID) Less(i, j int) bool\n```\n\n```go\nfunc (m ByNodeID) Swap(i, j int)\n```\n\n```go\ntype BySeverity []Marker\n```\n\n```go\nfunc (m BySeverity) Len() int\n```\n\n```go\nfunc (m BySeverity) Less(i, j int) bool\n```\n\n```go\nfunc (m BySeverity) Swap(i, j int)\n```\n\n```go\ntype Edge struct {\n\tconcrete.Edge\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewEdge(from, to graph.Node, kinds ...string) Edge\n```\n\n```go\nfunc (e Edge) DOTAttributes() []dot.Attribute\n```\nDOTAttributes implements an attribute getter for the DOT encoding\n\n```go\nfunc (e Edge) IsKind(kind string) bool\n```\n\n```go\nfunc (e Edge) Kinds() sets.String\n```\n\n```go\ntype EdgeFunc func(g Interface, from, to graph.Node, edgeKinds sets.String) bool\n```\nEdgeFunc is passed a new graph, an edge in the current graph, and should mutate the new graph as needed. If true is returned, the existing edge will be added to the graph.\n\n```go\nfunc AddGraphEdgesTo(g Interface) EdgeFunc\n```\nAddGraphEdgesTo returns an EdgeFunc that will add the selected edges to the passed graph.\n\n```go\nfunc EdgesOfKind(kinds ...string) EdgeFunc\n```\nEdgesOfKind returns a new EdgeFunc accepting the provided kinds of edges If no kinds are specified, the returned EdgeFunc will accept all edges\n\n```go\nfunc RemoveInboundEdges(nodes []graph.Node) EdgeFunc\n```\nRemoveInboundEdges returns a new EdgeFunc dismissing any inbound edges to the provided set of nodes\n\n```go\nfunc RemoveOutboundEdges(nodes []graph.Node) EdgeFunc\n```\n\n```go\ntype ExistenceChecker interface {\n\t// Found returns false if the node represents an object that we don't have the backing object for\n\tFound() bool\n}\n```\nExistenceChecker is an interface for those nodes that can be created without a backing object. This can happen when a node wants an edge to a non-existent node.  We know the node should exist, The graph needs something in that location to track the information we have about the node, but the backing object doesn't exist.\n\n```go\ntype Graph struct {\n\t// the standard graph\n\tgraph.Directed\n\t// helper methods for switching on the kind and types of the node\n\tGraphDescriber\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc New() Graph\n```\nNew initializes a graph from input to output.\n\n```go\nfunc (g Graph) AddEdge(from, to graph.Node, edgeKind string)\n```\nAddEdge implements MutableUniqueGraph\n\n```go\nfunc (g Graph) AddNode(n graph.Node)\n```\n\n```go\nfunc (g Graph) ConnectedEdgeSubgraph(fn EdgeFunc) Graph\n```\nConnectedEdgeSubgraph creates a new graph that iterates through all edges in the graph and includes all edges the provided function returns true for. Nodes not referenced by an edge will be dropped unless the function adds them explicitly.\n\n```go\nfunc (g Graph) EdgeSubgraph(edgeFn EdgeFunc) Graph\n```\nEdgeSubgraph returns the directed subgraph with only the edges that match the provided function.\n\n```go\nfunc (g Graph) Edges() []graph.Edge\n```\nEdges returns all the edges of the graph. Note that the returned set will have no specific ordering.\n\n```go\nfunc (g Graph) Find(name UniqueName) graph.Node\n```\n\n```go\nfunc (g Graph) FindOrCreate(name UniqueName, fn NodeInitializerFunc) (graph.Node, bool)\n```\n\n```go\nfunc (g Graph) InboundEdges(node graph.Node, edgeKinds ...string) []graph.Edge\n```\nInboundEdges returns all the inbound edges to node that are in the list of edgeKinds if edgeKinds is empty, then all edges are returned\n\n```go\nfunc (g Graph) NodesByKind(nodeKinds ...string) []graph.Node\n```\nNodesByKind returns all the nodes of the graph with the provided kinds\n\n```go\nfunc (g Graph) OutboundEdges(node graph.Node, edgeKinds ...string) []graph.Edge\n```\nOutboundEdges returns all the outbound edges from node that are in the list of edgeKinds if edgeKinds is empty, then all edges are returned\n\n```go\nfunc (g Graph) PredecessorEdges(node graph.Node, fn EdgeFunc, edgeKinds ...string)\n```\nPredecessorEdges invokes fn with all of the predecessor edges of node that have the specified edge kind.\n\n```go\nfunc (g Graph) PredecessorNodesByEdgeKind(node graph.Node, edgeKinds ...string) []graph.Node\n```\nPredecessorNodesByEdgeKind returns all the predecessor nodes of the given node that can be reached via edges of the provided kinds\n\n```go\nfunc (g Graph) RootNodes() []graph.Node\n```\nRootNodes returns all the roots of this graph.\n\n```go\nfunc (g Graph) String() string\n```\n\n```go\nfunc (g Graph) Subgraph(nodeFn NodeFunc, edgeFn EdgeFunc) Graph\n```\nSubgraph returns the directed subgraph with only the nodes and edges that match the provided functions.\n\n```go\nfunc (g Graph) SubgraphWithNodes(nodes []graph.Node, fn EdgeFunc) Graph\n```\nSubgraphWithNodes returns the directed subgraph with only the listed nodes and edges that match the provided function.\n\n```go\nfunc (g Graph) SuccessorEdges(node graph.Node, fn EdgeFunc, edgeKinds ...string)\n```\nSuccessorEdges invokes fn with all of the successor edges of node that have the specified edge kind.\n\n```go\nfunc (g Graph) SuccessorNodesByEdgeKind(node graph.Node, edgeKinds ...string) []graph.Node\n```\nSuccessorNodesByEdgeKind returns all the successor nodes of the given node that can be reached via edges of the provided kinds\n\n```go\nfunc (g Graph) SuccessorNodesByNodeAndEdgeKind(node graph.Node, nodeKind, edgeKind string) []graph.Node\n```\n\n```go\nfunc (g Graph) SyntheticNodes() []graph.Node\n```\nSyntheticNodes returns back the set of nodes that were created in response to edge requests, but did not exist\n\n```go\ntype GraphDescriber interface {\n\tName(node graph.Node) string\n\tKind(node graph.Node) string\n\tObject(node graph.Node) interface{}\n\tEdgeKinds(edge graph.Edge) sets.String\n}\n```\n\n```go\ntype Interface interface {\n\tgraph.Directed\n\n\tGraphDescriber\n\tMutableUniqueGraph\n\n\tEdges() []graph.Edge\n}\n```\n\n```go\ntype Marker struct {\n\t// Node is the optional node that this message is attached to\n\tNode graph.Node\n\t// RelatedNodes is an optional list of other nodes that are involved in this marker.\n\tRelatedNodes []graph.Node\n\n\t// Severity indicates how important this problem is.\n\tSeverity Severity\n\t// Key is a short string to identify this message\n\tKey string\n\n\t// Message is a human-readable string that describes what is interesting\n\tMessage string\n\t// Suggestion is a human-readable string that holds advice for resolving this\n\t// marker.\n\tSuggestion Suggestion\n}\n```\nMarker is a struct that describes something interesting on a Node\n\n```go\ntype MarkerScanner func(g Graph, f Namer) []Marker\n```\nMarkerScanner is a function for analyzing a graph and finding interesting things in it\n\n```go\ntype Markers []Marker\n```\n\n```go\nfunc (m Markers) BySeverity(severity Severity) []Marker\n```\n\n```go\nfunc (m Markers) FilterByNamespace(namespace string) Markers\n```\nFilterByNamespace returns all the markers that are not associated with missing nodes from other namespaces (other than the provided namespace).\n\n```go\ntype MutableDirectedEdge interface {\n\tAddEdge(from, to graph.Node, edgeKind string)\n}\n```\n\n```go\ntype MutableUniqueGraph interface {\n\tgraph.Mutable\n\tMutableDirectedEdge\n\tUniqueNodeInitializer\n\tNodeFinder\n}\n```\n\n```go\ntype Namer interface {\n\tResourceName(obj interface{}) string\n}\n```\n\n```go\nvar DefaultNamer Namer = namer{}\n```\n\n```go\ntype Node struct {\n\tconcrete.Node\n\tUniqueName\n}\n```\n\n```go\nfunc (n Node) DOTAttributes() []dot.Attribute\n```\nDOTAttributes implements an attribute getter for the DOT encoding\n\n```go\ntype NodeFinder interface {\n\tFind(name UniqueName) graph.Node\n}\n```\n\n```go\ntype NodeFunc func(g Interface, n graph.Node) bool\n```\nNodeFunc is passed a new graph, a node in the graph, and should return true if the node should be included.\n\n```go\nfunc NodesOfKind(kinds ...string) NodeFunc\n```\nNodesOfKind returns a new NodeFunc accepting the provided kinds of nodes If no kinds are specified, the returned NodeFunc will accept all nodes\n\n```go\ntype NodeInitializerFunc func(Node) graph.Node\n```\n\n```go\ntype NodeSet map[int]struct{}\n```\n\n```go\nfunc (n NodeSet) Add(id int)\n```\n\n```go\nfunc (n NodeSet) Has(id int) bool\n```\n\n```go\ntype Severity string\n```\nSeverity indicates how important this problem is.\n\n```go\nconst (\n\t// InfoSeverity is interesting\n\t// Currently used in missing probe markers\n\tInfoSeverity Severity = \"info\"\n\t// WarningSeverity is probably wrong, but we aren't certain\n\tWarningSeverity Severity = \"warning\"\n\t// ErrorSeverity is definitely wrong, this won't work\n\tErrorSeverity Severity = \"error\"\n)\n```\n\n```go\ntype Suggestion string\n```\n\n```go\nfunc (s Suggestion) String() string\n```\n\n```go\ntype UniqueName string\n```\n\n```go\nfunc GetUniqueRuntimeObjectNodeName(nodeKind string, obj runtime.Object) UniqueName\n```\n\n```go\nfunc (n UniqueName) String() string\n```\n\n```go\nfunc (n UniqueName) UniqueName() string\n```\n\n```go\ntype UniqueNameFunc func(obj interface{}) UniqueName\n```\n\n```go\ntype UniqueNodeInitializer interface {\n\tFindOrCreate(name UniqueName, fn NodeInitializerFunc) (graph.Node, bool)\n}\n```\nUniqueNodeInitializer is a graph that allows nodes with a unique name to be added without duplication. If the node is newly added, true will be returned.\n\n","path":"github.com/2lambda123/openshift-origin/pkg/oc/graph/genericgraph","name":"genericgraph","synopsis":"","isRedistributable":true}
