Share via


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
Public method Graph() Constructs a Graph object.
Protected method Graph(SerializationInfo, StreamingContext) Special constructor that is used for deserialization only.

Top

Properties

  Name Description
Public property AllGroups Every group in the graph regardless of visibility or nesting.
Public property AllSchemas Returns a list of all unique known schemas.
Public property Categories Returns all categories. Never returns null. (Inherited from GraphObject.)
Public property CategoryCount Returns the number of categories in the object. (Inherited from GraphObject.)
Public propertyStatic member CommonPaths A dictionary of the common paths that are replaced during serialization.
Public property DescriptiveCategoryLabel Creates a delimited list of all category labels for this graph object. (Inherited from GraphObject.)
Public property DocumentSchema The serialized document schema for the graph. (Overrides GraphObject.DocumentSchema.)
Public property Groups Gets the collection of all top-level groups.
Public property IsGroup Gets whether this object is IsGroup. It looks for the GraphProperties.StyleForGroup. (Inherited from GraphObject.)
Public property IsPseudo Gets whether this object is Pseudo. It looks for the GraphProperties.IsPseudo. (Inherited from GraphObject.)
Public property Item Property that gets or sets a property value. (Inherited from GraphObject.)
Public property Links Gets the collection of links.
Public property Nodes Gets the collection of nodes.
Public property OrphanNodes Gets all nodes that are not children of any GraphGroup.
Public property Owner Gets the Graph object that this object belongs to. (Inherited from GraphObject.)
Public property Paths CommonPaths found by the serializer during load which we will also use during save.
Public property Properties Property that returns an enumeration of all annotations. The order of the enumeration is random. (Inherited from GraphObject.)
Public property PropertyCount Property that returns a number of all annotations. (Inherited from GraphObject.)
Public property PropertyKeys Property that returns an enumeration of all annotation keys. The order of the enumeration is random. (Inherited from GraphObject.)
Public property PropertyValues Property that returns an enumeration of all annotation values. The order of the enumeration is random. (Inherited from GraphObject.)
Public property Styles Gets the collection of styles.
Public property Visibility Helper property to get/set visibility property of a GraphObject. (Inherited from GraphObject.)
Public property VisibleLinks Returns the visible links (link.IsVisible == true).
Public property VisibleNodes Returns the visible nodes (node.IsVisible == true).
Public property VisibleOrphanNodes Gets all visible nodes that are not children of any GraphGroup.
Public property VisibleTopLevelGroups Returns the visible top-level groups (node.IsVisible == true).

Top

Methods

  Name Description
Public method AddCategory Adds a category to the object. (Inherited from GraphObject.)
Public method 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.
Public method 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.)
Public method 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.
Public method 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.
Public method Clear
Public method ClearCategories Remove all categories from this object. (Inherited from GraphObject.)
Public method ClearValue(GraphProperty) Removes the value of the specified property. (Inherited from GraphObject.)
Public method Copy Creates a copy of this graph.
Public method CopyCategories Copies any new categories from the given object, keeping existing categories. (Inherited from GraphObject.)
Public method CopyProperties Copies any new properties from the given object, keeping existing property values unchanged. (Inherited from GraphObject.)
Public method CopySchemas Copies the schemas from the other graph.
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodStatic member FindCommonAncestor Finds the common ancestor of all the nodes in the given collection.
Public method FindGroup Returns the GraphGroup wrapper for the given "IsGroup" node.
Public methodStatic member 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.
Public methodStatic member 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.
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetMetaObject (Inherited from GraphObject.)
Public method GetObjectData ISerializable implementation. Gets the data for the object. Serialize the graph into DGML.
Protected method GetSchemaValue Gets the schema-specific value of the property, if one exists. (Inherited from GraphObject.)
Public methodStatic member GetSearchableObjects Gets a flat list of all the nodes in the graph that are visible, in top-down DFS group hierarchy order.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method GetValue(String) Gets the value of the specified property. (Inherited from GraphObject.)
Public method GetValue(GraphProperty) Gets the value of the specified annotation. (Inherited from GraphObject.)
Public method GetValue<T>(GraphProperty, Graph) Gets the value of the specified property. (Inherited from GraphObject.)
Public method 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.)
Public method 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.)
Public method GetValueAsString Returns the given property as a string that uses the given culture. (Inherited from GraphObject.)
Public method HasCategory(String) Returns true if the object has the given category. (Inherited from GraphObject.)
Public method HasCategory(GraphCategory) Returns true if the object has the given category. (Inherited from GraphObject.)
Public method HasCategory(IEnumerable<GraphCategory>) Returns true if the object has any of the given categories. (Inherited from GraphObject.)
Public method HasCategoryInSet Determines whether the given set of categories applies to this object. (Inherited from GraphObject.)
Public method HasLocalValue Returns true if the specified property exists on this object with no category inheritance check. (Inherited from GraphObject.)
Public method HasValue(String) Find out whether the object has a value for the specified property. (Inherited from GraphObject.)
Public method HasValue(GraphProperty) Returns true if the specified annotation exists. (Inherited from GraphObject.)
Public method HideOrphans Hides orphan nodes. An orphan is a node that is not contained by a group.
Public method 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.
Public method ImportNode Imports a node into a graph, merging any categories and properties necessary.
Public method ImportStyle Creates a copy of the given style that belongs to this graph.
Public method 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.
Public method ImportSubset(IEnumerable<GraphNode>, Boolean, Int32) Clones all the nodes and the given number of levels of links away from those nodes.
Public methodStatic member Load(Stream, array<GraphSchema[]) Loads the graph object model from the given stream.
Public methodStatic member Load(TextReader, array<GraphSchema[]) Loads the graph object model from the given TextReader.
Public methodStatic member Load(String, array<GraphSchema[]) Loads a new Graph object from the given file.
Public methodStatic member Load(XDocument, array<GraphSchema[]) Loads the graph object model from the given XDocument.
Public methodStatic member Load(XmlReader, array<GraphSchema[]) Loads the graph object model from the given XmlReader.
Public methodStatic member Load(Stream, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) Loads the graph object model from the given stream.
Public methodStatic member Load(TextReader, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) Loads the graph object model from the given TextReader.
Public methodStatic member Load(String, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) Loads a new Graph object from the given file.
Public methodStatic member Load(XDocument, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) Loads the graph object model from the given XDocument.
Public methodStatic member Load(XmlReader, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) Loads the graph object model from the given XmlReader.
Public method LoadAndMerge(Stream, array<GraphSchema[]) Loads the graph object model from the given stream and merges it into the graph.
Public method LoadAndMerge(String, array<GraphSchema[]) Loads the graph object model from the given file and merges it in to the graph.
Public method LoadAndMerge(XDocument, array<GraphSchema[]) Loads the graph object model from the given XDocument and merges it into the graph.
Public method LoadAndMerge(Stream, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) Loads the graph object model from the given stream and merges it in to the graph.
Public method LoadAndMerge(String, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) Loads the graph object model from the given file and merges it in to the graph.
Public method LoadAndMerge(XDocument, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) Loads the graph object model from the given XDocument and merges it into the graph.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Merge(Graph) Merges all new nodes and links from the given graph into this graph.
Public method Merge(IEnumerable<GraphConditionalStyle>) Merges all the styles from the given list.
Public method Merge(IEnumerable<GraphLink>) Merges all of the links from the given link list into this graph.
Public method Merge(IEnumerable<GraphNode>) Merges all of the nodes from the given node list into this graph.
Public method Merge(IEnumerable<GraphObject>) Merges all new nodes and links from the given list of graph objects into this graph.
Protected method OnCategoryChanged (Inherited from GraphObject.)
Public method OnPropertyChanged(String) Raises a PropertyChangd event for the named property. (Inherited from GraphObject.)
Public method OnPropertyChanged(GraphProperty) Raises a PropertyChangd event for the given GraphProperty. (Inherited from GraphObject.)
Public methodStatic member Parse(String, array<GraphSchema[]) Loads a new Graph object from the given in-memory string that contains DGML markup.
Public methodStatic member Parse(String, EventHandler<GraphDeserializationProgressEventArgs>, array<GraphSchema[]) Loads a new Graph object from the given in-memory string that contains DGML markup.
Public method ParseSerializedNodeId Parses a serialized node ID into a fully expanded GraphNodeId.
Public method RemoveCategory Removes the category of this object. (Inherited from GraphObject.)
Public method RenameNode(String, String) Renames a Node in the Graph (clones to new Node and removed original).
Public method RenameNode(GraphNode, GraphNodeId) Renames a Node in the Graph (clones to new Node and removed original).
Public method RenameNode(GraphNodeId, GraphNodeId) Renames a Node in the Graph (clones to new Node and removed original).
Public method Save(Stream, GraphSerializationSettings) Save the graph to the output stream with the given settings.
Public method Save(String, GraphSerializationSettings) Saves the Graph the a file.
Public method Save(XmlWriter, GraphSerializationSettings) Saves the graph to the XmlWriter with the given settings.
Public method SetValue(String, Object) Adds an annotation, using the given key, type, and value. (Inherited from GraphObject.)
Public method 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.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method ToXml() Converts the graph to XML using the GraphSerializer.
Public method ToXml(Int32) Converts the graph to XML using the GraphSerializer.
Protected method 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
Public event BeginUndoableTransactionScope Will be notified when an UndoableGraphTransactionScope is opened by the Graph.BeginUpdate method.
Public event CategoryChanged (Inherited from GraphObject.)
Public event EndUndoableTransactionScope Will be notified when the UndoableGraphTransactionScope opened by Graph.BeginUpdate is disposed.
Public event PropertyChanged (Inherited from GraphObject.)
Public event Updated Event implementation for GraphUpdated.
Public event 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.

See Also

Reference

Microsoft.VisualStudio.GraphModel Namespace