1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
XDocument xdoc = new XDocument(
new XElement("graphml",
new XAttribute("xmlsn", "http://graphml.graphdrawing.org/xmlns"),
new XElement("graph",
new XAttribute("id", "test"),
new XElement("node",
new XAttribute("id", "1")), // node 1
new XElement("node",
new XAttribute("id", "2")), // node 2
new XElement("node",
new XAttribute("id", "3")), // node 3
new XElement("edge",
new XAttribute("id", "1to2"),
new XAttribute("source", "1"),
new XAttribute("target", "2")),
new XElement("edge",
new XAttribute("id", "1to3"),
new XAttribute("source", "1"),
new XAttribute("target", "3")),
new XElement("edge",
new XAttribute("id", "2to3"),
new XAttribute("source", "2"),
new XAttribute("target", "3"))))); |
Partager