Пример #1
0
        TestClone()
        {
            // Loop through multiple scenarios.

            Int32 [] aiVertices = new Int32 [] { 0, 6 };

            foreach (Boolean bCopyMetadataValues in TestGraphUtil.AllBoolean)
            {
                foreach (Boolean bCopyTag in TestGraphUtil.AllBoolean)
                {
                    foreach (GraphDirectedness eDirectedness in
                             TestGraphUtil.AllGraphDirectedness)
                    {
                        foreach (Int32 iVertices in aiVertices)
                        {
                            foreach (Boolean bAddEdges in TestGraphUtil.AllBoolean)
                            {
                                const String Name = "fdjkerwuio";

                                // Prepare the graph to be cloned.

                                InitializeGraph(eDirectedness);

                                m_oGraph.Name = Name;

                                MetadataUtil.SetRandomMetadata(m_oGraph, true, true, m_oGraph.ID);

                                // Add the vertices and set metadata on them.  For the seed, use
                                // the vertex ID.

                                IVertex [] aoVertices =
                                    TestGraphUtil.AddVertices(m_oGraph, iVertices);

                                for (Int32 i = 0; i < iVertices; i++)
                                {
                                    IVertex oVertex = aoVertices[i];

                                    MetadataUtil.SetRandomMetadata(
                                        oVertex, true, true, oVertex.ID);
                                }

                                if (bAddEdges)
                                {
                                    // Add the edges and set metadata on them.  For the seed, use
                                    // the edge ID.

                                    IEdge [] aoEdges = TestGraphUtil.MakeGraphComplete(
                                        m_oGraph, aoVertices,
                                        (eDirectedness == GraphDirectedness.Directed)
                                        );

                                    foreach (IEdge oEdge in m_oGraph.Edges)
                                    {
                                        MetadataUtil.SetRandomMetadata(
                                            oEdge, true, true, oEdge.ID);
                                    }
                                }

                                // Clone the graph.

                                IGraph oNewGraph = m_oGraph.Clone(bCopyMetadataValues, bCopyTag);

                                // Check the metadata on the new graph.

                                MetadataUtil.CheckRandomMetadata(
                                    oNewGraph, bCopyMetadataValues, bCopyTag, m_oGraph.ID);

                                // Check the vertices on the new graph.

                                IVertexCollection oNewVertexCollection = oNewGraph.Vertices;

                                Assert.IsNotNull(oNewVertexCollection);

                                Assert.AreEqual(iVertices, oNewVertexCollection.Count);

                                // Loop through the original vertices.

                                foreach (IVertex oVertex in m_oGraph.Vertices)
                                {
                                    // Find the corresponding new vertex, by name.

                                    IVertex oNewVertex;

                                    Assert.IsTrue(oNewVertexCollection.Find(
                                                      oVertex.Name, out oNewVertex));

                                    Assert.AreNotEqual(oVertex.ID, oNewVertex.ID);

                                    // Check the vertex's metadata.  Use the original vertex ID as
                                    // a seed.

                                    MetadataUtil.CheckRandomMetadata(oNewVertex,
                                                                     bCopyMetadataValues, bCopyTag, oVertex.ID);
                                }

                                // Check the edges on the new graph.

                                IEdgeCollection oNewEdgeCollection = oNewGraph.Edges;

                                Assert.IsNotNull(oNewEdgeCollection);

                                Assert.AreEqual(

                                    bAddEdges ?
                                    TestGraphUtil.GetEdgeCountForCompleteGraph(iVertices) : 0,

                                    oNewEdgeCollection.Count
                                    );

                                // Loop through the original edges.

                                foreach (IEdge oEdge in m_oGraph.Edges)
                                {
                                    // Find the corresponding new edge, by name.

                                    IEdge oNewEdge;

                                    Assert.IsTrue(oNewEdgeCollection.Find(
                                                      oEdge.Name, out oNewEdge));

                                    Assert.AreNotEqual(oEdge.ID, oNewEdge.ID);

                                    // Check the edge's metadata.  Use the original edge ID as a
                                    // seed.

                                    MetadataUtil.CheckRandomMetadata(oNewEdge,
                                                                     bCopyMetadataValues, bCopyTag, oEdge.ID);

                                    // Verify that the new edge and original edge connect vertices
                                    // that correspond.

                                    Assert.IsNotNull(oNewEdge.Vertices[0]);
                                    Assert.IsNotNull(oNewEdge.Vertices[1]);

                                    Assert.AreEqual(oNewEdge.Vertices[0].Name,
                                                    oEdge.Vertices[0].Name);

                                    Assert.AreEqual(oNewEdge.Vertices[1].Name,
                                                    oEdge.Vertices[1].Name);
                                }

                                // Check the other properties on the new graph.

                                Assert.AreEqual(Name, oNewGraph.Name);

                                Assert.AreEqual(eDirectedness, oNewGraph.Directedness);

                                Assert.AreNotEqual(m_oGraph.ID, oNewGraph.ID);
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        TestLoadGraphFromStream4()
        {
            // Nested graph, using sample XML from the GraphML Primer.
            // GraphMLGraphAdapter should, according to the Primer, "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."

            const String XmlString =
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                + "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\"  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
                + " xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd\">"
                + "  <graph id=\"G\" edgedefault=\"undirected\">"
                + "    <node id=\"n0\"/>"
                + "    <node id=\"n1\"/>"
                + "    <node id=\"n2\"/>"
                + "    <node id=\"n3\"/>"
                + "    <node id=\"n4\"/>"
                + "    <node id=\"n5\">"
                + "        <graph id=\"n5:\" edgedefault=\"undirected\">"
                + "          <node id=\"n5::n0\"/>"
                + "          <node id=\"n5::n1\"/>"
                + "          <node id=\"n5::n2\"/>"
                + "          <edge id=\"e0\" source=\"n5::n0\" target=\"n5::n2\"/>"
                + "          <edge id=\"e1\" source=\"n5::n1\" target=\"n5::n2\"/>"
                + "        </graph>"
                + "    </node>"
                + "    <node id=\"n6\">"
                + "        <graph id=\"n6:\" edgedefault=\"undirected\">"
                + "          <node id=\"n6::n0\">"
                + "              <graph id=\"n6::n0:\" edgedefault=\"undirected\">"
                + "                <node id=\"n6::n0::n0\"/>"
                + "               </graph>"
                + "          </node>"
                + "          <node id=\"n6::n1\"/>"
                + "          <node id=\"n6::n2\"/>"
                + "          <edge id=\"e10\" source=\"n6::n1\" target=\"n6::n0::n0\"/>"
                + "          <edge id=\"e11\" source=\"n6::n1\" target=\"n6::n2\"/>"
                + "        </graph>"
                + "    </node>"
                + "    <edge id=\"e2\" source=\"n5::n2\" target=\"n0\"/>"
                + "    <edge id=\"e3\" source=\"n0\" target=\"n2\"/>"
                + "    <edge id=\"e4\" source=\"n0\" target=\"n1\"/>"
                + "    <edge id=\"e5\" source=\"n1\" target=\"n3\"/>"
                + "    <edge id=\"e6\" source=\"n3\" target=\"n2\"/>"
                + "    <edge id=\"e7\" source=\"n2\" target=\"n4\"/>"
                + "    <edge id=\"e8\" source=\"n3\" target=\"n6::n1\"/>"
                + "    <edge id=\"e9\" source=\"n6::n1\" target=\"n4\"/>"
                + "  </graph>"
                + "</graphml>"
            ;

            Stream oXmlStream = new StringStream(XmlString);

            IGraph oGraph = m_oGraphAdapter.LoadGraphFromStream(oXmlStream);

            Assert.AreEqual(GraphDirectedness.Undirected, oGraph.Directedness);

            IVertexCollection oVertices = oGraph.Vertices;
            IEdgeCollection   oEdges    = oGraph.Edges;
            Boolean           bFound;
            IVertex           oVertex;

            Assert.AreEqual(7, oVertices.Count);

            bFound = oVertices.Find("n0", out oVertex);
            Assert.IsTrue(bFound);

            bFound = oVertices.Find("n1", out oVertex);
            Assert.IsTrue(bFound);

            bFound = oVertices.Find("n2", out oVertex);
            Assert.IsTrue(bFound);

            bFound = oVertices.Find("n3", out oVertex);
            Assert.IsTrue(bFound);

            bFound = oVertices.Find("n4", out oVertex);
            Assert.IsTrue(bFound);

            bFound = oVertices.Find("n5", out oVertex);
            Assert.IsTrue(bFound);

            bFound = oVertices.Find("n6", out oVertex);
            Assert.IsTrue(bFound);

            IEdge oEdge;

            bFound = oEdges.Find("e3", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n0", oEdge.Vertices[0].Name);
            Assert.AreEqual("n2", oEdge.Vertices[1].Name);

            bFound = oEdges.Find("e4", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n0", oEdge.Vertices[0].Name);
            Assert.AreEqual("n1", oEdge.Vertices[1].Name);

            bFound = oEdges.Find("e5", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n1", oEdge.Vertices[0].Name);
            Assert.AreEqual("n3", oEdge.Vertices[1].Name);

            bFound = oEdges.Find("e6", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n3", oEdge.Vertices[0].Name);
            Assert.AreEqual("n2", oEdge.Vertices[1].Name);
            Assert.IsFalse(oEdge.ContainsKey("weight"));

            bFound = oEdges.Find("e7", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n2", oEdge.Vertices[0].Name);
            Assert.AreEqual("n4", oEdge.Vertices[1].Name);
        }
Пример #3
0
        TestLoadGraphFromStream2()
        {
            // Overall test, using sample XML from the GraphML Primer.

            const String XmlString =
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                + "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\"  "
                + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
                + "xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns "
                + "http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd\">"
                + "<key id=\"d0\" for=\"node\" attr.name=\"color\" attr.type=\"string\">"
                + "<default>yellow</default>"
                + "</key>"
                + "<key id=\"d1\" for=\"edge\" attr.name=\"weight\" attr.type=\"double\"/>"
                + "<graph id=\"G\" edgedefault=\"undirected\">"
                + "<node id=\"n0\">"
                + "<data key=\"d0\">green</data>"
                + "</node>"
                + "<node id=\"n1\"/>"
                + "<node id=\"n2\">"
                + "<data key=\"d0\">blue</data>"
                + "</node>"
                + "<node id=\"n3\">"
                + "<data key=\"d0\">red</data>"
                + "</node>"
                + "<node id=\"n4\"/>"
                + "<node id=\"n5\">"
                + "<data key=\"d0\">turquoise</data>"
                + "</node>"
                + "<edge id=\"e0\" source=\"n0\" target=\"n2\">"
                + "<data key=\"d1\">1.0</data>"
                + "</edge>"
                + "<edge id=\"e1\" source=\"n0\" target=\"n1\">"
                + "<data key=\"d1\">1.0</data>"
                + "</edge>"
                + "<edge id=\"e2\" source=\"n1\" target=\"n3\">"
                + "<data key=\"d1\">2.0</data>"
                + "</edge>"
                + "<edge id=\"e3\" source=\"n3\" target=\"n2\"/>"
                + "<edge id=\"e4\" source=\"n2\" target=\"n4\"/>"
                + "<edge id=\"e5\" source=\"n3\" target=\"n5\"/>"
                + "<edge id=\"e6\" source=\"n5\" target=\"n4\">"
                + "<data key=\"d1\">1.1</data>"
                + "</edge>"
                + "</graph>"
                + "</graphml>"
            ;

            Stream oXmlStream = new StringStream(XmlString);

            IGraph oGraph = m_oGraphAdapter.LoadGraphFromStream(oXmlStream);

            Assert.AreEqual(GraphDirectedness.Undirected, oGraph.Directedness);

            IVertexCollection oVertices = oGraph.Vertices;
            IEdgeCollection   oEdges    = oGraph.Edges;
            Boolean           bFound;
            IVertex           oVertex;
            String            sColor;

            Assert.AreEqual(6, oVertices.Count);

            bFound = oVertices.Find("n0", out oVertex);
            Assert.IsTrue(bFound);
            sColor = (String)oVertex.GetRequiredValue("color", typeof(String));
            Assert.AreEqual("green", sColor);

            bFound = oVertices.Find("n1", out oVertex);
            Assert.IsTrue(bFound);
            sColor = (String)oVertex.GetRequiredValue("color", typeof(String));
            Assert.AreEqual("yellow", sColor);

            bFound = oVertices.Find("n2", out oVertex);
            Assert.IsTrue(bFound);
            sColor = (String)oVertex.GetRequiredValue("color", typeof(String));
            Assert.AreEqual("blue", sColor);

            bFound = oVertices.Find("n3", out oVertex);
            Assert.IsTrue(bFound);
            sColor = (String)oVertex.GetRequiredValue("color", typeof(String));
            Assert.AreEqual("red", sColor);

            bFound = oVertices.Find("n4", out oVertex);
            Assert.IsTrue(bFound);
            sColor = (String)oVertex.GetRequiredValue("color", typeof(String));
            Assert.AreEqual("yellow", sColor);

            bFound = oVertices.Find("n5", out oVertex);
            Assert.IsTrue(bFound);
            sColor = (String)oVertex.GetRequiredValue("color", typeof(String));
            Assert.AreEqual("turquoise", sColor);

            IEdge  oEdge;
            Double dWeight;

            bFound = oEdges.Find("e0", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n0", oEdge.Vertices[0].Name);
            Assert.AreEqual("n2", oEdge.Vertices[1].Name);
            dWeight = (Double)oEdge.GetRequiredValue("weight", typeof(Double));
            Assert.AreEqual(1.0, dWeight);

            bFound = oEdges.Find("e1", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n0", oEdge.Vertices[0].Name);
            Assert.AreEqual("n1", oEdge.Vertices[1].Name);
            dWeight = (Double)oEdge.GetRequiredValue("weight", typeof(Double));
            Assert.AreEqual(1.0, dWeight);

            bFound = oEdges.Find("e2", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n1", oEdge.Vertices[0].Name);
            Assert.AreEqual("n3", oEdge.Vertices[1].Name);
            dWeight = (Double)oEdge.GetRequiredValue("weight", typeof(Double));
            Assert.AreEqual(2.0, dWeight);

            bFound = oEdges.Find("e3", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n3", oEdge.Vertices[0].Name);
            Assert.AreEqual("n2", oEdge.Vertices[1].Name);
            Assert.IsFalse(oEdge.ContainsKey("weight"));

            bFound = oEdges.Find("e4", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n2", oEdge.Vertices[0].Name);
            Assert.AreEqual("n4", oEdge.Vertices[1].Name);
            Assert.IsFalse(oEdge.ContainsKey("weight"));

            bFound = oEdges.Find("e5", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n3", oEdge.Vertices[0].Name);
            Assert.AreEqual("n5", oEdge.Vertices[1].Name);
            Assert.IsFalse(oEdge.ContainsKey("weight"));

            bFound = oEdges.Find("e6", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n5", oEdge.Vertices[0].Name);
            Assert.AreEqual("n4", oEdge.Vertices[1].Name);
            dWeight = (Double)oEdge.GetRequiredValue("weight", typeof(Double));
            Assert.AreEqual(1.1, dWeight);
        }
Пример #4
0
        TestLoadGraphFromStream3()
        {
            // Overall test, using sample XML from the GraphML Primer, but with
            // missing attr.name and attr.type attributes, which are optional.
            //
            // Also, include key nodes with "for" attributes not used by NodeXL.
            // The for="graphml" is actually illegal, but was found in a GraphML
            // file created by a program called yED.
            //
            // Also, include a data node with no inner text, which was also in the
            // yED file.

            const String XmlString =
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                + "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\"  "
                + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
                + "xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns "
                + "http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd\">"
                + "<key id=\"d0\" for=\"node\">"
                + "<default>yellow</default>"
                + "</key>"
                + "<key id=\"d1\" for=\"edge\"/>"
                + "<key id=\"dSkip1\" for=\"graph\"/>"
                + "<key id=\"dSkip2\" for=\"all\"/>"
                + "<key id=\"dIllegal\" for=\"graphml\"/>"
                + "<graph id=\"G\" edgedefault=\"undirected\">"
                + "<node id=\"n0\">"
                + "<data key=\"d0\">green</data>"
                + "</node>"
                + "<node id=\"n1\"/>"
                + "<node id=\"n2\">"
                + "<data key=\"d0\">blue</data>"
                + "</node>"
                + "<node id=\"n3\">"
                + "<data key=\"d0\">red</data>"
                + "</node>"
                + "<node id=\"n4\">"
                + "<data key=\"d0\" />"
                + "</node>"
                + "<node id=\"n5\">"
                + "<data key=\"d0\">turquoise</data>"
                + "</node>"
                + "<edge id=\"e0\" source=\"n0\" target=\"n2\">"
                + "<data key=\"d1\">1.0</data>"
                + "</edge>"
                + "<edge id=\"e1\" source=\"n0\" target=\"n1\">"
                + "<data key=\"d1\">1.0</data>"
                + "</edge>"
                + "<edge id=\"e2\" source=\"n1\" target=\"n3\">"
                + "<data key=\"d1\">2.0</data>"
                + "</edge>"
                + "<edge id=\"e3\" source=\"n3\" target=\"n2\"/>"
                + "<edge id=\"e4\" source=\"n2\" target=\"n4\"/>"
                + "<edge id=\"e5\" source=\"n3\" target=\"n5\"/>"
                + "<edge id=\"e6\" source=\"n5\" target=\"n4\">"
                + "<data key=\"d1\">1.1</data>"
                + "</edge>"
                + "</graph>"
                + "</graphml>"
            ;

            Stream oXmlStream = new StringStream(XmlString);

            IGraph oGraph = m_oGraphAdapter.LoadGraphFromStream(oXmlStream);

            Assert.AreEqual(GraphDirectedness.Undirected, oGraph.Directedness);

            IVertexCollection oVertices = oGraph.Vertices;
            IEdgeCollection   oEdges    = oGraph.Edges;
            Boolean           bFound;
            IVertex           oVertex;
            String            sColor;

            Assert.AreEqual(6, oVertices.Count);

            bFound = oVertices.Find("n0", out oVertex);
            Assert.IsTrue(bFound);
            sColor = (String)oVertex.GetRequiredValue("d0", typeof(String));
            Assert.AreEqual("green", sColor);

            bFound = oVertices.Find("n1", out oVertex);
            Assert.IsTrue(bFound);
            sColor = (String)oVertex.GetRequiredValue("d0", typeof(String));
            Assert.AreEqual("yellow", sColor);

            bFound = oVertices.Find("n2", out oVertex);
            Assert.IsTrue(bFound);
            sColor = (String)oVertex.GetRequiredValue("d0", typeof(String));
            Assert.AreEqual("blue", sColor);

            bFound = oVertices.Find("n3", out oVertex);
            Assert.IsTrue(bFound);
            sColor = (String)oVertex.GetRequiredValue("d0", typeof(String));
            Assert.AreEqual("red", sColor);

            bFound = oVertices.Find("n4", out oVertex);
            Assert.IsTrue(bFound);
            sColor = (String)oVertex.GetRequiredValue("d0", typeof(String));
            Assert.AreEqual(String.Empty, sColor);

            bFound = oVertices.Find("n5", out oVertex);
            Assert.IsTrue(bFound);
            sColor = (String)oVertex.GetRequiredValue("d0", typeof(String));
            Assert.AreEqual("turquoise", sColor);

            IEdge  oEdge;
            String sWeight;

            bFound = oEdges.Find("e0", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n0", oEdge.Vertices[0].Name);
            Assert.AreEqual("n2", oEdge.Vertices[1].Name);
            sWeight = (String)oEdge.GetRequiredValue("d1", typeof(String));
            Assert.AreEqual("1.0", sWeight);

            bFound = oEdges.Find("e1", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n0", oEdge.Vertices[0].Name);
            Assert.AreEqual("n1", oEdge.Vertices[1].Name);
            sWeight = (String)oEdge.GetRequiredValue("d1", typeof(String));
            Assert.AreEqual("1.0", sWeight);

            bFound = oEdges.Find("e2", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n1", oEdge.Vertices[0].Name);
            Assert.AreEqual("n3", oEdge.Vertices[1].Name);
            sWeight = (String)oEdge.GetRequiredValue("d1", typeof(String));
            Assert.AreEqual("2.0", sWeight);

            bFound = oEdges.Find("e3", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n3", oEdge.Vertices[0].Name);
            Assert.AreEqual("n2", oEdge.Vertices[1].Name);
            Assert.IsFalse(oEdge.ContainsKey("d1"));

            bFound = oEdges.Find("e4", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n2", oEdge.Vertices[0].Name);
            Assert.AreEqual("n4", oEdge.Vertices[1].Name);
            Assert.IsFalse(oEdge.ContainsKey("d1"));

            bFound = oEdges.Find("e5", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n3", oEdge.Vertices[0].Name);
            Assert.AreEqual("n5", oEdge.Vertices[1].Name);
            Assert.IsFalse(oEdge.ContainsKey("d1"));

            bFound = oEdges.Find("e6", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("n5", oEdge.Vertices[0].Name);
            Assert.AreEqual("n4", oEdge.Vertices[1].Name);
            sWeight = (String)oEdge.GetRequiredValue("d1", typeof(String));
            Assert.AreEqual("1.1", sWeight);
        }
Пример #5
0
        TestLoadGraphFromStream()
        {
            // Overall test.

            const String XmlString =

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

            Stream oXmlStream = new StringStream(XmlString);

            IGraph oGraph = m_oGraphAdapter.LoadGraphFromStream(oXmlStream);

            Assert.AreEqual(GraphDirectedness.Undirected, oGraph.Directedness);

            IVertexCollection oVertices = oGraph.Vertices;
            IEdgeCollection   oEdges    = oGraph.Edges;
            Boolean           bFound;
            IVertex           oVertex;
            String            sColor, sLatestPostDate;

            Assert.AreEqual(5, oVertices.Count);

            bFound = oVertices.Find("V1", out oVertex);
            Assert.IsTrue(bFound);
            sColor = (String)oVertex.GetRequiredValue("Color", typeof(String));
            Assert.AreEqual("red", sColor);

            sLatestPostDate = (String)oVertex.GetRequiredValue(
                "Latest Post Date", typeof(String));

            Assert.AreEqual("2009/07/05", sLatestPostDate);


            bFound = oVertices.Find("V2", out oVertex);
            Assert.IsTrue(bFound);
            sColor = (String)oVertex.GetRequiredValue("Color", typeof(String));
            Assert.AreEqual("orange", sColor);

            sLatestPostDate = (String)oVertex.GetRequiredValue(
                "Latest Post Date", typeof(String));

            Assert.AreEqual("2009/07/12", sLatestPostDate);


            bFound = oVertices.Find("V3", out oVertex);
            Assert.IsTrue(bFound);
            sColor = (String)oVertex.GetRequiredValue("Color", typeof(String));
            Assert.AreEqual("blue", sColor);


            bFound = oVertices.Find("V4", out oVertex);
            Assert.IsTrue(bFound);
            sColor = (String)oVertex.GetRequiredValue("Color", typeof(String));
            Assert.AreEqual("128,0,128", sColor);


            bFound = oVertices.Find("V5", out oVertex);
            Assert.IsTrue(bFound);


            IEdge  oEdge;
            Double dWidth;

            bFound = oEdges.Find("E1", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("V1", oEdge.Vertices[0].Name);
            Assert.AreEqual("V2", oEdge.Vertices[1].Name);
            dWidth = (Double)oEdge.GetRequiredValue("Width", typeof(Double));
            Assert.AreEqual(1.5, dWidth);

            bFound = oEdges.Find("E2", out oEdge);
            Assert.IsTrue(bFound);
            Assert.AreEqual("V3", oEdge.Vertices[0].Name);
            Assert.AreEqual("V2", oEdge.Vertices[1].Name);
            dWidth = (Double)oEdge.GetRequiredValue("Width", typeof(Double));
            Assert.AreEqual(2.5, dWidth);

            String [] asGraphMLVertexAttributes = ( String[] )
                                                  oGraph.GetRequiredValue(ReservedMetadataKeys.AllVertexMetadataKeys,
                                                                          typeof(String[]));

            Assert.AreEqual(2, asGraphMLVertexAttributes.Length);

            Assert.IsTrue(Array.IndexOf <String>(asGraphMLVertexAttributes,
                                                 "Color") >= 0);

            Assert.IsTrue(Array.IndexOf <String>(asGraphMLVertexAttributes,
                                                 "Latest Post Date") >= 0);

            String [] asGraphMLEdgeAttributes = ( String[] )
                                                oGraph.GetRequiredValue(ReservedMetadataKeys.AllEdgeMetadataKeys,
                                                                        typeof(String[]));

            Assert.AreEqual(1, asGraphMLEdgeAttributes.Length);

            Assert.IsTrue(Array.IndexOf <String>(asGraphMLEdgeAttributes,
                                                 "Width") >= 0);
        }