Your comment on this question: Your name to display optional : Email me at this address if a comment is added after mine:Email me if a comment is added after mine Privacy: Your email address will only be used for sending these notifications. Anti-spam verification: To avoid this verification in future, please log in or register. Your answer Your name to display optional : Email me at this address if my answer is selected or commented on:Email me if my answer is selected or commented on Privacy: Your email address will only be used for sending these notifications. This example is meant to illustrate the basic concept of structured content. It is not meant as a specification for SVG support.

Author:Kajijas Mutilar
Language:English (Spanish)
Genre:Health and Food
Published (Last):26 August 2012
PDF File Size:10.67 Mb
ePub File Size:7.39 Mb
Price:Free* [*Free Regsitration Required]

The text assumes that you have a basic understanding of XML 1. Basic knowledge of XML Schema is also assumed for some parts of this document. Each major section of the primer introduces new features of the language, and describes those features in the context of concrete examples.

Section 2 covers the basic mechanisms of GraphML. It describes how to declare a simple graph by defining its nodes and edges and how to add simple user data to the graph. Section 3 describes advanced graph models which include nested graphs, hyperedges, and ports. Section 4 describes mechanisms for extending GraphML to store complex application specific data.

The primer is a non-normative document, which means that it does not provide a definitive specification of the GraphML language. The examples and other explanatory material in this document are provided to help you understand GraphML, but they may not always provide definitive answers. In such cases, you will need to refer to the GraphML specification, and to help you do this, we provide many links pointing to the relevant parts of the specification. Let us start by considering the graph shown in the figure below.

It contains 11 nodes and 12 edges. A simple graph The graph is contained in the file simple. In the remainder of this section we will discuss these elements in detail and show how they define a graph. Of course other encodings can be chosen for GraphML documents. The second line contains the root-element element of a GraphML document: the graphml element. In our example we use the standard schema for GraphML documents located on the graphdrawing.

The XML Schema reference is not required but it provides means to validate the document and is therefore strongly recommended. Nested inside a graph element are the declarations of nodes and edges. A node is declared with a node element, and an egde with an edge element.

If no direction is specified when an edge is declared, the default direction is applied to the edge. The default direction is declared as the XML Attribute edgedefault of the graph element. The two possible value for this XML Attribute are directed and undirected. Note that the default direction must be specified.

Optionally an identifier for the graph can be specified with the XML Attribute id. The identifier is used, when it is necessary to reference the graph. Each node has an identifier, which must be unique within the entire document, i. The identifier of a node is defined by the XML-Attribute id.

Each edge must define its two endpoints with the XML-Attributes source and target. The value of the source, resp. Edges with only one endpoint, also called loops, selfloops, or reflexive edges, are defined by having the same value for source and target.

The optional XML-Attribute directed declares if the edge is directed or undirected. The value true declares a directed edge, the value false an undirected edge. If the direction is not explicitely defined, the default direction is applied to this edge as defined in the enclosing graph. Optionally an identifier for the edge can be specified with the XML Attribute id. When it is necessary to reference the edge, the id XML-Attribute is used. While pure topological information may be sufficient for some appications of GraphML, for the most time additional information is needed.

With the help of the extension GraphML-Attributes one can specify additional information of simple type for the elements of the graph.

Simple type means that the information is restricted to scalar values, e. For a detailed description of this mechanism see Chapter 4. A graph with colored nodes and edge weights.

We will use GraphML-Attributes to store the extra data on the nodes and edges. The file attributes. The purpose of the name is that applications can identify the meaning of the attribute. Note that the name of the GraphML-Attribute is not used inside the document, the identifier is used for this purpose. The type of the GraphML-Attribute can be either boolean, int, long, float, double, or string.

These types are defined like the corresponding types in the Java TM -Programming language. Possible values include graph, node, edge, and all. Declaration of a GraphML Attribute It is possible to define a default value for a GraphML-Attribute.

The text content of the default element defines this default value. The value of the GraphML-Attribute is the text content of the data element. This value must be of the type declared in the corresponding key definition. GraphML-Attribute Values There can be graph elements for which a GraphML-Attribute is defined but no value is declared by a corresponding data element. If a default value is defined for this GraphML-Attribute, then this default value is applied to the graph element.

In the above example no value is defined for the node with identifier n1 and the GraphML-Attribute with name color. Therefore this GraphML-Attribute has the default value, yellow for this node. If no default value is specified, as for the GraphML-Attribute weight in the above example, the value of the GraphML-Attribute is undefined for the graph element.

In the above example the value is undefined of the GraphML-Attribute weight for the edge with identifier e3. All XML-Attributes denoting meta-data are prefixed with parse. There are two kinds of meta-data: information about the number of elements and information how specific data is encoded in the document. The XML-Attribute parse. For the node element the XML-Attribute parse. Otherwise the value of the XML-Attribute is free.

The same holds for edges for which the corresponding XML-Attribute parse. For the value nodesfirst no node element is allowed to occur after the first occurence of an edge element. For the value adjacencylist, the declaration of a node is followed by the declaration of its adjacent edges.

For the value free no order is imposed. The following example demonstrates the parse info meta-data on our running example: A graph with additional parse info attributes.

In this section we discuss advanced graph models which can model a nesting hierarchy, hyperedges and ports. The hierarchy is expressed by the structure of the GraphML document. A node in a GraphML document may have a graph element which itself contains the nodes which are in the hierarchy below this node.

Here is an example for a nested graph and the corresponding GraphML document. Note that in the drawing of the graph the hierarchy is expressed by containment, i. A nested graph. Note that this is true for our example. Declaring the edge between node nn1 and node nnn0 inside graph nn0 would be wrong while declaring it in graph G would be correct. A good policy is to place the edges at the least common ancestor of the nodes in the hierarchy, or at the top level.

For applications which can not handle nested graphs the fall-back behaviour is to ignore nodes which are not contained in the top-level graph and to ignore edges which have do not have both endpoints in the top-level graph. Hyperedges are declared by a hyperedge element in GraphML. For each enpoint of the hyperedge, this hyperedge element contains an endpoint element.

The endpoint element must have an XML-Attribute node, which contains the identifier of a node in the document. The following example contains two hyperedges and two edges. The hyperedges are illustrated by joining arcs, the edges by straight lines.

Note that edges can be either specified by an edge element or by a hyperedge element containing two endpoint elements. A graph with hyperedges. The logical locations are called "ports". As an analogy, think of the graph as a motherboard, the nodes as integrated circuits and the edges as connecting wires. Then the pins on the integrated circuits correspond to ports of a node. The ports of a node are declared by port elements as children of the corresponding node elements.

Note that port elements may be nested, i. Each port element must have an XML-Attribute name, which is an identifier for this port. The edge element has optional XML-Attributes sourceport and targetport with which an edge may specify the port on the source, resp. Correspondingly, the endpoint element has an optional XML-Attribute port. The document port. With GraphML the topology of a graph and simple attributes of graph elements can be serialized.

To store more complex application data one has to extend GraphML. In this section we will discuss the different possibilities to extend GraphML.


igraph Reference Manual



GraphML Primer


Related Articles