private void ReadVertex([NotNull] IDictionary <string, TVertex> vertices)
            {
                Debug.Assert(vertices != null);
                Debug.Assert(
                    _reader.NodeType == XmlNodeType.Element &&
                    _reader.Name == NodeTag &&
                    _reader.NamespaceURI == _graphMLNamespace);

                // Get subtree
                using (XmlReader subReader = _reader.ReadSubtree())
                {
                    // Read id
                    string id = ReadAttributeValue(_reader, IdAttribute);
                    // Create new vertex
                    TVertex vertex = _vertexFactory(id);
                    // Apply defaults
                    ReadDelegateCompiler.SetVertexDefault(vertex);
                    // Read data
                    while (subReader.Read())
                    {
                        if (_reader.NodeType == XmlNodeType.Element &&
                            _reader.Name == DataTag &&
                            _reader.NamespaceURI == _graphMLNamespace)
                        {
                            ReadDelegateCompiler.VertexAttributesReader(subReader, _graphMLNamespace, vertex);
                        }
                    }

                    // Add to graph
                    _graph.AddVertex(vertex);
                    vertices.Add(id, vertex);
                }
            }
            private void ReadVertex(Dictionary <string, TVertex> vertices)
            {
                Contract.Requires(vertices != null);
                Contract.Assert(
                    this.Reader.NodeType == XmlNodeType.Element &&
                    this.Reader.Name == "node" &&
                    this.Reader.NamespaceURI == this.graphMLNamespace);

                // get subtree
                using (var subReader = this.Reader.ReadSubtree())
                {
                    // read id
                    string id = ReadAttributeValue(this.Reader, "id");
                    // create new vertex
                    TVertex vertex = vertexFactory(id);
                    // apply defaults
                    ReadDelegateCompiler.SetVertexDefault(vertex);
                    // read data
                    while (subReader.Read())
                    {
                        if (reader.NodeType == XmlNodeType.Element &&
                            reader.Name == "data" &&
                            reader.NamespaceURI == this.graphMLNamespace)
                        {
                            ReadDelegateCompiler.VertexAttributesReader(subReader, this.graphMLNamespace, vertex);
                        }
                    }
                    // add to graph
                    this.VisitedGraph.AddVertex(vertex);
                    vertices.Add(id, vertex);
                }
            }