Graph Class
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Represents a directed graph that consists of nodes and links.
Inheritance Hierarchy
System.Object
Microsoft.VisualStudio.GraphModel.GraphObject
Microsoft.VisualStudio.GraphModel.Graph
Namespace: Microsoft.VisualStudio.GraphModel
Assembly: Microsoft.VisualStudio.GraphModel (in Microsoft.VisualStudio.GraphModel.dll)
Syntax
'Declaration
<SerializableAttribute> _
Public Class Graph _
Inherits GraphObject _
Implements ISerializable
[SerializableAttribute]
public class Graph : GraphObject, ISerializable
[SerializableAttribute]
public ref class Graph : public GraphObject,
ISerializable
[<SerializableAttribute>]
type Graph =
class
inherit GraphObject
interface ISerializable
end
public class Graph extends GraphObject implements ISerializable
The Graph type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Graph() | Constructs a Graph object. | |
Graph(SerializationInfo, StreamingContext) | Special constructor that is used for deserialization only. |
Top
Properties
Name | Description | |
---|---|---|
AllGroups | Every group in the graph regardless of visibility or nesting. | |
AllSchemas | Returns a list of all unique known schemas. | |
Categories | Returns all categories. Never returns null. (Inherited from GraphObject.) | |
CategoryCount | Returns the number of categories in the object. (Inherited from GraphObject.) | |
CommonPaths | A dictionary of the common paths that are replaced during serialization. | |
DescriptiveCategoryLabel | Creates a delimited list of all category labels for this graph object. (Inherited from GraphObject.) | |
DocumentSchema | The serialized document schema for the graph. (Overrides GraphObject.DocumentSchema.) | |
Groups | Gets the collection of all top-level groups. | |
IsGroup | Gets whether this object is IsGroup. It looks for the GraphProperties.StyleForGroup. (Inherited from GraphObject.) | |
IsPseudo | Gets whether this object is Pseudo. It looks for the GraphProperties.IsPseudo. (Inherited from GraphObject.) | |
Item | Property that gets or sets a property value. (Inherited from GraphObject.) | |
Links | Gets the collection of links. | |
Nodes | Gets the collection of nodes. | |
OrphanNodes | Gets all nodes that are not children of any GraphGroup. | |
Owner | Gets the Graph object that this object belongs to. (Inherited from GraphObject.) | |
Paths | CommonPaths found by the serializer during load which we will also use during save. | |
Properties | Property that returns an enumeration of all annotations. The order of the enumeration is random. (Inherited from GraphObject.) | |
PropertyCount | Property that returns a number of all annotations. (Inherited from GraphObject.) | |
PropertyKeys | Property that returns an enumeration of all annotation keys. The order of the enumeration is random. (Inherited from GraphObject.) | |
PropertyValues | Property that returns an enumeration of all annotation values. The order of the enumeration is random. (Inherited from GraphObject.) | |
Styles | Gets the collection of styles. | |
Visibility | Helper property to get/set visibility property of a GraphObject. (Inherited from GraphObject.) | |
VisibleLinks | Returns the visible links (link.IsVisible == true). | |
VisibleNodes | Returns the visible nodes (node.IsVisible == true). | |
VisibleOrphanNodes | Gets all visible nodes that are not children of any GraphGroup. | |
VisibleTopLevelGroups | Returns the visible top-level groups (node.IsVisible == true). |
Top
Methods
Name | Description | |
---|---|---|
AddCategory | Adds a category to the object. (Inherited from GraphObject.) | |
AddSchema | Adds a new schema to the Graph. As soon as it is added, it cannot be removed again as nodes or links might be using categories or properties from the schema. | |
AsNode | Converts the GraphObject to a GraphNode. If this is a GraphGroup, the inner node is returned. For types other than GraphNode/Group, null is returned. (Inherited from GraphObject.) | |
BeginUpdate(Object, String, UndoOption) | Starts a batch mode update on the Graph (which is more efficient). You must call the Complete() method on the returned GraphTransactionScope, otherwise your changes will be rolled back. The usual pattern is to use this in a using block so that if an exception is thrown the changes are automatically rolled back. | |
BeginUpdate(Object, String, UndoOption, Boolean) | Starts a batch mode update on the Graph (which is more efficient). You must call the Complete() method on the returned GraphTransactionScope, otherwise your changes will be rolled back. The usual pattern is to use this in a using block so that if an exception is thrown the changes are automatically rolled back. | |
Clear | ||
ClearCategories | Remove all categories from this object. (Inherited from GraphObject.) | |
ClearValue(GraphProperty) | Removes the value of the specified property. (Inherited from GraphObject.) | |
Copy | Creates a copy of this graph. | |
CopyCategories | Copies any new categories from the given object, keeping existing categories. (Inherited from GraphObject.) | |
CopyProperties | Copies any new properties from the given object, keeping existing property values unchanged. (Inherited from GraphObject.) | |
CopySchemas | Copies the schemas from the other graph. | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
FindCommonAncestor | Finds the common ancestor of all the nodes in the given collection. | |
FindGroup | Returns the GraphGroup wrapper for the given "IsGroup" node. | |
GetGroupDescendants(IEnumerable<GraphObject>) | Gets a flat list of all the descendant nodes of the given list of graph objects where some of those objects could be groups. | |
GetGroupDescendants(IEnumerable<GraphObject>, Predicate<GraphGroup>, Predicate<GraphNode>) | Gets a flat list of all the descendant nodes of the given list of graph objects where some of those objects could be groups, filtered to include only the nodes and groups that match the given predicates. | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetMetaObject | (Inherited from GraphObject.) | |
GetObjectData | ISerializable implementation. Gets the data for the object. Serialize the graph into DGML. | |
GetSchemaValue | Gets the schema-specific value of the property, if one exists. (Inherited from GraphObject.) | |
GetSearchableObjects | Gets a flat list of all the nodes in the graph that are visible, in top-down DFS group hierarchy order. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GetValue(String) | Gets the value of the specified property. (Inherited from GraphObject.) | |
GetValue(GraphProperty) | Gets the value of the specified annotation. (Inherited from GraphObject.) | |
GetValue<T>(GraphProperty, Graph) | Gets the value of the specified property. (Inherited from GraphObject.) | |
GetValue<T>(GraphProperty, T) | Gets the value of the specified annotation. If property is not set, we return the default value that the caller passed to this method. (Inherited from GraphObject.) | |
GetValue<T>(GraphProperty, Graph, GraphCategory%) | Gets the value of the specified property, and also returns the category that this property value was inherited from, if any. (Inherited from GraphObject.) | |
GetValueAsString | Returns the given property as a string that uses the given culture. (Inherited from GraphObject.) | |
HasCategory(String) | Returns true if the object has the given category. (Inherited from GraphObject.) | |
HasCategory(GraphCategory) | Returns true if the object has the given category. (Inherited from GraphObject.) | |
HasCategory(IEnumerable<GraphCategory>) | Returns true if the object has any of the given categories. (Inherited from GraphObject.) | |
HasCategoryInSet | Determines whether the given set of categories applies to this object. (Inherited from GraphObject.) | |
HasLocalValue | Returns true if the specified property exists on this object with no category inheritance check. (Inherited from GraphObject.) | |
HasValue(String) | Find out whether the object has a value for the specified property. (Inherited from GraphObject.) | |
HasValue(GraphProperty) | Returns true if the specified annotation exists. (Inherited from GraphObject.) | |
HideOrphans | Hides orphan nodes. An orphan is a node that is not contained by a group. | |
ImportLink | Imports a Link together with its source and target nodes so that they belong to the graph also. Merges any node or link properties and categories necessary. | |
ImportNode | Imports a node into a graph, merging any categories and properties necessary. | |
ImportStyle | Creates a copy of the given style that belongs to this graph. | |
ImportSubset(GraphNode, Boolean, Int32) | Clones the given node and its properties and the given number of levels of links and all the nodes those links point to and imports all these new nodes and links into this graph. If levels is zero, no links are copied. If levels is 1, it copies one level of links and all the nodes they point to. | |
ImportSubset(IEnumerable<GraphNode>, Boolean, Int32) | Clones all the nodes and the given number of levels of links away from those nodes. | |
Load(Stream, array<GraphSchema[]) | Loads the graph object model from the given stream. | |
Load(TextReader, array<GraphSchema[]) | Loads the graph object model from the given TextReader. | |
Load(String, array<GraphSchema[]) | Loads a new Graph object from the given file. | |
Load(XDocument, array<GraphSchema[]) | Loads the graph object model from the given XDocument. | |
Load(XmlReader, array<GraphSchema[]) | Loads the graph object model from the given XmlReader. | |
Load(Stream, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) | Loads the graph object model from the given stream. | |
Load(TextReader, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) | Loads the graph object model from the given TextReader. | |
Load(String, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) | Loads a new Graph object from the given file. | |
Load(XDocument, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) | Loads the graph object model from the given XDocument. | |
Load(XmlReader, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) | Loads the graph object model from the given XmlReader. | |
LoadAndMerge(Stream, array<GraphSchema[]) | Loads the graph object model from the given stream and merges it into the graph. | |
LoadAndMerge(String, array<GraphSchema[]) | Loads the graph object model from the given file and merges it in to the graph. | |
LoadAndMerge(XDocument, array<GraphSchema[]) | Loads the graph object model from the given XDocument and merges it into the graph. | |
LoadAndMerge(Stream, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) | Loads the graph object model from the given stream and merges it in to the graph. | |
LoadAndMerge(String, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) | Loads the graph object model from the given file and merges it in to the graph. | |
LoadAndMerge(XDocument, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) | Loads the graph object model from the given XDocument and merges it into the graph. | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Merge(Graph) | Merges all new nodes and links from the given graph into this graph. | |
Merge(IEnumerable<GraphConditionalStyle>) | Merges all the styles from the given list. | |
Merge(IEnumerable<GraphLink>) | Merges all of the links from the given link list into this graph. | |
Merge(IEnumerable<GraphNode>) | Merges all of the nodes from the given node list into this graph. | |
Merge(IEnumerable<GraphObject>) | Merges all new nodes and links from the given list of graph objects into this graph. | |
OnCategoryChanged | (Inherited from GraphObject.) | |
OnPropertyChanged(String) | Raises a PropertyChangd event for the named property. (Inherited from GraphObject.) | |
OnPropertyChanged(GraphProperty) | Raises a PropertyChangd event for the given GraphProperty. (Inherited from GraphObject.) | |
Parse(String, array<GraphSchema[]) | Loads a new Graph object from the given in-memory string that contains DGML markup. | |
Parse(String, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) | Loads a new Graph object from the given in-memory string that contains DGML markup. | |
ParseSerializedNodeId | Parses a serialized node ID into a fully expanded GraphNodeId. | |
RemoveCategory | Removes the category of this object. (Inherited from GraphObject.) | |
RenameNode(String, String) | Renames a Node in the Graph (clones to new Node and removed original). | |
RenameNode(GraphNode, GraphNodeId) | Renames a Node in the Graph (clones to new Node and removed original). | |
RenameNode(GraphNodeId, GraphNodeId) | Renames a Node in the Graph (clones to new Node and removed original). | |
Save(Stream, GraphSerializationSettings) | Save the graph to the output stream with the given settings. | |
Save(String, GraphSerializationSettings) | Saves the Graph the a file. | |
Save(XmlWriter, GraphSerializationSettings) | Saves the graph to the XmlWriter with the given settings. | |
SetValue(String, Object) | Adds an annotation, using the given key, type, and value. (Inherited from GraphObject.) | |
SetValue<T>(GraphProperty, T) | Sets the value of the given property. If the property already exists, its value is overwritten unless the annotation flags prevent otherwise. (Inherited from GraphObject.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
ToXml() | Converts the graph to XML using the GraphSerializer. | |
ToXml(Int32) | Converts the graph to XML using the GraphSerializer. | |
WrapGraphObject | Modifies the current graph object to share the same property and categories as the given graph object. The wrapper and wrappee graph objects will always have identical sets of properties and categories. (Inherited from GraphObject.) |
Top
Events
Name | Description | |
---|---|---|
BeginUndoableTransactionScope | Will be notified when an UndoableGraphTransactionScope is opened by the Graph.BeginUpdate method. | |
CategoryChanged | (Inherited from GraphObject.) | |
EndUndoableTransactionScope | Will be notified when the UndoableGraphTransactionScope opened by Graph.BeginUpdate is disposed. | |
PropertyChanged | (Inherited from GraphObject.) | |
Updated | Event implementation for GraphUpdated. | |
Updating | Event implementation for BeforeUpdate. This is an event that can be listened on and cancel the changes to a graph. |
Top
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.