Share via


Graph Class

Represents a directed graph, consisting of nodes and links.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.GraphModel.GraphObject
    Microsoft.VisualStudio.GraphModel.Graph
      Microsoft.VisualStudio.GraphModel.GraphSchema

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 Categories Return all categories. Never returns null. (Inherited from GraphObject.)
Public property CategoryCount Return number of categories in the object. (Inherited from GraphObject.)
Public property DescriptiveCategoryCaption (Inherited from GraphObject.)
Public property IsCollapsed Get whether this node is collapsed. (Inherited from GraphObject.)
Public property IsExpanded Get whether this node is expanded. (Inherited from GraphObject.)
Public property IsGroup Get whether this object is IsGroup. It looks for the GraphProperties.StyleForGroup (Inherited from GraphObject.)
Public property IsPseudo Get 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 Get the collection of links
Public property Nodes Get the collection of nodes
Public property Owner Get 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 an number of 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 Schemas The set of schemas associated with the Graph
Public property Styles Get the collection of styles
Public property Visibility Helper property to get/set visibility property of a GraphObject (Inherited from GraphObject.)
Public property VisibleLinks Return the visible links (link.IsVisible == true).
Public property VisibleNodes Return the visible nodes (node.IsVisible == true).

Top

Methods

  Name Description
Public method AddCategory Add a category to the object (Inherited from GraphObject.)
Public method AddSchema Add a new schema to the Graph - once it's added, it cannot be removed again as nodes or links might be using categories or properties from the schema.
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 Create a copy of this graph.
Public method CopyCategories Copy any new categories from the given object, keeping existing categories. (Inherited from GraphObject.)
Public method CopyProperties Copy any new properties from the given object, keeping existing property values unchanged. (Inherited from GraphObject.)
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 method GetDocumentSchema
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetObjectData ISerializable implementation - Gets the data for the object. Serialize the graph into DGML
Public methodStatic member GetTransactionId
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
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 reutnr the default value that the caller pass to this method (Inherited from GraphObject.)
Public method GetValue<T>(GraphProperty, Graph, GraphCategory%) Gets the value of the specified property, and also return the category that this property value was inherited from if any. (Inherited from GraphObject.)
Public method GetValueAsString Returns the given property as a string using the given culture. (Inherited from GraphObject.)
Public method HasCategory(String) Return true if the object has the given category. (Inherited from GraphObject.)
Public method HasCategory(GraphCategory) Return true if the object has the given category. (Inherited from GraphObject.)
Public method HasCategory(IEnumerable<GraphCategory>) Return true if the object has any of the given categories. (Inherited from GraphObject.)
Public method HasCategoryInSet Determines if the given set of categories applies to this object. (Inherited from GraphObject.)
Public method HasValue Return 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 along with its source and target nodes so 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 ImportSubset Clone the given node and it's properties and the given number of levels of links and all the nodes those links point to and import all these new nodes and links into this graph. If levels is zero then no links are copied. If levels is 1 then it copies one level of links and all the nodes they point to.
Protected method InitializeDefaultSchemas
Public methodStatic member Load Load a new Graph object from the given file.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Merge(Graph) Merge all new nodes and links from the given graph into this graph
Public method Merge(IEnumerable<GraphConditionalStyle>)
Public method Merge(IEnumerable<GraphLink>) Merge all of the links from the given link list into this graph
Public method Merge(IEnumerable<GraphNode>) Merge all of the nodes from the given node list into this graph
Public method Merge(IEnumerable<GraphObject>) Merge all new nodes and links from the given list of graph objects into this graph
Public methodStatic member Parse Load a new Graph object from the given in-memory string containing DGML markup.
Public method RemoveCategory Remove 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)
Public method RenameNode(GraphNodeId, GraphNodeId)
Public method Save Save the Graph the a file.
Public method SetMetadata Set the metadata for an object to the specific metadata. This will be associated with the Graph Document Schema.
Public methodStatic member SetTransactionId
Public method SetValue<T> Sets the value of the given property. If the proeprty 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()
Public method ToXml(Int32) Convert the graph to XML using the GraphSerializer.

Top

Events

  Name Description
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