C# 클래스 Smrf.NodeXL.Adapters.GraphMLGraphAdapter

Converts a graph to and from a GraphML file.
A good introduction to GraphML can be found in the GraphML Primer:

http://graphml.graphdrawing.org/primer/graphml-primer.html

Here is a sample GraphML file that can be converted. It represents a graph with three vertices and two edges.

<?xml version="1.0" encoding="UTF-8"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns"> <key id="EdgeWidth" for="edge" attr.name="Width" attr.type="double"> <default>1.5</default> </key> <key id="VertexColor" for="node" attr.name="Color" attr.type="string" /> <key id="LatestPostDate" for="node" attr.name="Latest Post Date" attr.type="string" /> <graph edgedefault="undirected"> <node id="V1"> <data key="VertexColor">red</data> </node> <node id="V2"> <data key="VertexColor">orange</data> </node> <node id="V3"> <data key="VertexColor">blue</data> </node> <edge source="V1" target="V2"> <data key="LatestPostDate">2009/07/05</data> </edge> <edge source="V3" target="V2"> <data key="EdgeWidth">2.5</data> <data key="LatestPostDate">2009/07/12</data> </edge> </graph> </graphml>

Edge and vertex attributes, which GraphML calls "GraphML-attributes," are supported by this class. When loading a graph, if an edge or vertex has a GraphML-attribute, it gets added to the metadata of the or IVertex. The metadata key is the GraphML-attribute's attr.name value and the metadata value is the GraphML-attribute's value. When saving a graph, every metadata value on every edge and vertex gets converted to a GraphML-attribute in the saved GraphML.

To make it possible for the caller to determine which metadata keys were added to the graph's edges and vertices, the LoadXX methods add and keys to the returned graph. The key values are of type String[].

If there is an optional "description" attribute on the "graph" XML node, the LoadXX methods copy its value to a key on the returned graph.

If there is an optional "suggestedFileNameNoExtension" attribute on the "graph" XML node, the LoadXX methods copy its value to a key on the returned graph.

When saving a graph, the caller must add and keys to the graph before calling IGraphAdapter.SaveGraph(IGraph, Stream).

상속: GraphAdapterBase, IGraphAdapter
파일 보기 프로젝트 열기: 2014-sed-team3/term-project 1 사용 예제들

공개 메소드들

메소드 설명
AssertValid ( ) : void
GraphMLGraphAdapter ( ) : System

Initializes a new instance of the GraphMLGraphAdapter class.

보호된 메소드들

메소드 설명
AppendGraphMLAttributeValues ( IMetadataProvider oEdgeOrVertex, GraphMLXmlDocument oGraphMLXmlDocument, XmlNode oEdgeOrVertexXmlNode, String asAttributeNames, String AttributeIDPrefix ) : void
GetGraphDirectedness ( XmlNode oGraphXmlNode ) : GraphDirectedness
GetSupportedDirectedness ( System.Boolean &supportsDirected, System.Boolean &supportsUndirected, System.Boolean &supportsMixed ) : void
LoadGraphCore ( Stream stream ) : IGraph
ParseEdges ( IGraph oGraph, XmlNode oGraphXmlNode, XmlNamespaceManager oXmlNamespaceManager, IVertex>.Dictionary oVertexDictionary, GraphMLAttribute>.Dictionary oGraphMLAttributeDictionary ) : void
ParseGraphAttribute ( IGraph oGraph, XmlNode oGraphXmlNode, String sXmlAttributeName, String sKey ) : void
ParseGraphMLAttributeDefinitions ( XmlNode oGraphMLXmlNode, XmlNamespaceManager oXmlNamespaceManager ) : GraphMLAttribute>.Dictionary
ParseGraphMLAttributeValues ( XmlNode oNodeOrEdgeXmlNode, XmlNamespaceManager oXmlNamespaceManager, IMetadataProvider oEdgeOrVertex, System.Boolean bIsVertex, GraphMLAttribute>.Dictionary oGraphMLAttributeDictionary ) : void
ParseVertices ( IGraph oGraph, XmlNode oGraphXmlNode, XmlNamespaceManager oXmlNamespaceManager, GraphMLAttribute>.Dictionary oGraphMLAttributeDictionary ) : IVertex>.Dictionary
SaveGraphCore ( IGraph graph, Stream stream ) : void
SaveGraphMLAttributeNames ( IGraph oGraph, GraphMLAttribute>.Dictionary oGraphMLAttributeDictionary ) : void
TryGraphMLNodeIDToVertex ( XmlNode oEdgeXmlNode, String sSourceOrTarget, IVertex>.Dictionary oVertexDictionary, IVertex &oVertex ) : System.Boolean

메소드 상세

AppendGraphMLAttributeValues() 보호된 메소드

protected AppendGraphMLAttributeValues ( IMetadataProvider oEdgeOrVertex, GraphMLXmlDocument oGraphMLXmlDocument, XmlNode oEdgeOrVertexXmlNode, String asAttributeNames, String AttributeIDPrefix ) : void
oEdgeOrVertex IMetadataProvider
oGraphMLXmlDocument Smrf.XmlLib.GraphMLXmlDocument
oEdgeOrVertexXmlNode System.Xml.XmlNode
asAttributeNames String
AttributeIDPrefix String
리턴 void

AssertValid() 공개 메소드

public AssertValid ( ) : void
리턴 void

GetGraphDirectedness() 보호된 메소드

protected GetGraphDirectedness ( XmlNode oGraphXmlNode ) : GraphDirectedness
oGraphXmlNode System.Xml.XmlNode
리턴 GraphDirectedness

GetSupportedDirectedness() 보호된 메소드

protected GetSupportedDirectedness ( System.Boolean &supportsDirected, System.Boolean &supportsUndirected, System.Boolean &supportsMixed ) : void
supportsDirected System.Boolean
supportsUndirected System.Boolean
supportsMixed System.Boolean
리턴 void

GraphMLGraphAdapter() 공개 메소드

Initializes a new instance of the GraphMLGraphAdapter class.
public GraphMLGraphAdapter ( ) : System
리턴 System

LoadGraphCore() 보호된 메소드

protected LoadGraphCore ( Stream stream ) : IGraph
stream Stream
리턴 IGraph

ParseEdges() 보호된 메소드

protected ParseEdges ( IGraph oGraph, XmlNode oGraphXmlNode, XmlNamespaceManager oXmlNamespaceManager, IVertex>.Dictionary oVertexDictionary, GraphMLAttribute>.Dictionary oGraphMLAttributeDictionary ) : void
oGraph IGraph
oGraphXmlNode System.Xml.XmlNode
oXmlNamespaceManager System.Xml.XmlNamespaceManager
oVertexDictionary IVertex>.Dictionary
oGraphMLAttributeDictionary GraphMLAttribute>.Dictionary
리턴 void

ParseGraphAttribute() 보호된 메소드

protected ParseGraphAttribute ( IGraph oGraph, XmlNode oGraphXmlNode, String sXmlAttributeName, String sKey ) : void
oGraph IGraph
oGraphXmlNode System.Xml.XmlNode
sXmlAttributeName String
sKey String
리턴 void

ParseGraphMLAttributeDefinitions() 보호된 메소드

protected ParseGraphMLAttributeDefinitions ( XmlNode oGraphMLXmlNode, XmlNamespaceManager oXmlNamespaceManager ) : GraphMLAttribute>.Dictionary
oGraphMLXmlNode System.Xml.XmlNode
oXmlNamespaceManager System.Xml.XmlNamespaceManager
리턴 GraphMLAttribute>.Dictionary

ParseGraphMLAttributeValues() 보호된 메소드

protected ParseGraphMLAttributeValues ( XmlNode oNodeOrEdgeXmlNode, XmlNamespaceManager oXmlNamespaceManager, IMetadataProvider oEdgeOrVertex, System.Boolean bIsVertex, GraphMLAttribute>.Dictionary oGraphMLAttributeDictionary ) : void
oNodeOrEdgeXmlNode System.Xml.XmlNode
oXmlNamespaceManager System.Xml.XmlNamespaceManager
oEdgeOrVertex IMetadataProvider
bIsVertex System.Boolean
oGraphMLAttributeDictionary GraphMLAttribute>.Dictionary
리턴 void

ParseVertices() 보호된 메소드

protected ParseVertices ( IGraph oGraph, XmlNode oGraphXmlNode, XmlNamespaceManager oXmlNamespaceManager, GraphMLAttribute>.Dictionary oGraphMLAttributeDictionary ) : IVertex>.Dictionary
oGraph IGraph
oGraphXmlNode System.Xml.XmlNode
oXmlNamespaceManager System.Xml.XmlNamespaceManager
oGraphMLAttributeDictionary GraphMLAttribute>.Dictionary
리턴 IVertex>.Dictionary

SaveGraphCore() 보호된 메소드

protected SaveGraphCore ( IGraph graph, Stream stream ) : void
graph IGraph
stream Stream
리턴 void

SaveGraphMLAttributeNames() 보호된 메소드

protected SaveGraphMLAttributeNames ( IGraph oGraph, GraphMLAttribute>.Dictionary oGraphMLAttributeDictionary ) : void
oGraph IGraph
oGraphMLAttributeDictionary GraphMLAttribute>.Dictionary
리턴 void

TryGraphMLNodeIDToVertex() 보호된 메소드

protected TryGraphMLNodeIDToVertex ( XmlNode oEdgeXmlNode, String sSourceOrTarget, IVertex>.Dictionary oVertexDictionary, IVertex &oVertex ) : System.Boolean
oEdgeXmlNode System.Xml.XmlNode
sSourceOrTarget String
oVertexDictionary IVertex>.Dictionary
oVertex IVertex
리턴 System.Boolean